添加完网卡在Linux中用ifconfig看到里面没有eth1网卡
dmesg | grep eth
e1000 0000:02:00.0: eth0: (PCI:66MHz:32-bit) 00:0c:29:11:30:dd
e1000 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
e1000 0000:02:02.0: eth1: (PCI:66MHz:32-bit) 00:0c:29:11:30:e7
e1000 0000:02:02.0: eth1: Intel(R) PRO/1000 Network Connection
由此命令可以看到网卡驱动已经认到了。
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth1
vim ifcfg-eth1
DEVICE=eth1
HWADDR=00:0c:29:11:30:e7
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=172.16.0.1
NETMASK=255.255.255.0
GATEWAY=172.16.0.1
上面加黑的这两个是必须要改的,那个MAC地址是dmesg上面显示出来的地址复制上去
service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
Bringing up interface eth1: [ OK ]
这时候eth1就有了
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:11:30:DD
inet addr:192.168.0.102 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe11:30dd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1775 errors:0 dropped:0 overruns:0 frame:0
TX packets:1314 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:164818 (160.9 KiB) TX bytes:241618 (235.9 KiB)
eth1 Link encap:Ethernet HWaddr 00:0C:29:11:30:E7
inet addr:172.16.0.1 Bcast:172.16.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe11:30e7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:76 errors:0 dropped:0 overruns:0 frame:0
TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10142 (9.9 KiB) TX bytes:6802 (6.6 KiB)