Port Forwarded not working, exahausted possible solutions

1,487 views
Skip to first unread message

French Fry

unread,
May 31, 2017, 4:33:18 PM5/31/17
to Vagrant
Running Vagrant 1.95 with VirtualBox Version 5.1.22 r115126 (Qt5.6.2).  Box is bento/ubuntu-16.04. Host is Windows 8. 

ssh is working so no problem there.  What I can't do is either telnet or connect through host browser. Here is the relevant section of the Vagrantfile

config.vm.network "forwarded_port", guest: 1125, host: 4567, protocol: "tcp", auto_correct: true
  config.vm.network "forwarded_port", guest: 1125, host: 4567, protocol: "udp", auto_correct: true
I added the protocol and auto_correct options recently but they haven't changed anything. 
Also enabled Vagrant logging and am not seeing any issues regarding the ports.   Running
sudo netstat -lptn and other options shows the ports of ssh and my postgresql listening, but nothing for the forwarded ports in the config file. 

I was able to netcat the port,  that worked for telnet.  No firewall running on Ubuntu (ufw status - inactive) and iptables is basically empty / no rules defined.  Not that it would matter with ufw off.

I've also done multiple tests with Windows firewall off, so the problem doesn't appear to be there. Checked my router and still no issues (not running a firewall on the router). 

Googling around there were some suggestions to use a bridged connection in Virtualbox as opposed to NAT, though if ssh is working, why wouldn't telnet and ultimately my browser. 

Looking for some suggestions / help on this issue.  Thank you!

Jamie Jackson

unread,
May 31, 2017, 4:52:11 PM5/31/17
to vagra...@googlegroups.com
One thing you can do: While the VM is running, you can play around with port forwarding, live, from the Network configuration section of the VirtualBox GUI (the first interface--the NAT one: Advanced > Port Forwarding). That way, you'll know if you're dealing with a Vagrant or VirtualBox issue.

--
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/520ac130-6ace-4b6a-8769-27ae331565bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alvaro Miranda Aguilera

unread,
May 31, 2017, 4:52:27 PM5/31/17
to vagra...@googlegroups.com
can you share:

output of:

vagrant ssh-config

and from the guest

sudo netstat -anp | grep 1125

On the windows, open one powershell session, not sure available on windows 8 but try:

tnc localhost -p 4567

share output

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/520ac130-6ace-4b6a-8769-27ae331565bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Message has been deleted

French Fry

unread,
May 31, 2017, 6:12:14 PM5/31/17
to Vagrant
SSH Config

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile C:/rails_box/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL



Netstat  Grep on the port returned nothing , here is what I have minus domain sockets

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State  PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN                   1118/sshd
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN                   843/inetd
tcp        0      0 10.0.2.15:22            10.0.2.2:49350          ESTABLISHED   2489/sshd: vagrant
tcp6       0      0 :::22                   :::*                    LISTEN                         1118/sshd
tcp6       0      0 ::1:5432                :::*                    LISTEN                       1261/postgres
udp        0      0 0.0.0.0:68              0.0.0.0:*                                             022/dhclient
udp6       0      0 ::1:33490               ::1:33490               ESTABLISHED      1261/postgres

I ran the tnc on the port in Windows Powershell but couldn't figure out the command to write to file.  It did not make a connection though and exited.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
Alvaro

French Fry

unread,
May 31, 2017, 6:23:10 PM5/31/17
to Vagrant
TNC returned -

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Users\Stuart> tnc localhost -Port 4567


ComputerName           : localhost
RemoteAddress          : ::1
RemotePort             : 4567
InterfaceAlias         : Loopback Pseudo-Interface 1
SourceAddress          : ::1
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : True






Alvaro Miranda Aguilera

unread,
May 31, 2017, 6:33:54 PM5/31/17
to vagra...@googlegroups.com
So on the guest, what service is the one that will get the traffic coming to port 1125 ?

On Wed, May 31, 2017 at 11:54 PM, French Fry <samb...@gmail.com> wrote:
ssh-config

C:\rails_box>vagrant ssh-config

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile C:/rails_box/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

Netstat - nothing came back on that one but here is the -anp

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
1118/sshd
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN
843/inetd
tcp        0      0 10.0.2.15:22            10.0.2.2:49350          ESTABLISHED
2489/sshd: vagrant
tcp6       0      0 :::22                   :::*                    LISTEN
1118/sshd
tcp6       0      0 ::1:5432                :::*                    LISTEN
1261/postgres
udp        0      0 0.0.0.0:68              0.0.0.0:*
1022/dhclient

udp6       0      0 ::1:33490               ::1:33490               ESTABLISHED
1261/postgres



On Wednesday, May 31, 2017 at 2:52:27 PM UTC-6, Alvaro Miranda Aguilera wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
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.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

French Fry

unread,
May 31, 2017, 6:42:52 PM5/31/17
to Vagrant


On Wednesday, May 31, 2017 at 4:33:54 PM UTC-6, Alvaro Miranda Aguilera wrote:
So on the guest, what service is the one that will get the traffic coming to port 1125 ?


Alvaro


Probably none :)..  This is being set up for Rails dev, so I want to access the app with the host browser.  I know Puma is running the app, and that is probably a different port but wanted to get the port forwarded down first before moving on.

French Fry

unread,
May 31, 2017, 7:59:37 PM5/31/17
to Vagrant


On Wednesday, May 31, 2017 at 4:42:52 PM UTC-6, French Fry wrote:

Just an update -  I was able to reach the Puma server, guest (3000) host (4567),   Still like to know why I can't get the 1125 or another port for telnet or seeing the Vagrant page in my browser.  I was able to telnet on the postgres port but not the right port to use, just that I tried so many different ones.

Alvaro Miranda Aguilera

unread,
Jun 1, 2017, 2:15:39 AM6/1/17
to vagra...@googlegroups.com
If there is nothing running on the port then nonthing will show up in the browser.

in the netstat you did share was nothing there.

So, lets say you start an up on port 8080 on the guest and you make the port fwd from 8181 in the host.

if you do on the guest netstat -anp | grep 8080 you should see something doing the listening


if the app is browser then you can test on the guest like

Then on the host:

you can test the port is reachable with . tnc localhost -p 8181

then on the browser in the computer try  http://localhost:8181

However,

If you add a private_network, and assign an IP like 192.168.56.21 then all gets easier

since on the guest you can do

and ont he host you can also use the same url

Alvaro

On Thu, Jun 1, 2017 at 1:59 AM, French Fry <samb...@gmail.com> wrote:


On Wednesday, May 31, 2017 at 4:42:52 PM UTC-6, French Fry wrote:

Just an update -  I was able to reach the Puma server, guest (3000) host (4567),   Still like to know why I can't get the 1125 or another port for telnet or seeing the Vagrant page in my browser.  I was able to telnet on the postgres port but not the right port to use, just that I tried so many different ones.

--
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.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

French Fry

unread,
Jun 1, 2017, 10:44:26 AM6/1/17
to Vagrant
I'll probably work toward setting up a private network.  What about telnet though? telenetd exists but perhaps I need to configure it. 
Thanks for the help, greatly appreciated.
Reply all
Reply to author
Forward
0 new messages