So, I had to rebuild my RH9 machine after a hardware fault and chose CentOS 4.4. All was looking good and then I realised I didn't have a backup of my firewall script. No big deal, I used a pretty standard one but the customised NAT/MASQ was not backed up anywhere.
So I have put some NAT/MASQ commands in but I cannot resolve an issue for traffic on one port I am configuring. Although I have put the recommended lines into the script, I can still see packets being dropped in my /var/log/messages file.
Here's the scoop...
ExtIF is eth1 on my gateway, IP xxx.xxx.xxx.xxx
IntIF is eth0 on my gateway, IP 192.168.1.1
IP of my local machine is 22.214.171.124
NAT of 192.168.1.19 to external machines on port 1412
lines in my firewall script for NAT:
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j drop-and-log-it
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $EXTIP
$IPTABLES -t nat -A PREROUTING -i $EXTIF -p tcp -d $EXTIP --dport 1412 -j DNAT --to 192.168.1.19:1412
$IPTABLES -t nat -A PREROUTING -i $EXTIF -p udp -d $EXTIP --dport 1412 -j DNAT --to 192.168.1.19:1412
It would appear that my IP is being forwarded out but traffic returning is being dropped (entries in /var/log/messages):
Oct 13 17:00:00 host kernel: IN=eth1 OUT=eth0 SRC=999.999.999.999 DST=192.168.1.19 LEN=48 TOS=0x00 PREC=0x00 TTL=115 ID=34746 DF PROTO=TCP SPT=2900 DPT=1412 WINDOW=64240 RES=0x00 SYN URGP=0
(actual external IP replaced with 999.999.999.999)
I am unsure whether I need to add other rules regarding established packets etc. but if anyone can enlighten me to my error/omission, I would be grateful.