Solution to ip address change of CentOS 6.5 clone virtual machine

Keywords: network Mac

When we clone a virtual machine, we will find that the network card it uses is eth1. How can we modify the configuration file to configure the network?

1. Modify / etc/udev/rules.d/70-persistent-net.rules

We found that there are two lines. We deleted the section with "eth0" above, modified the NAME below to "eth0", and saved to exit.

Note, why do we delete the first paragraph and modify the second paragraph here?

Because we need to keep the TTR and MAC address consistent here, we can view it through virtual machine settings - Network Adapter - Advanced - MAC address:

2. Modify network card information: VI / etc / sysconfig / network scripts / ifcfg-eth0

DEVICE=eth0
HWADDR=00:0C:29:D1:14:36   It needs to be compared with the previous MAC Same address
TYPE=Ethernet
UUID=c0bf142f-045e-466f-910b-ef80c9152a2a

ONBOOT=yes
IPADDR=192.168.216.17    Modify your own IP address
PREFIX=24
NETMASK=255.255.255.0
GATEWAY=192.168.216.2
DNS1=8.8.8.8
DNS2=114.114.114.114

NM_CONTROLLED=yes
BOOTPROTO=static
DEFROUTE=yes
NAME="System eth0"

3. Restart the network card: service network restart

[root@hadoop02 Desktop]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
                                                           [  OK  ]

At this time, let's check:

[root@hadoop02 Desktop]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:0C:29:D1:14:36  
          inet addr:192.168.216.17  Bcast:192.168.216.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fed1:1436/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54 errors:0 dropped:0 overruns:0 frame:0
          TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6781 (6.6 KiB)  TX bytes:4825 (4.7 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:96 errors:0 dropped:0 overruns:0 frame:0
          TX packets:96 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4960 (4.8 KiB)  TX bytes:4960 (4.8 KiB)


 

Posted by DssTrainer on Tue, 31 Dec 2019 04:11:23 -0800