3

I have a server. It's configured with a public IP, and I have /29 subnet assigned via a network bridge.

KVM is installed and works as intended. I can create and boot a VM, but when it comes to defining network access things start to go wrong.

If I manually enter the IP for the Guest (which comes from the /29). I enter the host IP as the gateway, and then I get the message that the gateway is unreachable.

Here's the contents of /etc/network/interfaces

auto lo
iface lo inet loopback
iface lo inet6 loopback

auto br0
iface br0 inet static
  address 144.76.15.98
  netmask 255.255.255.224
  gateway 144.76.15.97
  pointopoint 144.76.15.97
  bridge_ports eth0
  bridge_stp off
  bridge_maxwait 0
  bridge_fd 0
  up route add -host 136.243.185.120 dev br0
  up route add -host 136.243.185.121 dev br0
  up route add -host 136.243.185.122 dev br0
  up route add -host 136.243.185.123 dev br0
  up route add -host 136.243.185.124 dev br0
  up route add -host 136.243.185.125 dev br0
  up route add -host 136.243.185.126 dev br0
  up route add -host 136.243.185.127 dev br0

What am I doing wrong?

1 Answer 1

2

It depends what’s behind your eth0 interface, but it looks wrong to bridge your external network with your virtual network, given that they use different IP addresses.

I think things would work much better if you set up your host computer as a router between eth0 and br0.

Things might also be easier if you used your 136.243.185.120/29 as a subnet rather than route it IP by IP.

You would have something like this:

auto eth0
iface eth0 inet static
  address 144.76.15.98
  netmask 255.255.255.224
  gateway 144.76.15.97

auto br0
iface br0 inet static
  address 136.243.185.121
  netmask 255.255.255.248
  bridge_ports eth0
  bridge_stp off
  bridge_maxwait 0
  bridge_fd 0

You’d also have to enable packet forwarding with sysctl net.ipv4.ip_forward=1.

If you can’t afford to “loose” 3 addresses in your 136.243.185.120/29 network, you can configure br0 with address 144.76.15.98, netmask 255.255.255.255 and manually route your 8 addresses to that interface, as you did.

7
  • Thanks for the suggestions. The box in question is hosted with Hetzner and I followed this guide: wiki.hetzner.de/index.php/… But I'll try your suggestion tonight. I'd rather lose some IP's to get this working, than feel an overwhelming urge to throw the box out the proverbial window.
    – Thomas
    Nov 21, 2017 at 14:51
  • I just had a look at that tutorial, and it looks more like my second suggestion than like your config: in the host, the physical interface is not part of the bridge, and the bridge is configured with the same IP as the external interface, with netmask 255.255.255.255. Nov 21, 2017 at 22:12
  • The problem is that when I follow the above suggestions, I end up with VMs that return "gateway unreachable". This occurs when I try to install Ubuntu on the guest and I end up having to configure the network manually (because obviously, no DHCP)
    – Thomas
    Nov 22, 2017 at 12:06
  • What configuration did you try for the host? (Subnet or routes to the individual hosts?) And how did you configure the VM’s network? Nov 22, 2017 at 19:44
  • I've set it up with individual routes. I have a VM up and running, but can't get the host/guest connection working on a non-lan ip. I've configured the VM with two nics; one running 10.0.0.x and one running the above /29. But it ain't taking. But I'll get to the bottom of this. :D
    – Thomas
    Nov 22, 2017 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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