Vagrant: Can't reach private network on Debian 9 (stretch) host

Created on 14 Jun 2017  ·  17Comments  ·  Source: hashicorp/vagrant

In Debian 8, I was able to assign private network IPs to VMs and connect to that IP directly. This does not seem to be the case in Debian 9.

I'm using Virtualbox 5.1.22 and have tested on 2 different laptops (both using Debian 9).

Vagrant version

$ vagrant -v
Vagrant 1.9.5

Host operating system

$ lsb_release -d
Description:    Debian GNU/Linux 9.0 (stretch)

Guest operating system

Doesn't seem to matter, I've tested with Debian and CentOS.

Vagrantfile

Vagrant.configure(2) do |config|
    config.vm.box = 'box-cutter/debian8'
    config.vm.network 'private_network', ip: '10.90.10.10'
end
hoslinux needs-repro networking question

Most helpful comment

I found the problem. The net-tools was not installed on my system. This package includes ifconfig, which I assume either vagrant or virtualbox uses to configure its networks.

All 17 comments

Hi there,

I was unable to reproduce the behavior you are experiencing. Using the Vagrantfile you provided, after bringing the VM up:

$ vagrant ssh -- ip a | grep 10.90
    inet 10.90.10.10/24 brd 10.90.10.255 scope global eth1

$ ssh [email protected]
[email protected]'s password:
----------------------------------------------------------------
  Debian GNU/Linux 8.6 (jessie)               built 2016-12-04
----------------------------------------------------------------
vagrant@vagrant:~$

The VM seems to be accessible without issue. Can you provide more information to reproduce the specific failure you are experiencing? Thanks!

Not sure what other information I can provide - I run the exact same commands as you and ssh simply hangs.

I suspect this is because of the virtualbox network not being brought up or routed. What's the output from your ip addr and ip route on the host system?

And just to double check, you are also using Debian 9 on the host system, right?

@anlutro can you try with guest box hashicorp/precise64? This may be a known issue.

Same issue with hashicorp/precise64. Also centos/7.

Was having the same issue. On one system all worked as expected on a new new install of stretch it did not work. In my case, one difference was net-tools/ifconfig was installed on the system where all worked. Installing net-tools fixed my issue with private networks w/ virtualbox/vagrant. Looks like virtualbox requires ifconfig(net-tools).

@anlutro then it's probably not the same issue, but: double check that you have virtualization enabled on your bios.

If it wasn't enabled, I wouldn't be able to create VMs at all. Also, it worked fine in Debian 8 on the same laptop.

@chrisroberts Since you tagged the issue with waiting-reply, could you be a bit more specific about what more information you'd like me to provide? I'm unsure of where to look.

@anlutro in fact, some people (myself included) have had vagrant report that it could create the vm, but then attempting to ssh into the new vm would hang, when VT-x was disabled. This did not happen with all boxes. In my case, the arch linux box i was trying to use hung, but the hashicorp precise box immediately crashed with 'no VT-x' or something similar. Since the hashicorp box did not crash in this way for you, I'm guessing it's not the same issue, although I'm on a different host (arch again).

@anlutro Thanks for the information. I can't reproduce the behavior on my machine so I'm building a fresh debian-9 box to attempt to repro and see if I can force the same behavior.

Seeing this behavior as well with Vagrant 1.9.5, debian 9 and
virtualbox-5.1_5.1.22-115126.
Private network doesn't work.

My Vagrantfile:
`
Vagrant.configure(2) do |config|
# Definir máquina virtual
config.vm.define :"debian-jessie-seped"

# Configurar caja
config.vm.box = "debian/jessie64"

# Configurar red
config.vm.network "private_network", ip: "192.168.10.2"

# Configurar carpetas compartidas
config.vm.synced_folder ".",    "/vagrant"  , type: "nfs"

end
`

My ip command output:

ip addr show

`
....
5: vboxnet0: mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
....

`
My debian version:

uname -a

Linux MY-LAPTOP 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1 (2017-06-18) x86_64 GNU/Linux

Regards.
Sorry bad english

@anlutro I built a new debian-9 host, installed Virtualbox, installed Vagrant 1.9.5, and used your provided Vagrantfile. See details below:

vagrant@debian-9:~/test$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
vagrant@debian-9:~/test$ cat Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "box-cutter/debian8"
  config.vm.network 'private_network', ip: '10.90.10.10'
end
vagrant@debian-9:~/test$ vagrant ssh -- ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:90:d2:ed brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe90:d2ed/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:02:57:7a brd ff:ff:ff:ff:ff:ff
    inet 10.90.10.10/24 brd 10.90.10.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe02:577a/64 scope link
       valid_lft forever preferred_lft forever
vagrant@debian-9:~/test$ ssh [email protected]
[email protected]'s password:
----------------------------------------------------------------
  Debian GNU/Linux 8.6 (jessie)               built 2016-12-04
----------------------------------------------------------------
vagrant@vagrant:~$ exit
logout
Connection to 10.90.10.10 closed.

And ip addr and ip route information from the _host_ system (which is a fresh debian 9 host):

vagrant@debian-9:~/test$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:66:85:d9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.84.128/24 brd 192.168.84.255 scope global ens32
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe66:85d9/64 scope link
       valid_lft forever preferred_lft forever
3: vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.90.10.1/24 brd 10.90.10.255 scope global vboxnet0
       valid_lft forever preferred_lft forever
    inet6 fe80::800:27ff:fe00:0/64 scope link
       valid_lft forever preferred_lft forever
vagrant@debian-9:~/test$ ip route
default via 192.168.84.2 dev ens32
10.90.10.0/24 dev vboxnet0 proto kernel scope link src 10.90.10.1
192.168.84.0/24 dev ens32 proto kernel scope link src 192.168.84.128
vagrant@debian-9:~/test$

Is it possible you have any type of firewall/filtering locally that may be blocking access?

I definitely don't have any local firewall/filtering. I do want to point out this difference in ip addr and ip route output though:

$ ip addr
...
4: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
$ ip route
default via 192.168.2.254 dev wlp4s0 proto static metric 600 
192.168.2.0/24 dev wlp4s0 proto kernel scope link src 192.168.2.1 metric 600

What could cause my system to not bring the interface up and register the routes?

I found the problem. The net-tools was not installed on my system. This package includes ifconfig, which I assume either vagrant or virtualbox uses to configure its networks.

I've been hit by this too and will install net-tools - however ifconfig is deprecated and vagrant really should work without it. I assume this is why this issue is still open.

Debian guest support has been updated in Vagrant and this is resolved in recent releases.

Cheers!

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings