yum provides brctl #查询工具所需安装的软件包
[root@localhost ~]
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
base/7/x86_64/filelists_db | 7.2 MB 00:00:00
extras/7/x86_64/filelists_db | 277 kB 00:00:00
updates/7/x86_64/filelists_db | 8.2 MB 00:00:00
bridge-utils-1.5-9.el7.x86_64 : Utilities for configuring the linux ethernet bridge
Repo : base
Matched from:
Filename : /usr/sbin/brctl
bridge-utils-1.5-9.el7.x86_64 : Utilities for configuring the linux ethernet bridge
Repo : @anaconda
Matched from:
Filename : /sbin/brctl
bridge-utils-1.5-9.el7.x86_64 : Utilities for configuring the linux ethernet bridge
Repo : @anaconda
Matched from:
Filename : /usr/sbin/brctl
[root@localhost ~]
Usage: brctl [commands]
commands:
addbr <bridge> add bridge
delbr <bridge> delete bridge
addif <bridge> <device> add interface to bridge
delif <bridge> <device> delete interface from bridge
hairpin <bridge> <port> {on|off} turn hairpin on/off
setageing <bridge> <time> set ageing time
setbridgeprio <bridge> <prio> set bridge priority
setfd <bridge> <time> set bridge forward delay
sethello <bridge> <time> set hello time
setmaxage <bridge> <time> set max message age
setpathcost <bridge> <port> <cost> set path cost
setportprio <bridge> <port> <prio> set port priority
show [ <bridge> ] show a list of bridges
showmacs <bridge> show a list of mac addrs
showstp <bridge> show bridge stp info
stp <bridge> {on|off} turn stp on/off
[root@localhost ~]
yum install bridge-utils -y #安装网桥工具
brctl show #展示网桥 brctl addbr br100 #添加网桥
网桥及网卡配置文件:
[root@localhost ~]
TYPE=Ethernet
BOOTPROTO=none
NAME=em1
DEVICE=em1
ONBOOT=yes
BRIDGE="br100"
[root@localhost ~]
TYPE=Bridge
BOOTPROTO=static
NAME=br100
DEVICE=br100
GATEWAY=192.168.3.1
DNS1=119.29.29.29
ONBOOT=yes
IPADDR=192.168.3.225
PREFIX=24
[root@localhost ~]
brctl addif br100 em1 #添加网卡到网桥
systemctl stop NetworkManager
systemctl disable NetworkManager #禁用此服务
systemctl restart network #重启网络
配置完成效果:
[root@localhost ~]
br100: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.225 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::928d:6eff:fec0:946c prefixlen 64 scopeid 0x20<link>
ether 90:8d:6e:c0:94:6c txqueuelen 1000 (Ethernet)
RX packets 42297 bytes 3766761 (3.5 MiB)
RX errors 0 dropped 1913 overruns 0 frame 0
TX packets 242 bytes 32037 (31.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::928d:6eff:fec0:946c prefixlen 64 scopeid 0x20<link>
ether 90:8d:6e:c0:94:6c txqueuelen 1000 (Ethernet)
RX packets 42494 bytes 4573816 (4.3 MiB)
RX errors 0 dropped 95 overruns 0 frame 0
TX packets 249 bytes 34555 (33.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 30
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2 bytes 200 (200.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 200 (200.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|