PDA

View Full Version : [SOLVED] SSH Connection Refused



nvdkgm
March 21st, 2011, 11:05 PM
I know someone has probably asked this question before but I will again.
Why am I getting port 22 connection refused?

I have a Ubuntu desktop and laptop that has OpenSSH Client and Server installed. I want the desktop to be the host and have set the desktop local IP or network address to be static and set a port forwarding rule on the router that public IP to local static IP on port 22 to 22 for TCP and UDP. I figure port 22 is opened when needed and closed otherwise, I could be wrong. I do not know about firewall setting but when I checked "iptables --list" it shows all as Accept. Both computers ssh 127.0.0.1 fine with both client and server installed.

Both computers are on in the local network and I am trying to ssh from the laptop to the desktop.
What is the missing step?

conneco
March 21st, 2011, 11:15 PM
You don't need port forwarding if your in the same LAN port forwaring is for going across the internet so say you were in one house and you want to ssh to a computer in another house using the Internet.

nvdkgm
March 21st, 2011, 11:17 PM
Well thats the idea. But I want to be able to ssh into the desktop now while in the LAN before going out. I thought it was working already but I keep getting connection refused so I am wondering what I need to change to make it work now and for later when I am outside the LAN.

spiky001
March 21st, 2011, 11:22 PM
What are you putting in terminal?

nvdkgm
March 21st, 2011, 11:25 PM
ssh [public ip]
I have also tried it with -X -l [user name]

spiky001
March 21st, 2011, 11:28 PM
have you used the local ip
ssh username@local ip It might be worth installing GUFW to help set the firewall up

nvdkgm
March 21st, 2011, 11:36 PM
Okay. I can connect to the computer which resolves the original question and I take it that is because I am in LAN and use the public IP when I am outside the network, right? (edited out. ssh -X forwards windows to open files which is also what I need in the command.)

And also you mentioned something about a firewall. How do I set up that to protect the connection?

spiky001
March 21st, 2011, 11:39 PM
Cant help you with the X part. I use GUFW it,s in the resportories it,s a graphical front for iptables