在这里插入图片描述
增加第三个网卡,进入linux,

[root@jia ~]# cd /etc/sysconfig/network-scripts/
[root@jia network-scripts]# ls
ifcfg-eth0  ifdown       ifdown-ippp  ifdown-post    ifdown-sit     ifup-aliases  ifup-ippp  ifup-plip   ifup-ppp     ifup-tunnel       net.hotplug
ifcfg-eth1  ifdown-bnep  ifdown-ipv6  ifdown-ppp     ifdown-tunnel  ifup-bnep     ifup-ipv6  ifup-plusb  ifup-routes  ifup-wireless     network-functions
ifcfg-lo    ifdown-eth   ifdown-isdn  ifdown-routes  ifup           ifup-eth      ifup-isdn  ifup-post   ifup-sit     init.ipv6-global  network-functions-ipv6
[root@jia network-scripts]# cp ifcfg-eth0 ifcfg-eth2
[root@jia network-scripts]# vi ifcfg-eth2
[root@jia network-scripts]# 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:  
Determining IP information for eth1... done.
                                                           [  OK  ]
Bringing up interface eth2:  
Determining IP information for eth2... done.
                                                           [  OK  ]
[root@jia network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:31:84:F8  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe31:84f8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:51 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6132 (5.9 KiB)  TX bytes:7750 (7.5 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:C2:E9:84  
          inet addr:192.168.56.102  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fec2:e984/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:883 errors:0 dropped:0 overruns:0 frame:0
          TX packets:593 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81646 (79.7 KiB)  TX bytes:98672 (96.3 KiB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:1A:50:5D  
          inet addr:192.168.87.156  Bcast:192.168.87.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1a:505d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3773 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:227627 (222.2 KiB)  TX bytes:1452 (1.4 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:9798 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9798 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1758199 (1.6 MiB)  TX bytes:1758199 (1.6 MiB)

[root@jia network-scripts]# 

修改eth2的参数参考

[root@jia rules.d]# cat 70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:31:84:f8", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:c2:e9:84", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:1a:50:5d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
[root@jia rules.d]# 

文章下方是我的微信,欢迎加我。👇

Logo

更多推荐