The shell script solves the problem of Nic conflicts after cloning vmware.

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.