I have an SSH server I would like to connect to from my Android.
I created SSH keys and everything is working fine. My cellphone connects to my server via SSH. No problem there.
The problem starts when I enable my iptables
firewall. At this point, my firewall is refusing connections coming from my Android.
On my Android I'm using Termux. When in Termux, I can find my public IP address with
curl -4 icanhazip.com
It says my public IP for my Android is x.x.121.3
. I obfuscated the address here but in the actual iptables
configuration it is exact. This is the configuration:
Chain INPUT (policy DROP 7530 packets, 338K bytes)
pkts bytes target prot opt in out source destination
3 180 ACCEPT tcp -- * * x.x.161.85 0.0.0.0/0 tcp dpt:22 state NEW
1 60 ACCEPT tcp -- * * x.x.134.54 0.0.0.0/0 tcp dpt:22 state NEW
0 0 ACCEPT tcp -- * * x.x.121.3 0.0.0.0/0 tcp dpt:22 state NEW
0 0 ACCEPT tcp -- * * x.x.136.182 0.0.0.0/0 tcp dpt:22 state NEW
857 4470K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
12 986 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
650 81372 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state NEW,RELATED,ESTABLISHED
0 0 ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
What am I doing wrong? How to allow SSH connections coming from my cellphone?