LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 10-13-2006, 12:31 PM   #1
p-uk
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Rep: Reputation: 0
iptables


Hey

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...

pre-amble:

Code:
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 192.18.1.19
NAT of 192.168.1.19 to external machines on port 1412
lines in my firewall script for NAT:

Code:
$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):

Code:
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.

Thanks

P
 
Old 10-13-2006, 12:44 PM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
The packet example you showed in your log example is a SYN packet which is the first packet of a NEW connection, and you don't have a rule to ACCEPT NEW packets..

The NEW rule needs to be just for that port. Otherwise everything gets in..

A better listing comes from iptables-save.
This shows what is active and in actual sequence..

Last edited by peter_robb; 10-13-2006 at 12:54 PM.
 
Old 10-22-2006, 05:46 AM   #3
p-uk
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks Peter
 
  


Reply

Tags
centos4, firewall, iptables, masquerading


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 09:20 PM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 03:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 07:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 05:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 08:36 AM


All times are GMT -5. The time now is 02:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration