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!