OVF Virtual machine Template Import, the operating system original network settings are invalid, the script set up a new network!

Source: Internet
Author: User

The virtual machine network settings that are imported from the virtual machine OVF template change and the NIC changes, so the network is not available after the virtual machine starts.

So to do the following few things, the network will be available:

1 First look at the/etc/udev/rules.d/70-persistent-net.rules file, the ETH NIC that appears at the end of the file is the new network card established by the system, and the MAC address. Comment out the original NIC line.

2 views/etc/sysconfig/network-scripts/ifcfg-eth0 (1) This file, this file is the network setting for the original virtual machine

3 Rename the original Ifcfg-eh file and change it to a new NIC file

4 for the new Nic file, make the following changes:

A change to ETH, Mac, IP, netmask, gateway

b Restart the network

#modify  the real network address!echo  "please input your address:" read  IPsed -i  "11s/ipaddr=.*/ipaddr= $IP/g"    /etc/sysconfig/network-scripts/ ifcfg-eth0echo  "Please input your network mask:" read masksed -i  "12s/ netmask=.*/netmask= $mask/g "   /etc/sysconfig/network-scripts/ifcfg-eth0echo " please  Input your default gateway: "read gatewaysed -i " 13s/GATEWAY=.*/GATEWAY= $gateway/ G "   /etc/sysconfig/network-scripts/ifcfg-eth0#get the device-file"/etc/udev/rules.d/ 70-persistent-net.rules " network card mac addressmac= ' cat /etc/udev/rules.d/70- persistent-net.rules|grep eth1|cut -d  ', '  -f 4|cut -d  ' '  -f 2| sed -n  ' 2p ' #replace  the mac address of the network card  file sed -i  "2s/hwaddr=.*/hwaddr= $mac/g "  /etc/sysconfig/network-scripts/ifcfg-eth0#modify the network  card file mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/ network-scripts/ifcfg-eth1sed -i  ' 1s/eth0/eth1/'  /etc/sysconfig/network-scripts/ifcfg-eth1# masking the nouse network cardsed -i  '/eth0/s/^/#/g '   /etc/udev/ Rules.d/70-persistent-net.rules service network restart


This article from the "old section of the Cultivation of Life" blog, reproduced please contact the author!

OVF Virtual machine Template Import, the operating system original network settings are invalid, the script set up a new network!

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.