Linux learning-4. Remote login management

Network mode and configuration

1. Current computer network card

Virtual network card: VMnet1, VMnet8
Real network card: wireless network connection 16 (wireless network card) local connection 5 (wired network card)

Insert picture description here

2. Virtual machine network configuration

Insert picture description here
1. Hostonly Host-only mode The
virtual machine can only communicate with the machine through the VMnet1 network card. Can’t communicate with other real machines in the LAN,

Insert picture description here
2) Network right-click properties.
In Network-Settings -, query a fake network segment IP automatically assigned by the virtual machine: 192.168.154.1.
This VMnet1 network segment must be the same as the Linux network segment:
use the Ifconfig (if for interface) command
Lo: (local loopback) local loopback network card, 127.0.0.1 (used for local communication test)

Insert picture description here
Insert picture description here

All hardware under Linux have file names. The file name
describing the partition is sd1 under dev.
The file name describing the network card is eth0, eth1......

(eth0 means the first network card)
Assign IP to the first network card: ifconfig eth0 192.168.154.2
Insert picture description here
Ethernet: Ethernet network card type
HWaddr: hardware Mac address (hexadecimal)
and then use cmd in Windows system

Ping 192.168.154.2

As shown below
Insert picture description here
Insert picture description here

2. Bridging

Use a real network card (wireless or wired network card) to connect to the current real host. After connection, you can communicate with the real machine, or you can connect and communicate with other hosts in the local area network. Realize the communication within the local area network as an independent real machine.
The disadvantage is that it will occupy one IP in the network segment (it is easy to cause IP address conflict)

1. In the virtual machine settings, select bridge to
Insert picture description here
view the IP of the real host
Insert picture description here
. Use the command in Linux

Ifconfig eth0 192.168.31.242

Insert picture description here
Use cmd in Windows system

Ping 192.168.31.242

Insert picture description here

Note 1: Use ifconfig to configure the ip address, which is only temporarily effective. After restarting linux, the ip address will be lost.
To make the IP permanent, you must configure the Linux configuration file.
Note 2: After the bridged network card mode is selected
, the ping still cannot be passed. You can edit it in the virtual machine menu bar—virtual network editor. In the bridged mode, select according to your network connection. : Wireless wireless network card , ethernet wired network card
Insert picture description here

3. NAT mode

Real machine connection is realized through the virtual network card of VMnet8. It can only communicate with the real machine and cannot communicate with other real machines in the local area network. However, if the local real machine can access the Internet, the virtual machine can also realize Internet access. Does not occupy real IP address

1. The settings of the virtual network editor in VMware:

1. Subnet IP address: Ensure that it is in the same network segment as the gateway (the red part is the network segment) and does not duplicate the gateway IP address. I set 192.168.236.0

2. Subnet mask: generally fixed 255.255.255.0
Insert picture description here
3. Gateway:
The internal gateway of the "NAT setting" in NAT mode is 192.168.236.2
Insert picture description here
4. Set
the start and end ip in the DHCP DHCP (set ip The range includes the ip of the virtual machine that needs to be guaranteed): The
IP range is
Insert picture description here

Second, the settings in the virtual machine

Permanently set the virtual machine IP in the configuration file:
1. Go to the following directory: /etc/sysconfig/network-scripts/
Insert picture description here
2. Open the file ifcfg-eth0 to
Insert picture description here
edit the file
. Operation command of the text editor:
Insert picture description here
view network information.
Insert picture description here
Restart the network card of the virtual machine
service network restart
Insert picture description here

Three, the local host network settings

1), "Network Connection" VMnet8 settings
Insert picture description here
2) "Local Connection" settings
Insert picture description here
3), network sharing to VMnet8
Insert picture description here

Four, network test

1) CMD—>MSDOS local host ping virtual machine
Insert picture description here
2) Virtual machine ping VMnet8 virtual network card
Insert picture description here
3) Virtual machine ping local host
Insert picture description here
Insert picture description here
4) Virtual machine access to the external network www.baidu.com The
Insert picture description here
above situation is because of Baidu or network The service provider has set up an anti-ping mechanism,
set to not allow PING, or transit PING
can use the mobile network hotspot mode to test the
Insert picture description here
external network communication of the virtual machine of the desktop version of Linux
Insert picture description here

Four, matters needing attention

1. The virtual network card ip of the linux virtual machine, the VMware network adapter gateway, and the linux IP must be in the same network segment.
2. To configure two DNSs in the ifcfg-eth0 configuration file of Linux, one is the host gateway and the other is the DNS domain name resolution server address

dddd
Insert picture description here

Guess you like

Origin blog.csdn.net/sison1999/article/details/115287391