I want to remotely login a Ubuntu Router via OpenSSH but when I type the following to login, I cannot get back any response from the Ubuntu Router in the command line.
ssh [email protected]
- Login the Ubuntu Router via SSH from a host behind the Ubuntu Router ⇒ Fail
- Login the Ubuntu Router via SSH from a host outside the router private network
192.168.1.0
⇒ Fail
IPs of the Ubuntu Router
# External
IP Address: XXX.XXX.XXX.XXX
# Internal
IP Address: 192.168.1.1
Testing
Then, I tried the followings to test.
- Login the Ubuntu Router via SSH in the Ubuntu Router itself ⇒ Success
- Ping
XXX.XXX.XXX.XXX
from a host behind the Ubuntu Router ⇒ Success - Ping
192.168.1.1
from a host behind the Ubuntu Router ⇒ Success - Ping
8.8.8.8
from a host behind the Ubuntu Router ⇒ Success - Ping
XXX.XXX.XXX.XXX
from a host outside the router private network192.168.1.0
⇒ Success
Therefore, I concluded that the package can reach the Ubuntu Router but it cannot trigger the SSH response for requesting password for login. After tried the following command to unblock port 22 by the iptables (1), the problem still not solved.
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
Question
How to successfully login the Ubuntu Router via SSH?
Reference
- IPTables rule to allow incoming SSH connections
https://unix.stackexchange.com/a/136204/48296
You have no iptables rule allowing incoming ssh connections:
The line you quote above will allow
sshd
to respond to incoming ssh connections (if the responses were otherwise blocked), but will not allow remote clients to establish a connection.