Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have created with Vagrant a brand new VM running Ubuntu 12.04 Since I need to access the VM always at the same IP address I have assigned to it a MAC address and set my DHCP in order to assign the same IP to the machine with that MAC.

My VagrantFile looks like

Vagrant::Config.run do |config|
  config.vm.box = "ubuntu-vm"
  config.vm.box_url = "http://files.vagrantup.com/precise32.box"
  config.vm.network :bridged, :bridge =>  "BGigabit Ethernet", :mac => "080027234567"
end

The VM is correctly created and the same IP assigned every time I boot it up. However, the Gateway is not properly configured.

Here my ifconfig

eth0      Link encap:Ethernet  HWaddr 08:00:27:12:96:98
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe12:9698/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:436 errors:0 dropped:0 overruns:0 frame:0
          TX packets:360 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:46526 (46.5 KB)  TX bytes:41271 (41.2 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:23:45:67
          inet addr:142.17.1.10  Bcast:142.17.3.255  Mask:255.255.252.0
          inet6 addr: fe80::a00:27ff:fe12:3456/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:910 errors:0 dropped:6 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:72559 (72.5 KB)  TX bytes:1604 (1.6 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:16436  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)

and here my routes

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
default         10.0.2.2        0.0.0.0         UG    100    0        0 eth0
10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
142.17.0.0      *               255.255.252.0   U     0      0        0 eth1

The eth1 gateway should be 142.17.0.1. Shouldn't the correct address be fetched from the DHCP?

Do I have to specify some extra params in my Vagrantfile to make it work?

THANKS.

share|improve this question
    
You can only have one default gateway per system (not per interface). Your current gateway is set to 10.0.2.2 (probably the Vagrant master) over eth0 (Vagrant's management interface) –  CyberJacob Nov 7 '13 at 8:29
    
I see, the first issue is why eth1 has 142.17.0.0 instead 142.17.0.1 that is the gateway in my DHCP? Moreover, how can I set the last route as default? –  macsig Nov 7 '13 at 8:33
    
You don't have a gateway set on eth1. 142.17.0.0 is the network address (covers 142.17.0.1 to 142.17.0.254) which is routed directly to eth1 without using a gateway. –  CyberJacob Nov 7 '13 at 8:38
    
Thanks for you help. So, you mean everything seems fine to you. Correct? –  macsig Nov 7 '13 at 8:59
    
Yes, it does. can you ping 8.8.8.8? –  CyberJacob Nov 7 '13 at 19:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.