Linux version 7, only lo network card without en0 or eth0 network card after virtual machine installation

Experimental environment: RHEL 7
After the virtual machine installs RHEL7, ip add finds that only one network card lo enters/ect/sysconfig/network-scripts/directory finds that only ifcfg-lo does not have eth0, and then it is not feasible to configure an eth0 discovery by myself. I consult the data to solve this problem, as follows:
Close RHEL7, go to the installation directory to find the *.vmx file, open it with an editor, add ethernet0.virtualDev="e1000" in the last line, start the virtual machine, execute ip addr again to find one more network card information, copy the address of the MAC that appears in it

[root@system1 ~]#ip addr
1: lo: <LOOPBACK,UP,LOWER UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 000:0000:000:00
    inet 127.0.0.1/8 scope host to
        valid_lft forever preferred_lft forever
    inet6::1/128 scope host
        valid_lft forever preferred_lft forever
2:  eno16777736:  <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state up qlen 1000
      link/ether 00:Oc:29:97:9h:39 brd ff:ff:ff:ff:ff:ff

Enter / ect/sysconfig/network-scripts / directory and find only ifcfg-lo, write one yourself without eno16777736 configuration file

[root@system1 ~]#vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
ONBOOT=yes
USERCTL=no
PEERDNS=yes
TYPE= Ethernet
DEVICE=eno16777736#//(Here is the serial number of the network card device, also the name of the network card seen in ip addr)
HWADDR=00:0c:29:64:c2:5f#You can not add it here, depending on your machine
BOOTPROTO=dhcp

But when you restart the network card

[root@system1 ~]#systemctl restart network
Restarting network (via systemctl): Job for network.service failed. See'systemctl status network.service'
and 'journalctl -xn' for details.

As prompted above, execute "systemctl status network.service" to output similar information as follows:

[root@system1 ~]# systemctl status network.service
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)    
Active: failed (Result: exit-code) since 2 2018-04-17 17:39:19 CST; 5min ago
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain network[2784]: RTNETLINK answers: File exists 
4 January 1717:39:19 localhost.localdomain systemd[1]: network.service: control process exited, code=exited  status=1 
4 January 1717:39:19 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking. 
4 January 1717:39:19 localhost.localdomain systemd[1]: Unit network.service entered failed state.

The solution (since there is no 70-persistent-net.rules file in centos7, the copied virtual machine needs to modify the mac address) is to modify the mac address.
Write the previously copied MAC address into the configuration file and execute the systemctl restart network work successfully

Tags: network Mac RHEL vim

Posted on Tue, 17 Mar 2020 09:43:49 -0700 by devinemke