I'm quite new to Linux networking.

I have a Debian PC with two Ethernet interfaces, one embedded on the motherboard and another on a PCI card. The first one, let say eth0 is connected to my router (which is connected to Inet). I want to "link" eth1 to eth0, in order to access my router (and Inet) when I plug a cable in eth1. The same way the eth0 cable is connected to one of my router's Ethernet ports.

The Debian PC should also be able to access Inet and LAN, and thus not simply behave as a "virtual link" between the cable plugged in eth0 (coming from my router) and the cable plugged in eth1 (going to another PC).

Is this achievable? How?

2 Answers 2


You can use a bridge interface. You can use brctl from bridge-utils to create a bridge interface. For example,

$ brctl addbr br0
$ brctl addif br0 eth0 eth1
$ brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.00004c9f0bd2       no              eth0

So after adding interfaces eth0 & eth1 into the bridge device br0 you're left with the following setup. You can use ifconfig to see it:

$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr BC:AE:AA:34:22:11  

$ ifconfig eth1
eth1      Link encap:Ethernet  HWaddr BC:AE:AA:34:11:22  

And the bridge device with the IP address:

$ ifconfig br0
br0       Link encap:Ethernet  HWaddr BC:AE:C5:11:22:33  
          inet addr:  Bcast:  Mask:
  • Actually, I'm using SSH, and when I added the if, my console has frozen, suggesting me that I lost the connection. I've noticed that eth1 wasn't in /etc/network/interfaces. Should I configured it manually before ? Thanks anyway for the help Commented Aug 2, 2013 at 17:31
  • @MaximePiraux: The Debian PC has to connect to the network through the bridge interface.
    – user26112
    Commented Aug 2, 2013 at 17:41
  • @MaximePiraux - when you bridge multiple network devices together they will no longer have their own IP addresses. The bridge device (br0) will.
    – slm
    Commented Aug 2, 2013 at 18:40
  • @slm: Thank you for the additions to my answer.
    – user26112
    Commented Aug 2, 2013 at 18:46
  • 1
    I hope you don't mind, it was easier to add to yours vs. starting a competing answer which usually is more confusing. If I ever do it and you disagree always feel free to roll it back.
    – slm
    Commented Aug 2, 2013 at 18:48

A few years later.. Adding another answer.

First of all, I'm not sure if the ifconfig package is maintained this days. it is better to use the ip command from the iproute2 package.

A few guides on iproute2:




Secondly, in your case I would probably use the simple Linux bridge also, But, it is also important to mention that since 2014 Open vSwitch (OVS) is a strong contender to the Linux Bridge.

Some references:





Edit: I'll show how to connect two Linux namespaces using a bridge.

Solution #1 - Using Linux bridge (Notice - all ip commands have a comment with 3#s on top):

# Variables




## Create bridge
brctl addbr $BRIDGE

### Bring it up
ip link set dev $BRIDGE up

### Create a Veth pair named Tap1 <--> TAP1-bridge-side
ip link add $TAP1 type veth peer name $TAP1-BR

## Attach one side of Tap1 to bridge
brctl addif $BRIDGE $TAP1-BR

### And the other side to namespace1
ip link set $TAP1 netns $NAMESPACE1

###  Set the interface on the bridge side up
ip link set dev $TAP1-BR up

### Set the interface inside the namespace up - notice that we execute  'ip netns exec' in order to run the inside the namespace scope
ip netns exec $NAMESPACE1 ip link set dev $TAP1 up

# Now create another Veth and connect it to the bridge - just change $TAP1 ->$TAP2, $TAP1-BR -> $TAP2-BR and repeat the same steps.. 

## Now you can reach namespace1 from namespace2 and vice versa.

Solution #2.A - Configuring a bridge using open VSwitch:

# Install the package
sudo apt-get install openvswitch-switch

# Now run the exact same commands like before just replace the CLI tool:
## brctl -> ovs-vsctl

# And replace commands:
## addbr -> add-br
## addif -> add-port

Solution #2.B - Configuring a bridge using open VSwitch - replace Veth pairs with internal ports:

# Similar to # 2.A
ovs-vsctl add-br $BRIDGE

# Similar to 2.A - Just with the addition of -- set Interface...
ovs-vsctl add-port $BRIDGE $TAP1 -- set Interface $TAP1 type=internal

### Similar #2.A (and #1)
ip link set $TAP1 netns $NAMESPACE1

### Similar #2.A (and #1)
ip netns exec $NAMESPACE1 ip link set dev $TAP1 up

# Now repeat for $TAP2...
  • This answer would be better if instead of referencing external links (which may become invalid), you'd give a quick rundown how do use ip to make a bridge, and add both interfaces to it.
    – dirkt
    Commented Jul 14, 2019 at 17:32
  • Of course, thanks for pointing out. Commented Jul 14, 2019 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .