CentOS 7 多网卡绑定

根据官方文档Red_Hat_Enterprise_Linux-7-Networking_Guide-en-US用nmcli做起来还是相当容易的。下面把俺的步骤贴下。


1、查看目前网卡的名称和状态。
#nmcli device status
DEVICE TYPE STATE CONNECTION
eno16777736 ethernet connected eth1
eno33554992 ethernet disconnected --
eno50332216 ethernet disconnected --
lo loopback unmanaged --


2、配置网卡bond0和模式主备
nmcli connection add type bond con-name bond0 ifname bond0 mode balance-xor

nmcli connection modify bond0 bond.options mode=2 修改办法

第一种模式:mod=0 ,即:(balance-rr)Round-robin policy(平衡抡循环策略)cisco交换机?

第二种模式:mod=1,即: (active-backup)Active-backup policy(主-备份策略)

第三种模式:mod=2,即:(balance-xor)XOR policy(平衡策略)华为交换机配置Eth-Trunk dis interface Eth-Trunk 2 According to SA-XOR-DA,

第四种模式:mod=3,即:broadcast(广播策略)

第五种模式:mod=4,即:(802.3ad)IEEE 802.3ad Dynamic link aggregation(IEEE802.3ad 动态链接聚合)

第六种模式:mod=5,即:(balance-tlb)Adaptive transmit load balancing(适配器传输负载均衡)

第七种模式:mod=6,即:(balance-alb)Adaptive load balancing(适配器适应性负载均衡)

http://www.linuxidc.com/Linux/2014-10/107515.htm

3、将物理网卡绑定到bond0
# nmcli connection add type bond-slave ifname eno1 master bond0

Connection 'bond-slave-eno50332216' (3f07e767-24ea-4e7e-a9f7-61efa9aa0664) successfully added.


# nmcli connection add type bond-slave ifname eno2 master bond0

Connection 'bond-slave-eno33554992' (8149c24f-4926-4531-844f-36a526e1baec) successfully added.


4、启用绑定的物理网卡
# nmcli connection up bond-slave-eno1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

# nmcli connection up bond-slave-eno2

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)

5、启用bond网卡
#nmcli connection up bond0

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
现在网卡已经绑好启用

#sudo yum install net-tools

#sudo ifconfig -a

#sudo yum install iptables-services.*

6、地址之类的可以后加

nmcli con mod bond0 ipv4.addresses "10.0.59.4/24" ipv4.gateway "10.0.59.254" ipv4.dns "114.114.114.114"
nmcli con mod bond0 ipv4.method manual


也可以通过nmcli添加,大家查下手册即可
Usage: nmcli connection { COMMAND | help }

COMMAND := { show | up | down | add | modify | edit | delete | reload | load }

show [--active] [[id | uuid | path | apath] <ID>] ...

up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>]

down [id | uuid | path | apath] <ID>

add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS IP_OPTIONS

modify [--temporary] [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+

edit [id | uuid | path] <ID>
edit [type <new_con_type>] [con-name <new_con_name>]

delete [id | uuid | path] <ID>

reload

load <filename> [ <filename>... ]

#nmcli connection show bond0

相关文章

有时候CentOS工作在无互联网的环境下,需要在离线环境下安装一些组件,这次实现的是模拟在离线环境下安...
首先参照https://www.cnblogs.com/wdw984/p/13330074.html,来进行如何安装Centos和离线下载rpm包。 离...
有两个.NET CORE3.1网站部署在CentOS7上(内网IP是192.168.2.32),现在想实现访问http://192.168.2.32...
1、yum -y install vsftpd 安装vsftpd 2、配置vsftpd的配置文件(/etc/vsftpd/vsftpd.conf)主要修改以...
首先去mysql官网下载mysql的离线rpm安装包(https://downloads.mysql.com/archives/community/) Mysql...
第一步下载erlang环境并安装: wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_...