Tutorial on modifying network configuration After cloning centos6 Virtual Machine in Linux, linuxcentos6
This configuration is based on centos6.
Generally, when you directly clone a VM and execute ifconfig on the obtained Vm, the IP address is usually not displayed. This is because we still lack some configuration.
The configuration is as follows:
1) modify the network address
(1) edit file vi/etc/sysconfig/network-scripts/ifcfg-eth0
Network Service running at startup: ONBOOT = yes
(2) set the IP address
If BOOTPROTO = dhcp is set, the virtual machine automatically obtains the IP address;
To specify the IP value, set OOTPROTO = static and specify the IPADDR, NETMASK, and GATEWAY values. As follows:
OOTPROTO = static
IPADDR = 192.168.13.136
NETMASK = 255.255.255.0
GATEWAY = 192.168.13.2
Note that the gateway value is set when the nat network mode is set.
2) Reassign the physical address
(1) Delete physical addresses in/etc/sysconfig/network-scripts/ifcfg-eth0 files
Delete two rows: UUID and physical address (HWADDR). If the above files do not have these two items, you don't have to worry about it.
(2) Delete the file/etc/udev/rules. d/70-persistent-net.rules
Operation: rm-rf/etc/udev/rules. d/70-persistent-net.rules
3) modify the Host Name
The cloned Virtual Machine name is still the name of the original virtual machine, which can be modified in the/etc/sysconfig/network file.
Run vi/etc/sysconfig/network to configure its HOSTNAME.
4) Restart linux
Execute the operation: init 6
5) check whether the network can be pinged to the Internet.
Operation: ping www.baidu.com
If the network cannot be pinged, you must set the dns service.
Run vi/etc/resolv. conf.
Add content:
Nameserver 219.232.48.61
Nameserver 59.108.61.61
Nameserver 114.114.114.114
Delete the line of search localdomain
Note: to map the IP address and Host Name of a VM, you can modify the/etc/hosts file to add the configuration of the IP address host name.