Linux configuration Bridge mode for two-layer switching.

Source: Internet
Author: User

Ifconfig eth0 0.0.0.0 #网卡IP没用了, kill.

Ifconfig eth1 0.0.0.0

Ifconfig eth2 0.0.0.0

Brctl ADDBR br0 #新建个桥

Brctl addif br0 eth0 #网卡添加到桥里面

Brctl addif br0 eth1

Brctl addif br0 eth2

Ifconfig br0 192.168.15.1/24 up #把桥启动, and initial IP and mask

Network Bridge configuration file: (online CP, has not been tested.) )

1. Set up the bridge Touch/etc/sysconfig/network-scripts/ifcfg-br0 set up the bridge configuration file Ifcfg-br0
Vi/etc/sysconfig/network-scripts/ifcfg-br0

Device=br0
Type=bridge
Bootproto=static
ipaddr=192.168.1.99

netmask=255.255.255.0

gateway=192.168.1.1
Onboot=yes


2. Add the NIC to the Network Bridge
Add the eth0 and eth1 two network adapters to the bridge.

Modify the eth1 NIC configuration file
Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0
Type=ethernet
Bootproto=static
ipaddr=0.0.0.0
Onboot=yes
Bridge=br0

Modify the eth2 NIC configuration file
Vi/etc/sysconfig/network-scripts/ifcfg-eth2

Device=eth1
Type=ethernet
Bootproto=static
ipaddr=0.0.0.0
Onboot=yes
Bridge=br0

3. Set the bridge port

Brctl ADDBR br0 (add a bridge, if you create edit ifcfg-br0 manually, this command and some other commands to configure the bridge can not)

Brctl addif br0 eth0 (let eth0 become a port of br0, even if manually create edit ifcfg-br0, you also need to execute this command, otherwise you cannot network)
4. Restart the Network Service

Service NetworkManager Stop

Chkconfig NetworkManager off

Service Network Stop

Service Network start

Linux configuration Bridge mode for two-layer switching.

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.