0

How do I access port 8100 from a VM?

I want to access port 8100 on a linux VM. I am running lubuntu. I have tried multiple questions already and none of them seem to work:

Connection refused on port 8100 -I tried following this question, and created all the iptables that they had but Safari still cannot connect to the server.

https://askubuntu.com/questions/166068/port-seems-to-be-open-but-connection-refused - This answer doesn't really answer anything.

https://stackoverflow.com/questions/19034542/how-to-open-port-in-centos - This seems relevant but also does not work.

Here are commands that I run and none seem to help.

$ netstat -an | grep "LISTEN "
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:8100          0.0.0.0:*               LISTEN     
tcp6       0      0 :::35729                :::*                    LISTEN    

This is my iptable:

$ sudo iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8100

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8100

I create the rules with these commands:

sudo iptables -A INPUT -p tcp -m tcp --dport 8100 -j ACCEPT
sudo iptables -A OUTPUT -p tcp -m tcp --dport 8100 -j ACCEPT

I tried to use UWF and it seems that port 8100 is active:

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
8100/tcp                   ALLOW IN    Anywhere                  
80                         ALLOW IN    Anywhere                  
443                        ALLOW IN    Anywhere                  
8100/tcp (v6)              ALLOW IN    Anywhere (v6)             
80 (v6)                    ALLOW IN    Anywhere (v6)             
443 (v6)                   ALLOW IN    Anywhere (v6)             

On my vm the network is setup as a bridge so the ipaddress is 10.0.0.63. Then on my computer (not the vm) I go to 10.0.0.63:8100 and I should get what is being served on port 8100 but I get an error when I use Safari/Chrome/Firefox Cannot connect to server.

What am I missing?

3
  • Do you mean VMware workstation. Feb 5, 2018 at 23:34
  • Any reason you don't use the bridge adapter and give the VM it's own IP address? Feb 5, 2018 at 23:34
  • @JacobEvans I am using VMware Fusion. I tried giving my own address and that does not work either.
    – Whitecat
    Feb 5, 2018 at 23:45

1 Answer 1

0

This is your (first) problem:

$ netstat -an | grep "LISTEN "
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:8100          0.0.0.0:*               LISTEN     
tcp6       0      0 :::35729                :::*                    LISTEN    

You only listen for port 8100 on localhost (127.0.0.1) You can either configure your service to listen on one or more ethernet interfaces or use iptables to forward port 8100 from an ethernet interface to 127.0.0.1:8100

5
  • How can I do that?
    – Whitecat
    Feb 6, 2018 at 21:55
  • Go back an re-read the second link you posted - in particular pay attention to the 2nd answer where it discusses using 0.0.0.0 instead of of localhost (127.0.0.1). The specifics of how you configure that for your application depends on the particular application (which you didn't mention, but I doubt is an xprint server) Feb 7, 2018 at 8:28
  • Are you saying there is no way outside of the application tool, and use something with command line tools to forward a port to 127.0.0.1:8100?
    – Whitecat
    Feb 7, 2018 at 15:48
  • Nope, I never said that at all. Most people with limited iptables experience find it easier to adjust service settings than to deal with iptables (i.e. much simpler to find and replace 127.0.0.1 or localhost with 0.0.0.0 in a config file or startup script). By all means feel free to google "ufw port forward" - you'll find no shortage of help and guides. Feb 7, 2018 at 23:53
  • That is the root of this question. How do I do deal with iptables? How can I make my question more clear that is what I want?
    – Whitecat
    Feb 12, 2018 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .