After cloning vmware, there is a problem of Nic conflicts. each time multiple lab virtual machines are created, they are repeated. Therefore, the following script can be used to quickly set up the experiment environment. After cloning, log on to the host, create a new net. sh file, paste the following script, grant the execution permission (chmod + x), and run./net. sh. #! /Bin/bashsed-I & #39; s/eth0/eth2/g & #39;/etc/sysconfig/
After cloning vmware, there is a problem of Nic conflicts. each time multiple lab virtual machines are created, they are repeated. Therefore, the following script can be used to quickly set up the experiment environment.
After cloning, log on to the host, create a new net. sh file, paste the following script, grant the execution permission (chmod + x), and run./net. sh.
#!/bin/bashsed -i 's/eth0/eth2/g' /etc/sysconfig/network-scripts/ifcfg-eth0sed -i 's/eth1/eth3/g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth0sed -i '/HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth1ifconfig eth2 | sed -n '1p' | cut -b 32- >> /etc/sysconfig/network-scripts/ifcfg-eth0ifconfig eth3 | sed -n '1p' | cut -b 32- >> /etc/sysconfig/network-scripts/ifcfg-eth1sed -i 's/HWaddr /HWaddr=/g' /etc/sysconfig/network-scripts/ifcfg-eth0sed -i 's/HWaddr /HWaddr=/g' /etc/sysconfig/network-scripts/ifcfg-eth1mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth2mv /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth3
Do not forget to restart the NIC
service network restart