Linux Bridge configuration

Source: Internet
Author: User

Centos:
1. Configure temporary bridge, the style configuration is lost after reboot
[Email protected] ~]# yum-y install Bridge-utils
[Email protected] ~]# brctl ADDBR br0 #创建网桥逻辑接口
[Email protected] ~]# brctl addif br0 eth0 #将eth0网卡添加到网桥中
[Email protected] ~]# brctl addif br0 eth1 #将eth1网卡添加到网桥中
[Email protected] ~]# ifconfig eth0 0.0.0.0 #将eth0网卡设为为混杂模式
[Email protected] ~]# ifconfig eth1 0.0.0.0 #将eth1网卡设为为混杂模式
[Email protected] ~]# ifconfig br0 #查看桥网卡配置
[Email protected] ~]# ifconfig br0 10.10.10.82/24 #给桥网卡设置IP地址

2, creating a permanent bridge
[[email protected] ~]# vi/etc/ sysconfig/network-scripts/ifcfg-br0    #创建网桥配置文件
device=br0
Type=bridge
bootproto=static
ipaddr=172.16.100.1
netmask=255.255.255.0
Onboot=yes
[[email protected] ~]# vi/etc/sysconfig/ Network-scripts/ifcfg-eth0 #将网卡加入到网桥中
Device=eth0
type=ethernet
Onboot=yes
bootproto=static
ipaddr=0.0.0.0
Bridge=br0
[[email protected] ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth1    #将网卡加入到网桥中
device=eth1
type=ethernet
Onboot=yes
bootproto=static
ipaddr=0.0.0.0
BRIDGE =br0

debian:
1, configure temporary bridge
[email protected]:~# apt-get install bridge-utils    #安装依赖包
[email protected]:~# brctl ADDBR br0      #创建网桥
[email protected]:~# ifconfig br0 up      #启用网桥
[email  protected]:~# IP addr show      #查看网桥
[email protected]:~# brctl addif br0 eth0 eth1  &n Bsp   #将网卡加入到网桥
[email protected]:~# brctl delif br0 eth1    #从网桥中删除eth1网卡
[email  protected]:~# ifconfig br0 down    #关闭网桥
[email protected]:~# brctl delbr br0      &NBSP ; #删除网桥

2. Create a permanent bridge
[Email protected]:~# nano/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see Interfaces (5).
source/etc/network/interfaces.d/*
# The Loopback network interface
# Auto Lo br0 two lines written in one line
Auto Lo
Auto Br0
Iface Lo inet Loopback
Iface br0 inet Static
Iface eth0 inet Manual
Iface eth1 inet Manual
Address 10.1.1.122
Broadcast 10.1.1.255
Netmask 255.255.255.0
Gateway 10.1.1.1
Bridge_ports eth0 eth1 #把eth0, Eth1 joins the bridge
BRIDGE_STP off # disable Spanning Tree Protocol
Bridge_waitport 0 # No delay before a port becomes available
BRIDGE_FD 0 # Forwarding Delay

Linux Bridge configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.