I have set up some vagrant box and I want to connect to some services 
running on it. I used this to set up the networking

 config.vm.network "private_network", ip: "192.168.10.101"


I checked in VirtualBoxUI and the machine has two interfaces NAT with port 
forwarding 2222->22(probably the eth0) and HOST_ONLY(eth1?) 

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fec2:4a97  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:c2:4a:97  txqueuelen 1000  (Ethernet)
        RX packets 27643  bytes 24238095 (23.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11304  bytes 1136140 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.101  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::a00:27ff:fe19:fc5  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:19:0f:c5  txqueuelen 1000  (Ethernet)
        RX packets 3053  bytes 278689 (272.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2380  bytes 683097 (667.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Do I need port forwarding to access some service running inside on port 
ie.80? I have just tested that I can putty in by localhost:2222 or 
192.168.10.101:22

In which setting I can ommit port forwarding and just call guest with its 
ip? I have some problems connecting to another service and I am not sure 
whather it just listen to localhost only or something else is wrong.

Is this sentence I noted some time ago correct

port forwarding is not needed when using private network and accessing 
guest from host with guest private ip, port forwarding is used to access 
guest with localhost/127.0.0.1 the ports are then forwarded

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/63a27481-91a3-42b4-a93a-4aa7c49a424f%40googlegroups.com.

Reply via email to