Linux 6.5網卡配置

Linux 6.5 網卡配置

路徑:/etc/sysconfig/network-scripts

1.關閉NetworkManager服務

[root@rhcsasm2 network-scripts]# service NetworkManager stop

[root@rhcsasm2 network-scripts]# service NetworkManager status
NetworkManager is stopped
[root@rhcsasm2 network-scripts]# chkconfig NetworkManager --list
NetworkManager     0:off    1:off    2:off    3:off    4:off    5:off    6:off

防火墻iptables,ip6tables服務也要記得關閉

2.網卡綁定:bond0 eth1 eth2(加入把eth1 eth2 兩張網卡做綁定成bond0)

[root@rhcsasm2 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=10.178.1.247
NETMASK=255.255.255.0
GATEWAY=10.178.1.25
USERCTL=no
PEERDNS=yes
[root@rhcsasm2 network-scripts]# cat ifcfg-eth0
DEVICE=eth0
HWADDR=00:26:55:E3:7F:DA
TYPE=Ethernet
UUID=58d8366b-5e69-443a-b942-d42eb1ab435f
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
PEERDNS=yes
[root@rhcsasm2 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
HWADDR=00:26:55:E3:7C:46
TYPE=Ethernet
UUID=a02ae54a-a23f-454f-9659-9c89e16ba485
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
PEERDNS=yes
3.修改配置文件/etc/modprobe.d/dist.conf添加
options bond0 mode=1 miimon=100

做了幾個bonding就要添加幾句

4.修改/etc/rc.local添加

ifenslave bond0 eth1 eth2(可以不用做,重啟后就可以生效)

5.查看網卡運行狀態

[root@rhcsasm2 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:26:55:e3:7f:da
Slave queue ID: 0

Slave Interface: eth2
MII Status: down
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:26:55:e3:7c:46
Slave queue ID: 0

上一篇:Loj #2192. 「SHOI2014」概率充电器


下一篇:LoadTest中内存和线程Troubleshooting实战