Recently Learning Linux Environment Deployment ~ ~ ~
First, set the network adaptation setting as the bridging mode
Check the native IP address, ipconfig, remember the IPv4 address and default gateway address, and so on will be configured to use
Start CentOS, enter terminal mode, set the IP address,
Switch to this directory, cd/etc/sysconfig/network-scripts
Find ifcfg-eno1677736, (if not new, the details are as follows)
Edit the Vim ifcfg-eno16777736 (you can rename the file with MV A B)
Device=eth1
HWADDR=00:0C:29:90:5D:8C (This can be viewed in the network adapter)
Type=ethernet
Onboot=yes
Nm_controlled=yes
Bootproto=static
broadcast=192.168.20.255 (the first three bits are the same as the host's IP address, and the latter one is 255)
dns1=202.101.172.35
ipaddr=192.168.20.140 (the IP address of the virtual machine, the first three bits are consistent with the host)
netmask=255.255.255.0
gateway=192.168.20.1 (default gateway address for host)
Defroute=yes
Peerdns=yes
Peerroutes=yes
Ipv4_failure_fatal=yes
Ipv6init=yes
View the MAC address of CentOS
After editing is complete, press ESC and enter: Wq Save and exit
IP address configuration after completion
Type=ethernet
Bootproto=static
Defroute=yes
Peerdns=yes
Peerroutes=yes
Ipv4_failure_fatal=yes
Ipv6init=yes
Name=ens33
Uuid=4e0da825-c403-4cb4-9dd6-915e78106fe3
Device=ens33
Onboot=yes
broadcast=192.168.1.255
ipaddr=192.168.1.131
gateway=192.168.1.1
netwask=255.255.255.0
dns1=192.168.1.1
hwaddr=00:0c:29:6e:b3:91
This way, save some of the commands to exit:
: w save file but do not exit VI
: W file saves the modification to file and does not exit VI
: w! Forced to save, do not launch VI
: Wq save file and Exit VI
: wq! Force the file to be saved and exit VI
Q: Do not save file, Exit VI
: q! Do not save file, Force exit VI
: e! Discard all changes and edit from the last time the file was saved
After Setup, restart the service
Service Network restart
After restarting, directly ping the machine try to see if it can pass
If a restart fails, try to remove the device line from the Ifcfg-eno file.
VMware centos7 static IP settings