OpenVZ Forum


Home » General » Support » venet cannot listen on ip address specified
venet cannot listen on ip address specified [message #53160] Wed, 31 January 2018 10:42 Go to previous message
kdlsw is currently offline  kdlsw
Messages: 2
Registered: January 2018
Junior Member
I have a VPS Ubuntu running on OpenVZ, I think. The problem I am having is, some program requires user to manually specify an IP address for listening, I do not know which IP address to put with the Venet0 and Venet0:0.

Here is the ifconfig
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:16436  Metric:1
          RX packets:155139 errors:0 dropped:0 overruns:0 frame:0
          TX packets:155139 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:275037011 (275.0 MB)  TX bytes:275037011 (275.0 MB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:127.0.0.2  P-t-P:127.0.0.2  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: 2001:3e6:643:0:2:1:0:57/128 Scope:Global
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:1826058 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1040054 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2360040465 (2.3 GB)  TX bytes:120564554 (120.5 MB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:183.181.101.87  P-t-P:183.181.101.87  Bcast:183.181.101.87  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1


I did some experiments with netcat, and the results are really confusing. I first tried the public ip address on venet0:0 listening on port 80
nc -l 183.181.101.87 80
didn't work, no connection received. Then I tried netcat default ip listening which only port parameter required
nc -l -p 80
it worked, so, with this command running, I want to find out which address it is listening on, I did
netstat -atvn

The result
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:8022          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:3843            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
...
tcp6       0      0 :::25                   :::*                    LISTEN
tcp6       0      0 :::3843                 :::*                    LISTEN

It shows netcat is listening on 0.0.0.0, I guess all program without requiring a specific listening address is setting default to 0.0.0.0, and all addresses will be included.
Then I tried to give 0.0.0.0 as a specified address to netcat
nc -l 0.0.0.0 80
Something strange happened, in netstat, it shows
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:8022          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:3843            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:45690              0.0.0.0:*               LISTEN
...
tcp6       0      0 :::25                   :::*                    LISTEN
tcp6       0      0 :::3843                 :::*                    LISTEN


Apparently port 80 becomes 45690, and this port is random. I also tested with other programs, this random port changing issue seems not happening. When I tried to connect netcat with my browser via port 45690, it shows
invalid connection to [183.181.101.87] from (UNKNOWN) [101.229.171.186] 31559
and ended.

If I do
nc -l -p 45690
connection from a browser gives something similar to
GET / HTTP/1.1
Host: 183.181.101.87:45690
Connection: keep-alive
...
which is successful one.

I am not sure what happened here, and for other programs, even if the listening port is not randomized, I cannot establish any connection.

Any suggesions? Thank you
 
Read Message
Read Message
Read Message
Previous Topic: Cannot find a valid baseurl for repo: base0
Next Topic: Unable to access vz.repo from VM, but works on host node
Goto Forum:
  


Current Time: Sun Aug 11 08:21:29 GMT 2024

Total time taken to generate the page: 0.02948 seconds