Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

public_network not being configured for DHCP or default route #26

Open
aogail opened this issue Feb 19, 2016 · 3 comments
Open

public_network not being configured for DHCP or default route #26

aogail opened this issue Feb 19, 2016 · 3 comments

Comments

@aogail
Copy link

aogail commented Feb 19, 2016

I'm not well versed in the responsibilities of vagrant providers vs. vagrant itself, but it appears that the xenserver provider is missing something to make public_networks work correctly. Vagrant's documentation says the following configuration will add a public network interface to the VM, and allow its DHCP configuration to set the default route for the system:

    config.vm.network 'public_network', bridge: 'xenbr0',
      use_dhcp_assigned_default_route: true

With Virtualbox

In my case I am using an ubuntu box file. When I up the VM using the virtualbox provider, the eth1 interface is correctly configured for DHCP, and its route is the default route for the system. As such, from the VM I can ping hosts on the Internet.

vagrant@vagrant-ubuntu-trusty-64:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:22:cb:22  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe22:cb22/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:851 errors:0 dropped:0 overruns:0 frame:0
          TX packets:566 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:101294 (101.2 KB)  TX bytes:81225 (81.2 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:85:93:6a  
          inet addr:192.168.254.172  Bcast:192.168.254.255  Mask:255.255.255.0
          inet6 addr: 2001:470:1f05:79f:a00:27ff:fe85:936a/64 Scope:Global
          inet6 addr: fe80::a00:27ff:fe85:936a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:61 errors:0 dropped:4 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5929 (5.9 KB)  TX bytes:3400 (3.4 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vagrant@vagrant-ubuntu-trusty-64:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.254.1   0.0.0.0         UG    0      0        0 eth1
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.254.0   0.0.0.0         255.255.255.0   U     0      0        0 eth1

With XenServer

When I up the VM with the xenserver provider, the VM does have a second interface (eth1). However, eth1 is unconfigured. The result is that the VM cannot access the Internet, because its default route is through the private NAT interface that Vagrant uses.

vagrant@vagrant-ubuntu-trusty-64:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         169.254.0.1     0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
vagrant@vagrant-ubuntu-trusty-64:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr ca:96:6b:90:c9:fb  
          inet addr:169.254.0.2  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::c896:6bff:fe90:c9fb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:490 errors:0 dropped:0 overruns:0 frame:0
          TX packets:489 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:62125 (62.1 KB)  TX bytes:72761 (72.7 KB)

eth1      Link encap:Ethernet  HWaddr a2:3d:fd:fe:e9:b4  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:156 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:11920 (11.9 KB)  TX bytes:11920 (11.9 KB)

In the guest, I found the configuration difference in /etc/network/interfaces. When the VM is upped using the virtualbox provider, the file contains a block with #VAGRANT-BEGIN/#VAGRANT-END, which I believe comes from https://github.com/mitchellh/vagrant/blob/master/templates/guests/debian/network_dhcp.erb. When the VM is upped using the xenserver provider, the file contains nothing from Vagrant.

I'm using vagrant 1.8.1 on Mac OS 10.10.

$ vagrant -v
Vagrant 1.8.1
$ vagrant plugin list
vagrant-parallels (1.6.1)
vagrant-share (1.1.5, system)
vagrant-xenserver (0.0.11)
@jonludlam
Copy link
Collaborator

Thanks for the report! I don't quite know how those guest setup bits and pieces are supposed to work, so I'll need to investigate that. We're probably just missing a call to some vagrant library function during the 'up' action. I'll investigate a bit more and see what I can find.

@jonludlam
Copy link
Collaborator

Actually this might be a problem with XenServer needing some extra configuration. Could you try executing the following on your xenserver then recreating your vagrant box:

net=`xe network-list other-config:is_host_internal_management_network=true --minimal`
xe network-param-set uuid=$net other-config:ip_disable_gw=true

This should prevent the internal network from advertising itself as a gateway. If this works, I'll add it to the README, or possibly even detect it in the plugin.

@aogail
Copy link
Author

aogail commented Feb 22, 2016

After executing those commands and destroying/upping the VM, the situation is different but eth1 remains un-configured. The routing table did change, however; the default route through the vagrant management interface disappeared.

vagrant@vagrant-ubuntu-trusty-64:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 9e:bf:3b:4f:40:80  
          inet addr:169.254.0.2  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::9cbf:3bff:fe4f:4080/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:409 errors:0 dropped:0 overruns:0 frame:0
          TX packets:439 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:56617 (56.6 KB)  TX bytes:66253 (66.2 KB)

eth1      Link encap:Ethernet  HWaddr 96:04:0e:d3:93:36  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:10864 (10.8 KB)  TX bytes:10864 (10.8 KB)

vagrant@vagrant-ubuntu-trusty-64:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants