Score:-1

How do I open a port on my Ubuntu 14.04 virtual server to my Mac from which it runs?

cl flag

I’m running a virtual Ubuntu (14.04) box, using Vagrant, on my Mac Big Sur machine. I would like to open port 1234 on my virtual machine to my Mac. From the virtual machine, I can see these ports listening

$ sudo lsof -i -P -n | grep LISTEN
[sudo] password for myuser: 
mysqld    1425   mysql   19u  IPv4  21538      0t0  TCP *:3306 (LISTEN)
sshd      1447    root    3u  IPv4  24616      0t0  TCP *:22 (LISTEN)
sshd      1447    root    4u  IPv6  24618      0t0  TCP *:22 (LISTEN)
redis-ser 1449   redis    5u  IPv4  14782      0t0  TCP *:6379 (LISTEN)
master    1828    root   12u  IPv4  18076      0t0  TCP 127.0.0.1:25 (LISTEN)
master    1828    root   13u  IPv6  18077      0t0  TCP [::1]:25 (LISTEN)
ruby      7514  myuser    7u  IPv4  51854      0t0  TCP 127.0.0.1:1234 (LISTEN)
node      7562  myuser   19u  IPv4  50542      0t0  TCP *:3500 (LISTEN)

However, I noticed when running nmap on my Mac, I’m not able to connect to port 1234

nmap -sT -p- 10.0.18.25
Starting Nmap 7.92 ( https://nmap.org ) at 2021-10-13 11:16 CDT
Nmap scan report for iad-3456273abcef.mlp.nq.smb.rcn.net (10.0.18.25)
Host is up (0.10s latency).
Not shown: 65531 closed tcp ports (conn-refused)
PORT     STATE SERVICE
22/tcp   open  ssh
3306/tcp open  mysql
3500/tcp open  rtmp-port
6379/tcp open  redis

Nmap done: 1 IP address (1 host up) scanned in 1374.16 seconds

When I try and run a firewall rule update on my machine

$ sudo ufw allow 1234
WARN: uid is 0 but '/usr' is owned by 501
Skipping adding existing rule
Skipping adding existing rule (v6)

I’m still unable to reach port 1234 from my local machine to the virtual server. What else do I need to do to open my virtual server’s port 1234?

Score:1
kr flag

That instance of ruby is listening on port 1234 for connections from 127.0.0.1 only. So port forwarding won't change much unless you have it accept connections from your host machine.

cl flag
Hadn't noticed that. I'd like it to listen to all connections but not sure how to do that. I start my instance using "rdebug-ide --port 1234 --dispatcher-port 26162 -- bin/rails s", fwiw.
kr flag
I wouldn't know. I know Linux but I'm not a ruby developer. Did you check the man page?
cl flag
Starting the server with "rdebug-ide --port 1234 --dispatcher-port 26166 --host 0.0.0.0 - bin/rails s" corrected the error you pointed out. Thx!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.