[Redhat]No eth0

After install redhat7 os ,wo can use the command ‘ifconfig’ to find out the network connection.However ,sometimes eth0 ethernet port  is not in the list.

Solution:

(1)Enter the directory:                                                                                                                         cd /etc/sysconfig/network-scripts/                                                                                              (2)Create or copy a file:                                                                                                                    vim /etc/sysconfig/network-scripts/ifcfg-eth0                                                                                   or        cp ifcfg-l0 ifcfg-eth0                                                                                                           (3)Copy the setting from ifcfg-l0,then modify the setting


DEVICE=eth0                                                                                              IPADDR=192.168.1.110                                                                                     NETMASK=255.255.255.0                                                                                       NETWORK=192.168.1.0                                                                                         GATEWAY=192.168.1.1                                                     BROADCAST=192.168.1.255  ONBOOT=[yes]                                                             BOOTPROTO=[none|static|bootp|dhcp] HWADDR=00:13:D3:27:9F:80                                                                                         NAME=eth0 


(4)Create  a file [70-persistent-net.rules ], modify the setting

Note:the most important is the MAC address setting

 vim /etc/udev/rules.d/70-persistent-net.rules  


# PCI device 0x10ec:0x8168 (r8169) (custom name provided by external tool) 

SUBSYSTEM==“net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:13:D3:27:9F:80″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″  


(5)Restart your OS in order to make it effective.