Open Source Technical Information: VNC error unable to connect to host: No route to host (113)-Solved

Tuesday, 14 February 2012

VNC error unable to connect to host: No route to host (113)-Solved

,
 
In VNC while connecting to remote desktop, you may get this errors.

unable to connect to host: No route to host (113)
or
unable to connect to host: Connection refused (111)

Then in host machine iptables is running and is blocking the port 5901. Kill all the vncserver desktop in the host machine and run the following command in the terminal. Type the password for the user when prompted.

$ sudo iptables -I INPUT 1 -p tcp --dport 5901 -j ACCEPT

The above command will add the port 5901 to iptables in accept mode. Now save the iptables and start the vncserver in host machine then try connecting it remotely.

To save the Iptables

Fedora users use the following command to save it.

$ sudo /etc/init.d/iptables save

Ubuntu users do the following steps
Run the following command to save the current rule-set to the file “iptables.rules” in etc directory. Type the password for the user when prompted.

$ sudo sh -c "iptables-save > /etc/iptables.rules"

To apply the rules automatically, modify the interfaces file under /etc/network/ directory and add the below line to the end of your interface. You need to know which interface your using.
 
post-up iptables-restore < /etc/iptables.rules

To add, use the following command. You can use your favorite editor to edit the interfaces file, here i am using gedit.
 
$ sudo gedit /etc/network/interfaces
The above command will open the interfaces file in gedit. Now copy and paste this line “post-up iptables-restore < /etc/iptables.rules” at the end of your interface.
After modification your interfaces file should be looking like this.
 
auto lo 
iface lo inet loopback
post-up iptables-restore < /etc/iptables.rules
or like this
 
auto eth0
iface eth0 inet loopback
post-up iptables-restore < /etc/iptables.rules
Thats it. Hope this will be helpful for you!!!
 


If you found any thing wrong then pleas Let me know ...Write Your tips and suggestion in comment ... Thank you...

0 comments to “VNC error unable to connect to host: No route to host (113)-Solved”

Post a Comment

Write your tips here...

Deal of the Day

Advertisement here

Advertisement here