1

I'm trying to set up a virtual machine (guest) wich should act as router (ubntu 14.04). The host is a CentOS 7 machine (4x LAN). The guest should get a public ip address over it's eth0 (guest), wich is connected to enp0s20f0 (host) over br0 (host).

The Problem is, that the guest doesn't get an ip address.


More informations:

  • All interfaces of the host (enp0s20f0 - enp0s20f3) are connected over bridges br0 - br3 (host) to eth0 - eth3 (guest).
  • The LAN interfaces (host) don't have a bootproto
  • The bridges (host) don't have a bootproto, except br2: there is bootproto=static so I can connect the host to the guest and then to the internet

Sketch:

+---------------------------------------------------------------------------------------------------------+
|host: CentOS 7, KVM, qemu                                                                                |
|  +------------------------------------------------------------------------------------+  + - - - - - -+ |
|  |guest (VM): ubuntu 14.04 router, firewall                                           |  |other guests  |
|  |                                                                                    |       (VM)    | |
|  | +--------------------------------------------------------------------------------+ |  |              |
|  | |                                                                                | |               | |
|  | |                                     firewall                                   | |  |              |
|  | |                                                                                | |               | |
|  | ++------------+---------+-------------+-------+-------------+------+------------++ |  |              |
|  |  +------------+         +-------------+       +-------------+      +------------+  |               | |
|  |  |PROBLEM:    |         |             |       |             |      |            |  |  |              |
|  |  |eth0        |         |eth1         |       |eth2         |      |eth3        |  |  + - - - - - -+ |
|  |  |dhcp        |         |static       |       |static       |      |static      |  |      X          |
|  +------------------------------------------------------------------------------------+    X            |
|     |not working |         |lan zone     |       |dmz          |      |wlan zone   |     X              |
|     +----+-------+         +-----+-------+       +-------+-----+      +-----------++   X                |
|          |                       |                       |                        |  X                  |
|          |                       |                       |             X  X  X  X |X                    |
|   +------+---------+       +-----+------------+        +-+-------------X--+      ++-----------------+   |
|   |                |       |                  |        |                  |      |                  |   |
|   |                |       |                  |        |                  |      |                  |   |
|   |     br0        |       |      br1         |        |    br2           |      |      br3         |   |
|   |                |       |                  |        | BOOTPROTO=static |      |                  |   |
|   |  BOOTPROTO=none|       | BOOTPROTO=none   |        | IP: a local ip   |      |  BOOTPROTO=none  |   |
|   +-------+--------+       +---------+--------+        +----------+-------+      +---------+--------+   |
|           |                          |                            |                        |            |
|           |                          |                            |                        |            |
|           |                          |                            |                        |            |
|   +-------+--------+       +---------+--------+        +----------+-------+      +---------+--------+   |
|   |                |       |                  |        |                  |      |                  |   |
|   |enp0s20f0       |       |enp0s20f1         |        |enp0s20f2         |      |enp0s20f3         |   |
+---------------------------------------------------------------------------------------------------------+
    |                |       |                  |        |                  |      |                  |    
    |                |       |                  |        |                  |      |                  |    
    +--------X-------+       +---------X--------+        +---------XX-------+      +----------XX------+    
             XXXXX                     X                            XXXXXX                      XX         
                 XX  loc LAN  XXX      X           other server (dmz)    XXX     wlan zone       XX        
                  X             XXXXXXXX                      X       XXXXXX        XXX           X        
     internet XXXXX                                           XXXXXXXXX               XXXXXXXXX XXX        

Configs:

Guest:

cat /etc/network/interfaces
#[...] lo [...]
# The primary network interface
auto eth0
iface eth0 inet dhcp

# The lan
auto eth1
iface eth1 inet static
        address 192.168.x.y
        netmask 255.255.255.0
        broadcast 192.168.x.255

# the dmz
auto eth2
iface eth2 inet static
        address 10.0.p.q
        netmask 255.255.255.0
        broadcast 10.0.p.255

# The wirelles zone
auto eth3
iface eth3 inet static
        address 192.168.v.w
        netmask 255.255.255.0
        broadcast 192.168.v.255

Host:

cat /etc/sysconfig/network-scripts/ifcfg-*

NAME=br0                    DEVICE=br0                  NAME=br2                   NAME=br3                
TYPE=Bridge                 NAME=br1                    TYPE=Bridge                TYPE=Bridge             
ONBOOT=yes                  TYPE=Bridge                 BOOTPROTO=static           ONBOOT=yes              
BOOTPROTO=none              ONBOOT=yes                  ONBOOT=yes                 BOOTPROTO=none          
NM_CONTROLLED=no            BOOTPROTO=none              IPADDR=10.0.0.10           NM_CONTROLLED=no        
DELAY=0                     NM_CONTROLLED=no            NETMASK=255.255.255.0      DELAY=0                 
DEFROUTE=no                 DELAY=0                     GATEWAY=10.0.p.q           DEFROUTE=no             
PEERDNS=no                  DEFROUTE=no                 DNS1=10.0.p.q              PEERDNS=no              
# PEERROUTES=yes            PEERDNS=no                  NM_CONTROLLED=no           # PEERROUTES=yes        
# IPV4_FAILURE_FATAL=no     # PEERROUTES=yes            DELAY=0                    # IPV4_FAILURE_FATAL=no 
# IPV6INIT=no               # IPV4_FAILURE_FATAL=no     DEFROUTE=yes               # IPV6INIT="no"         
# IPV6_AUTOCONF=no          # IPV6INIT=no               PEERDNS=yes                # IPV6_AUTOCONF=no      
# IPV6_DEFROUTE=no          # IPV6_AUTOCONF=no          # PEERROUTES=yes           # IPV6_DEFROUTE=no      
# IPV6_PEERDNS=no           # IPV6_DEFROUTE=no          # IPV4_FAILURE_FATAL=no    # IPV6_PEERDNS=no       
# IPV6_PEERROUTES=yes       # IPV6_PEERDNS=no           # IPV6INIT=no              # IPV6_PEERROUTES=yes   
# IPV6_FAILURE_FATAL=no     # IPV6_PEERROUTES=yes       # IPV6_AUTOCONF=no         # IPV6_FAILURE_FATAL=no 
DEVICE=br0                  # IPV6_FAILURE_FATAL=no     # IPV6_DEFROUTE=no         DEVICE=br3              
                            DEVICE=br1                  # IPV6_PEERDNS=no                                  
                                                        # IPV6_PEERROUTES=yes                              
                                                        #IPV6_FAILURE_FATAL=no                             
                                                        DEVICE=br2                                         

