Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I set bridge between a real eth card on a remote machine without losing my ssh connection to that machine.

I ssh into a machine via its eth1 iinterface.

I want to join eth1 to a tun/tap device 'tun0'. How can I do this without bringing down eth1 and losing my ssh connection.

tunctl -u root
brctl addbr br0
brctl addif br0 tun1
brctl addif br0 eth1

Result, connection will be lost

share|improve this question
up vote 1 down vote accepted
  1. Connect to the machine via a different interface.
  2. Connect to the machine at the console.
  3. Set up the bridge in the system's startup scripts (you didn't specify what sort of system) and then reboot.
share|improve this answer

I was getting the same problem, but running first the ip link set dev br0 up command was enough to keep the connection.

share|improve this answer

If you are remote and can not use a different interface than those involved in the bridge, you could create NAT or port forwarding with net-filter (iptables) or install a proxy between those networks.

share|improve this answer

This works:

tunctl -t tap0 ; brctl addbr br0 ; brctl addif br0 tap0 ; \
ip addr del dev eth0 ; \
ip addr add dev br0 ; \
brctl addif br0 eth0 ; ip link set dev br0 up

This is executed so fast that the connection didn't break (not even a LAN connection). Even safer would be to do this within screen (which I did first but which turned out not to be necessary). The safest solution would be (within screen, of course) to drop everything in the firewall during these commands. So insert after the first line (before ip addr del) iptables -I INPUT 1 -j DROP and add at the end (after ip link set) iptables -D INPUT 1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.