0

I deleted an old KVM guest and now have a spare IP address. I now assigned this (previously working!) IP address to another KVM guest, like so:

virsh # attach-interface my-guest bridge br0 vnet1 00:50:56:00:57:05 --model virtio --persistent

The guest XML file now looks like this:

virsh # dumpxml my-guest
<domain type='kvm' id='3'>
  <name>my-guest</name>
  ...
  <devices>
    <emulator>/usr/bin/kvm-spice</emulator>
    ...
    <interface type='bridge'>
      <mac address='00:50:56:00:57:04'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='00:50:56:00:57:05'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </interface>
    ...
  </devices>
  ...
</domain>

Because of the kind of randomly assigned PCI slot, the new IP address is now eth0 and the old one is eth1.

I changed the guest's /etc/network/interfaces appropriately:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# 148.251.73.28 <- new IP address
auto eth0
iface eth0 inet dhcp

# 148.251.73.27 <- old IP address
auto eth1
iface eth1 inet dhcp

Upon login, I'm even greeted with this friendly message, indicating that both interfaces should be configured correctly, as they automatically got assigned the correct IP addresses (based on the MAC addresses):

System load:  1.54                Users logged in:        0
Usage of /:   22.6% of 448.72GB   IP address for eth0:    148.251.73.28
Memory usage: 12%                 IP address for eth1:    148.251.73.27
Swap usage:   0%                  IP address for docker0: 172.17.42.1
Processes:    207

And now the problem: Only eth0, the new IP address, works. I can't reach the server over eth1.

Note: I have an nginx server listening on 0.0.0.0.

All these tests fail:

$ curl --interface eth1 ifconfig.co
$ curl --interface eth1 148.251.73.28   (eth1 -> eth0)
$ curl --interface eth0 148.251.73.27   (eth0 -> eth1)

And strangely enough, this works:

$ curl --interface eth1 148.251.73.27   (eth1 -> eth1)

What the heck? Does anyone have any clues on what could cause this?

Last but not least, the host's /etc/network/interfaces:

# Loopback device:
auto lo
iface lo inet loopback

# device: eth0
auto  br0
iface br0 inet static
  address     148.251.52.150
  broadcast   148.251.52.159
  netmask     255.255.255.224
  gateway     148.251.52.129
  pointopoint 148.251.52.129

  bridge_ports eth0
  bridge_stp off
  bridge_fd 1
  bridge_hello 2
  bridge_maxage 12

  # default route to access subnet
  up route add -net 148.251.52.128 netmask 255.255.255.224 gw 148.251.52.129 br0
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
buschtoens
  • 169
  • 1
  • 11
  • because the two interfaces are in the same subnet, configure the two interfaces with static ip, one of two interfaces without the default gateway, I don't see the need to have two interfaces managed by dhcp. – c4f4t0r Jul 11 '15 at 07:21
  • Hetzner do MAC address filtering. Make sure you are using the right virtual MAC address. – Michael Hampton Jul 11 '15 at 13:34
  • I am sure, I've set it up with the correct MAC addresses in the XML file. It's just like they previously connected, and as the correct IP addresses are assigned, the MAC addresses must be correct. I guess it really has something to do with what c4f4t0r said. However, I can't dig into it right now. – buschtoens Jul 11 '15 at 13:41

0 Answers0