Opening Linux firewall for sshd - TechRepublic
General discussion
August 3, 2003 at 06:28 PM
d_ellis

Opening Linux firewall for sshd

by d_ellis . Updated 22 years, 10 months ago

I need some help with my firewall. At the moment I have a Linux server as a gateway for my home network. The current firewall blocks all incoming ports and only allows incoming when initiated from within my firewall.

My access to the Internet is via a cable modem. The IPS blocks all ports from 0 through 1024.

I would like to access my home network from the Internet using ssh. However, the blocked ports require me to change the sshd port to something above 1024, say 22022. I can access the server from within my home network with the sshd port set to 22022. My first try to open the firewall was to modify my firewall with

$IPTABLES ?A INPUT -I $INTIF ?p tcp ?m tcp ?dport 22022 ?syn ?j ACCEPT

This does not work and the firewall reports a connection dropped as

Jul 30 21:29:28 kernel: IN=eth0 OUT= MAC=00:02:e3:09:c8:34:00:30:b8:80:34:fe:08:00 SRC=YYY.YYY.YYY.YYY DST=XXX.XXX.XXX.XXX LEN=60 TOS=0x00 PREC=0x00 TTL=50 ID=27094 DF PROTO=TCP SPT=1047 DPT=22222 WINDOW=5840 RES=0x00 SYN URGP=0

Where XXX and YYY are just IP addresses.

Any help will be appreciated.

This discussion is locked

All Comments