1

I am having trouble to enable a host-to-guest communication using qemu VMs. The goal is to connect via SSH from the host to the guest VM.

I have the following setting:

  • host: local access to SSH server inside guest VMs required
  • guest: qemu based VMs started using tap interface (parameters, 4 tap devices in total):

-netdev tap,ifname=tap0,id=mw,script=no,downscript=no -device virtio-net,netdev=mw,mac=52:54:01:34:AD:EF

VMs are interlinked via a bridge br0, but not the physical interface eth0.

Question/hypothesis: I think to make it work, I need to add eth0 to the bridge first and second create a static route via

route add -host <any chosen internal IP, e.g. 192.168.1.2> dev tap0

where I have third assigned before an additional internal IP to eth0 via

ip addr add <any chosen internal IP on the same subnet as route, e.g. 192.168.1.3> dev eth0

?

If so, my problem is I am bound to remote access since everything happens on a server. So I cannot add/remove interfaces via brctl since I then loose my ssh connection to the server!

Thus, I tried to put everything into /etc/network/interfaces, here is my code:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
  hostname 'actual hostname here'
  address 'actual IP here'
  netmask 'actual netmask here'
  gateway 'actual gateway IP here'

auto br0
iface br0 inet manual
   pre-up /sbin/tunctl -t tap0 -u 'actual user here' -g netdev
   pre-up /sbin/tunctl -t tap1 -u 'actual user here' -g netdev
   pre-up /sbin/tunctl -t tap2 -u 'actual user here' -g netdev
   pre-up /sbin/tunctl -t tap3 -u 'actual user here' -g netdev
   pre-up ip link set tap0 up
   pre-up ip link set tap1 up
   pre-up ip link set tap2 up
   pre-up ip link set tap3 up
   bridge-ports tap0 tap1 tap2 tap3
   bridge-stp 0
   bridge_maxwait  0
   bridge_fd       0
   post-down ip link set tap0 down
   post-down /sbin/tunctl -d tap0
   post-down ip link set tap1 down
   post-down /sbin/tunctl -d tap1
   post-down ip link set tap2 down
   post-down /sbin/tunctl -d tap2
   post-down ip link set tap3 down
   post-down /sbin/tunctl -d tap3

Now, when I add eth0 to the line bridge-ports eth0 tap0 tap1 tap2 tap3 I cannot get a connection via ssh to the server anymore. After rescuing and checking the log file, I cannot see any error or hint why eth0 with the bridge interface did not work!?

Where is my fault? Thanks a lot in advance!

EDIT: I also tried this in vain

auto lo
iface lo inet loopback

iface eth0 inet manual

auto br0
iface br0 inet manual
   pre-up /sbin/tunctl -t tap0 -u 'actual user here' -g netdev
   pre-up /sbin/tunctl -t tap1 -u 'actual user here' -g netdev
   pre-up /sbin/tunctl -t tap2 -u 'actual user here' -g netdev
   pre-up /sbin/tunctl -t tap3 -u 'actual user here' -g netdev

  pre-up ip link set eth0 up

   pre-up ip link set tap0 up
   pre-up ip link set tap1 up
   pre-up ip link set tap2 up
   pre-up ip link set tap3 up

  hostname 'actual hostname here'
  address 'actual IP here'
  netmask 'actual netmask here'
  gateway 'actual gateway IP here'

  bridge-ports eth0 tap0 tap1 tap2 tap3

   bridge-stp 0
   bridge_maxwait  0
   bridge_fd       0
   post-down ip link set tap0 down
   post-down /sbin/tunctl -d tap0
   post-down ip link set tap1 down
   post-down /sbin/tunctl -d tap1
   post-down ip link set tap2 down
   post-down /sbin/tunctl -d tap2
   post-down ip link set tap3 down
   post-down /sbin/tunctl -d tap3

Any idea anyone?

1 Answer 1

0

You need to set the IP address on the bridge interface, not on the underlying eth0 interface if you bridge eth0 in.

2
  • thanks, Tollef. I have tried similar things. Please refer to my new edit above. Any other idea?
    – Zee Age
    Nov 21, 2017 at 8:40
  • 1
    If you try with static instead of manual for br0 (or you set the ip using up ip addr add …, it should work better. manual won't set the IP for you. Nov 22, 2017 at 18:12

You must log in to answer this question.

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