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

linux系统配置网桥

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

linux系统配置网桥

安装 brctl工具

sudo apt-get install bridge-utils

添加桥

brctl addbr br0 #创建桥接 br0
brctl addif br0 eth0 eth1 #添加 eth0, eth1 到 br0
ifconfig br0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up

打开ip转发

sudo vim /etc/sysctl.conf
net.ipv4.ip_forward=1

去掉该行前面的注释符#

sudo sysctl -p /etc/sysctl.conf

文件立即生效

修改配置

vim /etc/network/interfaces
auto lo br0
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
iface br0 inet dhcp
bridge_ports eth0 eth1

或者使用静态IP

iface br0 inet static
bridge_ports eth0 eth1
address 192.168.1.2
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1

重启机器

查看网桥信息

brctl show

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/944748.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

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

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