Vagrant public_network with NIC uplink off

32 views
Skip to first unread message

Juan Francisco Giordana

unread,
Sep 23, 2015, 1:00:16 PM9/23/15
to Vagrant
Hello.

I'm trying to use this network settings so I can access the box from my desktop PC (or from my laptop if I need to).

config.vm.network "public_network",
bridge: 'eth0',
ip: "192.168.0.1"

This works only when the NIC uplink is On (i.e. notebook turned On) .

Currently using Vagrant 1.7.4 on Linux Mint (LMDE2) with the VirtualBox provider.

The idea is to make the vagrant box act as a physical server on the network, but not requiring the network "to be up" to do it so, also to move the virtual server box to the laptop if I need to in a practical way.

I think it could be something OS related, but haven't found a way to make this work and I'm out of ideas on how to look for it.

Vagrant eth1: 192.168.0.1
Desktop eth0: 192.168.0.2
Laptop (optional) eth0: 192.168.0.3

I'm only able to ping/curl the box when the network uplink is On.

Running all these commands from the desktop with the laptop suspended:

juan@shadow ~ $ curl dev
curl: (7) Failed to connect to dev port 80: Connection timed out

juan@shadow ~ $  ping dev
PING dev (192.168.0.1) 56(84) bytes of data.
From shadow (192.168.0.2) icmp_seq=26 Destination Host Unreachable
From shadow (192.168.0.2) icmp_seq=27 Destination Host Unreachable
From shadow (192.168.0.2) icmp_seq=28 Destination Host Unreachable


[...] laptop waked up [...]


juan@shadow ~ $  sudo ifdown eth0
RTNETLINK answers: No such process
juan@shadow ~ $  sudo ifdown eth0
ifdown: interface eth0 not configured
juan@shadow ~ $  sudo ifup eth0


64 bytes from dev (192.168.0.1): icmp_seq=29 ttl=64 time=0.535 ms
64 bytes from dev (192.168.0.1): icmp_seq=30 ttl=64 time=0.344 ms
64 bytes from dev (192.168.0.1): icmp_seq=31 ttl=64 time=0.292 ms
^C
--- dev ping statistics ---
31 packets transmitted, 3 received, +3 errors, 90% packet loss, time 30212ms
rtt min/avg/max/mdev = 0.292/0.390/0.535/0.105 ms, pipe 3

Thanks

Alvaro Miranda Aguilera

unread,
Sep 24, 2015, 12:27:28 AM9/24/15
to vagra...@googlegroups.com
On Thu, Sep 24, 2015 at 5:00 AM, Juan Francisco Giordana
<juangi...@gmail.com> wrote:
>
> The idea is to make the vagrant box act as a physical server on the network,
> but not requiring the network "to be up" to do it so

Any diagram?

Is the VM on the laptop today?

Since I understand the vm is on the laptop, and if the laptop goes to
sleep the vm dissapear . I would say that is expected.

so I think I am missing something

Thanks
Alvaro

Juan Giordana

unread,
Sep 24, 2015, 12:56:17 AM9/24/15
to vagra...@googlegroups.com
The VM is on the desktop most of the time. It is used for web development (php, mysql, etc).

I want it to be visible on the laptop if I need to, that's why I'm using a bridged vbox network setting.

Also, since I'm using static IPs, I may load a server on the laptop when I'm not at home without editing /etc/hosts or doing "complicated" stuff.

Regards

Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezUgrUiMfZtgSFSgndkBRahzeTx1H8kLhNvcb8bBpFQyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--

dragon788

unread,
Oct 21, 2015, 3:40:28 PM10/21/15
to Vagrant, juangi...@gmail.com
If you are using a bridged connection I believe in many cases it is set to "replicate physical connection state" if that's the case and your laptop doesn't have the same named network adapter it could fail.

Virtualbox will try and assign a network interface to the VM via DHCP, if you have a second network interface in the VM that is bridged to your physical network hopefully the IP ranges don't overlap or you will have trouble. You always need at least two network interfaces in a VM when using bridged mode in Vagrant, one for NAT for vagrant-ssh to manage the VM and one for the bridged connection that should pull an IP from your physical router.
Reply all
Reply to author
Forward
0 new messages