Linux dynamic network and static network and cloned network configuration, linux static
We recommend that you set the nic nat mode.
Dynamic Network Configuration: 1. You must enable the local DHCP service.
2. Select the DHCP option in NAT mode in the virtual network Editor, as shown in figure
3. ifup eth0
Static Network Configuration:
Notes: ifcfg-eth0 partial parameter descriptions
DEVICE = eth0 # describe the DEVICE alias corresponding to the NIC
HWADDR = 00: 0C: 29: 42: DD: 51 # physical address of the corresponding Nic
TYPE = Ethernet # network TYPE (usually Ethemet)
UUID = 514fda06-1fc6-4d19-8a74-74030ed83956
ONBOOT = yes # whether the network interface is valid when the system starts (yes/no)
NM_CONTROLLED = yes
BOOTPROTO = static # Set the way for the NIC to obtain the IP address. The possible options are static, dhcp, or bootp, which respectively correspond to the IP address specified by the static state and the IP address obtained through the dhcp protocol, IP addresses obtained through the bootp protocol
IPADDR = 192.168.0.3 # If you set the method for obtaining the IP address from the NIC to static, this field specifies the IP address of the NIC.
NETMASK = 255.255.255.0 # network mask corresponding to the network adapter
GATEWAY = 192.168.0.2 # GATEWAY
1. edit the file vi/etc/sysconfig/network-scripts/ifcfg-eth0 (take yourself as an example)
Before editing:
Edit:
ONBOOT = yes # whether the network interface is valid when the system starts (yes/no)
BOOTPROTO = static # Set the way for the NIC to obtain the IP address
Added:
IPADDR = 192.168.0.3 # If you set the method for obtaining the IP address from the NIC to static, this field specifies the IP address of the NIC.
NETMASK = 255.255.255.0 # network mask corresponding to the network adapter
GATEWAY = 192.168.0.2 # GATEWAY
After editing:
2: restart the network: service network restart
3: Check: ping 192.168.0.2 (GATEWAY)
Ping www.baidu.com
4: Set the dns Service
Vi/etc/resolv. conf
Edit: nameserver 114.114.114.114
Ping 144.144.144.144
Network settings after cloning: (After cloning, it is changed from eth0 to eth1. You are used to eht0 and change it to eth0)
View the information at this time:
1. The cloned operating system needs to re-allocate the physical address.
A. Delete UUID and physical address in the/etc/sysconfig/network-scripts/ifcfg-eth0 file to set the new IP Address
B. vi/etc/udev/rules. d/70-persistent-net.rules
Delete the eht0 information because of the physical address that is re-allocated after cloning, and change the following eht1 to eth0
2. Modify the Host Name
Vi/etc/sysconfig/network (change the host name centosbk to centosbk1 before cloning) (change as needed)
3. Restart linux