LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 03-29-2012, 08:15 AM   #1
BlackBull
LQ Newbie
 
Registered: Sep 2007
Posts: 1

Rep: Reputation: 0
RST in reply to SYNACK with iptables rules


Hi All,
I need help in configuring iptables.
I have a gentoo server with eth0 (Public network interface) and eth1 (internal LAN interface).

I have to listen to a socket on eth0 and forward all the incoming tcp conections(New, established, related) to a host connected to eth1.


The following are the iptables rules;
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 10.184.19.28 --source 167.156.144.179 --dport 13566 -j DNAT --to-destination 8.8.8.1:18562
iptables -A FORWARD -p tcp -i eth0 -o eth1 -d 8.8.8.1 --dport 18562 -j ACCEPT
iptables -A FORWARD -p tcp -i eth1 -o eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -p tcp -o eth1 -d 8.8.8.1 --dport 18562 -j SNAT --to-source 10.184.19.28:15460

I face this issue.
When a new incoming connection on eth0 is received, the iptables rules can successfully forward the SYN to my host in the LAN and the host successfully replies with a SYNACK.

However, my gentoo box, on receiving SYNACK, terminates the connection with RST.

Did I miss anything in the iptables rules?
 
Old 03-29-2012, 05:23 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Your Gentoo box is the one providing NAT services, then?

I haven't done NAT on GNU/Linux, but my WAG is you need an explicit ESTABLISHED,RELATED rule. Otherwise, the NAT server sees at as an unwanted, unsolicited packet.
 
Old 03-30-2012, 10:13 AM   #3
WizadNoNext
Member
 
Registered: Nov 2009
Posts: 140

Rep: Reputation: 9
By my liking it is completely wrong. Why you need NAT for this IP/port?
Actually RST to SYN/ACK is expected behaviour and your IPtables rules actually allows kernel to send RST in response to unsolicited SYN/ACK (it is unsolicited SYN/ACK, because of your weird NAT).

Actually you do trick to prevent it.

Best way is to do it with IPtables:
Code:
iptables -A FORWARD -p tcp -i eth0 -o eth1 -d 8.8.8.1 --dport 18562 -m -m tcp --tcp-flags FIN,SYN,RST,ACK SYN,ACK -j ACCEPT
It should work
 
  


Reply



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
Restore iptables Rules that have been saved with iptables-save tiuz Linux - Security 4 08-14-2010 05:50 PM
syn synack rst ahsansaifi Linux - Networking 2 03-24-2009 01:39 AM
iptables 1.27a still loading rules after installing iptables 1.3.0 yawe_frek Linux - Software 1 06-07-2007 09:50 PM
How to make iptables(NAT) not to send RST back attojung Linux - Networking 2 01-10-2007 07:46 AM
IPTABLES - rules in /etc/sysconfig/iptables The_JinJ Linux - Newbie 6 11-20-2004 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:20 PM.

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
Open Source Consulting | Domain Registration