CentOS 7 多网卡绑定

前端之家收集整理的这篇文章主要介绍了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相关文章