栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

centos7物理机网桥配置

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

centos7物理机网桥配置

yum provides brctl #查询工具所需安装的软件包

[root@localhost ~]# yum provides brctl
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 ~]# brctl -h
Usage: brctl [commands]
commands:
    addbr             add bridge
    delbr             delete bridge
    addif           add interface to bridge
    delif           delete interface from bridge
    hairpin       {on|off}    turn hairpin on/off
    setageing    

yum install bridge-utils -y #安装网桥工具

brctl show #展示网桥
brctl addbr br100 #添加网桥

网桥及网卡配置文件:

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet
BOOTPROTO=none
NAME=em1
DEVICE=em1
ONBOOT=yes
BRIDGE="br100"
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-br100
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 ~]# ifconfig
br100: flags=4163  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
        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  mtu 1500
        inet6 fe80::928d:6eff:fec0:946c  prefixlen 64  scopeid 0x20
        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  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        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
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/851728.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号