网卡绑定
作者:互联网
网卡
内核参数
1、somaxconn
[root@localhost ~]# cat /proc/sys/net/core/somaxconn
128
[root@localhost ~]#
网卡监听队列的长度
2、rmem_max
[root@localhost ~]# cat /proc/sys/net/core/rmem_max
212992
最大的TCP接收缓冲区
3、wmem_max
[root@localhost ~]# cat /proc/sys/net/core/wmem_max
212992
最大的TCP发送数据缓冲区
Centos 7 配置双网卡绑定 team
模式:
activebackup
loadbalance
roundrobin
1、创建虚拟网卡team0
[root@node01 ~]# nmcli connection add type team ifname team0 con-name team0 config '{"runner":{"name":"activebackup"}}'
成功添加的连接 'team0'(1bc3c044-3b64-40f4-ae7b-1703c6d4df33)。
[root@node01 ~]# nmcli connection show
名称 UUID 类型 设备
有线连接 2 eda38a28-f98f-4437-b73a-ce235c02f3b2 802-3-ethernet eth1
有线连接 1 9591ae5c-356e-43b1-a003-80f6c4e1acdb 802-3-ethernet eth2
eth0 bf2dca4b-5385-4ac9-88aa-ee8cf413aab5 802-3-ethernet eth0
team0 1bc3c044-3b64-40f4-ae7b-1703c6d4df33 team team0
2、绑定物理网卡
[root@node01 ~]# nmcli connection add type team-slave ifname eth1 con-name team0-eth1 master team0
成功添加的连接 'team0-eth1'(633d2ccc-0a47-4b59-aaf4-2c0f4582815e)。
[root@node01 ~]# nmcli connection add type team-slave ifname eth2 con-name team0-eth2 master team0
成功添加的连接 'team0-eth2'(5fe7332d-04fd-4678-a8af-32cfcea663d3)。
[root@node01 ~]#
[root@node01 ~]# nmcli connection show
名称 UUID 类型 设备
有线连接 2 eda38a28-f98f-4437-b73a-ce235c02f3b2 802-3-ethernet eth1
有线连接 1 9591ae5c-356e-43b1-a003-80f6c4e1acdb 802-3-ethernet eth2
eth0 bf2dca4b-5385-4ac9-88aa-ee8cf413aab5 802-3-ethernet eth0
team0-eth2 5fe7332d-04fd-4678-a8af-32cfcea663d3 802-3-ethernet --
team0-eth1 633d2ccc-0a47-4b59-aaf4-2c0f4582815e 802-3-ethernet --
team0 1bc3c044-3b64-40f4-ae7b-1703c6d4df33 team team0
3、配置ip
[root@node01 ~]# nmcli connection modify team0 ipv4.addresses "192.168.122.111/24"
[root@node01 ~]# nmcli connection modify team0 ipv4.gateway "192.168.122.1"
[root@node01 ~]# nmcli connection modify team0 ipv4.dns 114.114.114.114
[root@node01 ~]# nmcli connection modify team0 ipv4.method manual
[root@node01 ~]# nmcli connection reload
[root@node01 ~]# nmcli connection up team0
4、查看team1状态
[root@localhost ~]# teamdctl team1 state
setup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: eth2
[root@localhost ~]#
5、断开激活的设备
[root@localhost ~]# nmcli device disconnect eth2
[root@localhost ~]# teamdctl team1 state
setup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: eth1
[root@localhost ~]#
6、再次启动eth2网卡
[root@localhost ~]# nmcli device connect eth2
[root@localhost ~]# teamdctl team1 state
setup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: eth1
[root@localhost ~]#
======================================================================================================
CentOS 6 双网卡绑定 bond
前提:关闭NetworkManager
1、确认关闭NetworkManager服务
2、内核加载bond
[root@localhost ~]# cat /etc/modprobe.d/bonding.conf
alias netdev-bond0 bonding
[root@localhost ~]#
3、分别创建bond0网卡、物理网卡配置文件
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.1.1.11
PREFIX=24
BONDING_OPTS="miimon=80 mode=6"
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="none"
ONBOOT="yes"
TYPE="Ethernet"
MASTER=bond0
SLAVE=yes
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
4、重启network服务,查看网卡状态
[root@localhost ~]# /etc/init.d/network restart
[root@localhost ~]#
[root@localhost ~]# ifconfig bond0
bond0 Link encap:Ethernet HWaddr 52:54:00:EA:E7:D1
inet addr:10.1.1.11 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:feea:e7d1/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:1703 errors:0 dropped:0 overruns:0 frame:0
TX packets:1500 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:133485 (130.3 KiB) TX bytes:130075 (127.0 KiB)
标签:nmcli,绑定,team0,网卡,link,eth1,root,localhost 来源: https://www.cnblogs.com/huoxc/p/12845018.html