NAME=enp0s20f0              NAME=enp0s20f1              NAME=enp0s20f2             NAME=enp0s20f3          
HWADDR="ab:cd:ef:gh:ij:kl"  HWADDR=ab:cd:ef:gh:ij:mn    HWADDR=ab:cd:ef:gh:ij:op   HWADDR=ab:cd:ef:gh:ij:qr
UUID="[...]"                UUID=[...]                  UUID=[...]                 UUID=[...]              
TYPE=Ethernet               TYPE=Ethernet               TYPE=Ethernet              TYPE=Ethernet           
BOOTPROTO=none              BOOTPROTO=none              BOOTPROTO=none             BOOTPROTO=none          
ONBOOT=yes                  ONBOOT=yes                  ONBOOT=yes                 ONBOOT=yes              
BRIDGE=br0                  BRIDGE=br1                  BRIDGE=br2                 BRIDGE=br3              
NM_CONTROLLED=no            NM_CONTROLLED=no            NM_CONTROLLED=no           NM_CONTROLLED=no        
# PERSISTENT_DHCLIENT=1     # DEFROUTE=no               # DEFROUTE=no              # DEFROUTE=no           
# DEFROUTE=no               # PEERDNS=yes               # PEERDNS=yes              # PEERDNS=yes           
# PEERDNS=yes               # PEERROUTES=yes            # PEERROUTES=yes           # PEERROUTES=yes        
# PEERROUTES=yes            # IPV4_FAILURE_FATAL=no     # IPV4_FAILURE_FATAL=no    # IPV4_FAILURE_FATAL=no 
# IPV4_FAILURE_FATAL=yes    # IPV6INIT="no"             # IPV6INIT=no              # IPV6INIT=no           
# IPV6INIT=no               # IPV6_AUTOCONF=no          # IPV6_AUTOCONF=no         # IPV6_AUTOCONF=no      
# IPV6_AUTOCONF=no          # IPV6_DEFROUTE=yes         # IPV6_DEFROUTE=yes        # IPV6_DEFROUTE=yes     
# IPV6_DEFROUTE=no          # IPV6_PEERDNS=yes          # IPV6_PEERDNS=yes         # IPV6_PEERDNS=yes      
# IPV6_PEERDNS=yes          # IPV6_PEERROUTES=yes       # IPV6_PEERROUTES=yes      # IPV6_PEERROUTES=yes   
# IPV6_PEERROUTES=yes       # IPV6_FAILURE_FATAL=no     # IPV6_FAILURE_FATAL=no    # IPV6_FAILURE_FATAL=no 
# IPV6_FAILURE_FATAL=no     DEVICE=enp0s20f1            DEVICE=enp0s20f2           DEVICE=enp0s20f3        
DEVICE=enp0s20f0                                                                            


  • All ip route and all ifconfig / ip addr are returning the correct values, except for eth0 (guest).

  • On running ifup eth0 the guest trys to get an ip address (DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval [...]) and ens with No DHCPOFFERS received.


I'm happy about every idea...

8
  • Does your ISP actually provide a public IP via DHCP over Ethernet? If you unplug the cable into enp0s20f0 and plug that cable into something else which requests a DHCP address, does it work?
    – suprjami
    Dec 6, 2014 at 6:09
  • Ah yes my ISP gives me a public IP over DHCP and this works on other devices and even on the host system, when I use a apt network-script for enp0s20f0
    – sedrubal
    Dec 6, 2014 at 14:12
  • If you don't intend for the interface to be configured with its own IP on the host, then you should use macvtap instead of a bridge. Dec 6, 2014 at 15:44
  • No Michael, he was just testing on the host. He wants the public IP to be on the router VM.
    – suprjami
    Dec 7, 2014 at 0:34
  • It's possble that your ISP's device doesn't give DHCP addresses to a MAC address which is not directly connected to it. You'd need to call your ISP to confirm this. If so, you could use ebtables to spoof the MAC of the VM, like this: wiki.debian.org/BridgeNetworkConnections
    – suprjami
    Dec 7, 2014 at 0:36

1 Answer 1

1

It's possble that your ISP's device doesn't give DHCP addresses to a MAC address which is not directly connected to it. You'd need to call your ISP to confirm this.

If so, you could use ebtables to spoof the MAC of the VM, like this:

http://wiki.debian.org/BridgeNetworkConnections

You must log in to answer this question.

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