Access vnc server running in phone via usb tethering

I have a VNC server running in localhost:1 of my Android phone. I want to access the VNC server from my computer, which is connected to the phone via usb tethering.

This is the output of ip route list (I have changed some ip addresses to number1, number2 and number3).

$ ip route list
default via number1 dev enp0s29f7u8 proto dhcp metric 100 
number2 dev enp0s29f7u8 proto kernel scope link src number3 metric 100 

I installed TigerVNC Viewer, and tried connecting to number1:1, number2:1 and number3:1, but all of them showed the error

unable to connect to socket: connection refused (111)
  1. take a highport instead of 1
  2. without the actual IP addresses and netmasks it’s tough to debug ip connectivity issues. If these are public IP addresses, change them to private ones like 10. or 192.168. instead of Number1, 2,3

:man_shrugging:

  1. I will try a different localhost instead of 1
  2. The IP addresses are 192.168.x.x. They are assigned automatically when I turn on USB tethering in the Android phone. I don’t know how to change them.

How do I find them?

These are private IP addresses, not public ones: just give us the gory details because they’re not reachable from the Internet.

This is the output, after connecting the computer to phone via USB tethering. The phone is connected to the internet via a 4G cellular network. There are no other network device/routers.

$ ip route list
default via 192.168.42.129 dev enp0s29f7u7 proto dhcp metric 100 
192.168.42.0/24 dev enp0s29f7u7 proto kernel scope link src 192.168.42.96 metric 100 

Do I need to provide the output of any other command?

You need to find the IP of the Phone which is acting as your router when you are tethered to it.

192.168.42.129

is likely it

It’s external IP may also work - but … going out and back in would be weird when the short way is there.
ip neigh
could supply you with the needed information
as could arp-scan (if you have that installed)

1 Like
$ ip neigh
192.168.42.129 dev enp0s29f7u7 lladdr 92:f3:e4:e2:a7:0d REACHABLE
fe80::b0e3:7fff:fe03:364e dev enp0s29f7u7 lladdr 92:f3:e4:e2:a7:0d router STALE
fe80::7441:bf32:7e50:4c5c dev enp0s29f7u7 lladdr 92:f3:e4:e2:a7:0d router REACHABLE

of course

192.168.42.129

is the only IP in the local network
if you are tethered to it and it is your router

have you tried using that?

2 Likes

Sorry for the delay.

When it is connected to localhost:1, I need to connect to 192.168.42.129:5901 in my computer, where 192.168.42.129 is in the output of ip neigh.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.