Vagrant works in 'Forwarded Port' but I can't make 'Public Network' work

25 views
Skip to first unread message

decimo...@gmail.com

unread,
Nov 22, 2017, 11:49:31 PM11/22/17
to Vagrant
Vagrant works in 'Forwarded Port'. I can reach the guest webserver from my windows host  (localhost:9990, or the LAN IP 192.168.1.100:9990)
config.vm.network "forwarded_port", guest: 80, host: 9990

As I need the webserver to be reachable from other devices in the LAN I did:
config.vm.network "public_network"

The first issue is the machine boots around 10x slower, but it's ok for now.

The second issue is I don't know how to reach the guest from other devices.
ifconfig (first is NAT, second is BRIDGE):

enp0s3    Link encap:Ethernet  HWaddr 02:14:68:3e:84:47
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::14:68ff:fe3e:8447/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2280 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2236 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:186742 (186.7 KB)  TX bytes:1599034 (1.5 MB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:7c:23:74
          inet6 addr: fe80::a00:27ff:fe7c:2374/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:453 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:29213 (29.2 KB)  TX bytes:9198 (9.1 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:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:1684 (1.6 KB)  TX bytes:1684 (1.6 KB)

It is assigned an IPv6.
So I tried defining an static IP as my router's subnet:
config.vm.network "public_network", ip: '192.168.1.111'

I Checked the router, and the VBox is not connecting to it, the VBox is still getting IPv6.

Am I suppose to do something else?

Alvaro Miranda Aguilera

unread,
Nov 23, 2017, 4:02:12 AM11/23/17
to vagra...@googlegroups.com
Hello

are you over wifi?

so wifi adapters don't play nice with bridge interfaces and dhcp on the virtual one.

if on wifi, try on cable.



Check you are on the latest version of vagrant 2.0.x and on the latest 5.1.x series of Virtualbox.

have been some on/off issues about the nic on linux not being set with the cable connected by default, or some bugs on the virtualbox driver.

Check the settings of the VM.

Settings -> network, check both interfaces for cable connected.

Screenshot in dutch :/

Inline image 1


so try please with our box:

hashicorp/precise64



the ipv6 is ok you can ignore is just a local per device local-link ip

once the first nic is up and running, grab dhcp from virtualbox, vagrant connects over ssh, creates a configuration for the 2nd nic, and try to grab IP over dhcp.


vagrant ssh -c 'sudo su -'

ethtool enp0s8

dhclient  enp0s8




Thanks
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/8130e278-fa83-47cd-9db9-c03f805c6d8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

decimo...@gmail.com

unread,
Nov 23, 2017, 7:07:22 PM11/23/17
to Vagrant
Going wired is not feasible for me as the router is on a different room. Is that the only option I have? I miss XAMPP days, so easy to share frontend work to LAN devices.
Reply all
Reply to author
Forward
0 new messages