ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

网卡绑定

2020-05-17 14:08:09  阅读:279  来源: 互联网

标签:nmcli 绑定 team0 网卡 link eth1 root localhost


网卡

内核参数

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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有