高级网络配置——bond/team/桥接网络

简介:
一。学习配置 bond 网络接口

Red Hat Enterprise Linux 允许管理员使用bonding 内核模块和称为通道绑定接口的特殊网络接口将多个网络接口绑定到一个通道。根据选择的绑定模式 , 通道绑定使两个或更多个网络接口作为一个网络接口 , 从而增加带宽和 / 提供冗余性
1.利用 nmcli 命令管理 bond
     nm-connection-editor
           删除所有网络接口
     nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup ip4 172.25.254.199/24
     ifconfig 
     watch -n 1 cat /proc/net/bonding/bond0 
   
     nmcli connection add type bond-slave con-name eth0 ifname eth0 master bond0
     nmcli connection add type bond-slave con-name eth1 ifname eth1 master bond0
     ifconfig eth0 down
2.选择 Linux 以太网绑定模式
    模式 0 ( 平衡轮循 balance-rr) - 轮循策略 , 所有接口都使用采用轮循方式在所有 Slave 中传输封包 ; 任何Slave 都可以接收
    模式 1 ( 主动备份 active-backup ) - 容错。一次只能使用一个Slave 接口 , 但是如果该接口出现故障 , 另一个Slave 将 接替它
    模式 3 ( 广播 broadcast) - 容错。所有封包都通过所有Slave 接口广播
3.主动备份配置示例
   3-1 建立绑定接口 bond0 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-bond0

– BOOTPROTO="none"
– IPADDR="10.1.1.250"
– PREFIX=”24”
– ONBOOT="yes"
– BONDING_OPTS=”mode=1 miimon=50”
   3-2 建立 Slave 接口 eth0 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-eth0
– DEVICE="eth0"         ####硬件网卡名
– BOOTPROTO="none"
– ONBOOT="yes"
– MASTER="bond0"
– SLAVE="yes“
   3-3 建立 Slave 接口 eth1 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-eth1
– DEVICE="eth1"
– BOOTPROTO="none"
– ONBOOT="yes"
– MASTER="bond0"
– SLAVE="yes“
   3-4 配置系统加载 binding 模块 :
/etc/modprobe.d/bonding.conf
– alias bond0 bonding
ifenslave bond0 eth0 eth1

systemctl stop NetworkManager
systemctl restart network

查看 bonding 状态
– cat /proc/net/bonding/bond0

二。学习配置 team 网络接口
1.Team 接口
Team 和 bond0 功能类似
Team 不需要手动加载相应内核模块
Team 有更强的拓展性
– 支持 8 快网卡

2.Team 的种类

broadcast     广播容错
roundrobin    轮询
activebackup  主备
loadbalance   负载均衡

3.通过 nmcli 设定 team
nmcli connection add type team con-name team0 ifname team0 config '{"runner"{"name":"loadbalance"}}' ip4 172.25.254.198/24
nmcli connection add con-name eth0   ifname eth0 type team-slave master team0 
nmcli connection add con-name eth1   ifname eth1 type team-slave master team0 

4.监控team0,并测试
teamctl team0 stat      
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth1 down
ifconfig eth1 up

三。学习配置网络桥接
1.网络桥接
网络桥接用网络桥实现共享上网主机和客户机除了利用软件外,还可以用系统自带的网络桥建立连接用双网卡的机器做主机

2.网络桥接的配置
vim /etc/sysconfig/network-scripts/ifcfg-eth0
   DEVICE=eth0       ###设备名,可能不同
   ONBOOT=yes
   BOOTPROTO=none
   BRIDGE=br0      ###重点,必须说明
vim /etc/sysconfig/network-scripts/ifcfg-br0
   DEVICE=eth0      
   ONBOOT=yes
   BOOTPROTO=none
   TYPE=Bridge      ###重点,必须说明
   IPADDR=172.25.254.198

3.网络桥接的管理命令
brctl
### 桥接管理命令
– show ### 显示
– addbr ### 添加网桥
– delbr ### 删除网桥
– addif ### 添加网桥连接
– delif ### 删除网桥连接

  卸载桥接接口过程
  brctl show
  brctl delif br0 eth0
  brctl show
  brctl delbr br0
  ifconfig br0 down
  brctl show


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

相关文章
|
27天前
|
存储 网络协议 Shell
【Shell 命令集合 网络通讯 】Linux 网络配置 netconf命令 使用指南
【Shell 命令集合 网络通讯 】Linux 网络配置 netconf命令 使用指南
31 1
|
2月前
|
Ubuntu
如何在 Ubuntu 中创建网络绑定和桥接?
如何在 Ubuntu 中创建网络绑定和桥接?
85 0
如何在 Ubuntu 中创建网络绑定和桥接?
|
4月前
|
网络协议 Linux 网络架构
Linux三种网络模式 | 仅主机、桥接、NAT
Linux三种网络模式 | 仅主机、桥接、NAT
164 0
|
4月前
|
存储 监控 数据安全/隐私保护
Docker网络模式:深度理解与容器网络配置
Docker 的网络模式是容器化应用中一个关键而复杂的方面。本文将深入讨论 Docker 的网络模式,包括基本概念、常用网络模式以及高级网络配置,并通过更为丰富和实际的示例代码,帮助读者全面掌握如何理解和配置容器网络。
|
7天前
|
存储 安全 测试技术
网络奇谭:虚拟机中的共享、桥接与Host-Only模式解析
网络奇谭:虚拟机中的共享、桥接与Host-Only模式解析
14 0
|
6月前
|
安全 Linux 网络安全
(五)Linux命令行工具和网络管理:网络配置、诊断和安全
Linux系统管理员在日常工作中需要处理各种网络任务,包括网络配置、故障诊断和网络安全。本文将介绍如何使用Linux命令行工具进行网络配置、诊断网络问题和加强网络安全。
84 2
|
8月前
|
网络协议 虚拟化 网络架构
VM虚拟机三种网络配置详解(桥接、NAT、仅主机)
VM虚拟机三种网络配置详解(桥接、NAT、仅主机)
360 0
|
9月前
|
Ubuntu 网络协议 Linux
Docker高级网络实践
Docker中libnetwork提供的4种驱动,它们各有千秋,但实际上每一种方式都有一定的局限性。
162 0
|
9月前
|
Ubuntu 网络协议 安全
嵌入式Linux开发环境搭建之七---正确设置网络使开发板ping同Ubuntu(使用桥接方式,不推荐)
嵌入式Linux开发环境搭建之七---正确设置网络使开发板ping同Ubuntu(使用桥接方式,不推荐)
439 0
|
10月前
|
Linux
【经验分享】桥接网络无法联网、开发板挂载根文件系统问题解决
【经验分享】桥接网络无法联网、开发板挂载根文件系统问题解决
124 0

热门文章

最新文章