CentOS 网络基础:(5)设置多网卡绑定单IP

简介:

操作示例:将eth01/eth02绑定到一个IP上

(1)在修改内核模块配置文件/etc/modprobe.conf,加入以下内容:

1
2
3
4
###### Bonding Start ######
alias  bond0 bonding
options bonding max_bonds = 1
###### Bonding End ########

(2)建立bonding网卡文件/etc/sysconfig/network-scripts/ifcfg-bond0,配置如下:

1
2
3
4
5
6
7
DEVICE=bond0
ONBOOT= yes
BOOTPROTO=static
IPADDR=192.168.100.21
NETMASK=255.255.255.0
USERCTL=no
BONDING_OPTS= "mode=1 miimon=100 primary=eth01"

*bonding_opts参数参考:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
parm:           max_bonds:Max number of bonded devices (int)
parm:           tx_queues:Max number of transmit queues (default = 16) (int)
parm:           num_grat_arp:Number of gratuitous ARP packets to send on failover event (int)
parm:           num_unsol_na:Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event (int)
parm:           miimon:Link check interval  in  milliseconds (int)
parm:           updelay:Delay before considering link up,  in  milliseconds (int)
parm:           downdelay:Delay before considering link down,  in  milliseconds (int)
parm:           use_carrier:Use netif_carrier_ok (vs MII ioctls)  in  miimon; 0  for  off, 1  for  on (default) (int)
parm:           mode:Mode of operation; 0  for  balance-rr, 1  for  active-backup, 2  for  balance-xor, 3  for  broadcast, 4  for  802.3ad, 5  for  balance-tlb, 6  for  balance-alb (charp)
parm:           primary:Primary network device to use (charp)
parm:           primary_reselect:Reselect primary slave once it comes up; 0  for  always (default), 1  for  only  if  speed of primary is better, 2  for  only on active slave failure (charp)
parm:           lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0  for  slow, 1  for  fast (charp)
parm:           ad_select:803.ad aggregation selection logic; 0  for  stable (default), 1  for  bandwidth, 2  for  count (charp)
parm:           xmit_hash_policy:balance-xor and 802.3ad hashing method; 0  for  layer 2 (default), 1  for  layer 3+4, 2  for  layer 2+3 (charp)
parm:           arp_interval:arp interval  in  milliseconds (int)
parm:           arp_ip_target:arp targets  in  n.n.n.n form (array of charp)
parm:           arp_validate:validate src /dst  of ARP probes; 0  for  none (default), 1  for  active, 2  for  backup, 3  for  all (charp)
parm:           fail_over_mac:For active-backup,  do  not  set  all slaves to the same MAC; 0  for  none (default), 1  for  active, 2  for  follow (charp)
parm:           all_slaves_active:Keep all frames received on an interfaceby setting active flag  for  all slaves; 0  for  never (default), 1  for  always. (int)
parm:           resend_igmp:Number of IGMP membership reports to send on link failure (int)

(3)修改eth01的网卡配置文件:

1
2
3
4
5
DEVICE=eth01
MASTER=bond0
SLAVE= yes
HWADDR=54:22:22:00:7A:37:CE
ONBOOT= yes

修改eth02的网卡配置文件:

1
2
3
4
5
DEVICE=eth02
MASTER=bond0
SLAVE= yes
HWADDR=54:22:22:00:7A:37:CE
ONBOOT= yes

(4)导入bonding驱动,重启网络服务后生效

1
2
>modprobe -i bonding max_bonds=1
>service network restart





本文转自 bannerpei 51CTO博客,原文链接:http://blog.51cto.com/281816327/1615281,如需转载请自行联系原作者

相关文章
|
22天前
|
Linux
Linux中centos桌面消失网络图标
Linux中centos桌面消失网络图标
13 0
|
1月前
|
网络协议 Shell Linux
【Shell 命令集合 网络通讯 】Linux 设置和配置PPP pppsetup命令 使用教程
【Shell 命令集合 网络通讯 】Linux 设置和配置PPP pppsetup命令 使用教程
39 0
|
1月前
|
移动开发 网络协议 安全
网络面试题:什么是 TCP/IP?
网络面试题:什么是 TCP/IP?
43 0
网络面试题:什么是 TCP/IP?
|
1月前
|
域名解析 网络协议 Linux
【Shell 命令集合 网络通讯 】Linux 设置和管理网络接口配置信息 netconfig命令 使用指南
【Shell 命令集合 网络通讯 】Linux 设置和管理网络接口配置信息 netconfig命令 使用指南
53 1
|
1天前
|
存储 Linux 网络安全
centos7使用yum网络安装
这些是使用Yum进行网络安装的基本步骤。根据你的需求,你可以重复步骤3和4来安装其他软件包。请注意,执行Yum操作需要root或具有sudo权限的用户。
12 1
|
5天前
|
安全 网络安全 网络虚拟化
如何保护IP在线隐私,提高网络安全?
如何保护IP在线隐私,提高网络安全?
|
5天前
|
缓存 安全 网络协议
代理ip会不会影响网络速度和稳定性
代理ip会不会影响网络速度和稳定性
|
7天前
|
Java
Centos7.9的ip更改--详细版
Centos7.9的ip更改--详细版
27 4
|
14天前
|
网络协议
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
15 0
|
14天前
|
Linux Shell 网络安全
centos7添加ip黑名单禁止某个ip访问
centos7添加ip黑名单禁止某个ip访问
15 1