LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-26-2006, 01:37 PM   #1
rubenscript
LQ Newbie
 
Registered: Dec 2005
Location: Romania
Distribution: CentOS 6 (2.6.32-279.el6.x86_64)
Posts: 18

Rep: Reputation: 0
Unhappy iptables with port forwarding problem ... please help me


Hi.
I have a linux router running CentOS 4.2. I want to redirect all trafic coming on eth1 (external interface) to an internal computer (through eth0), say 192.168.0.1
How can I do that ? I tried many rules, but none worked. Please help me ... I'm confident that this forum has smart guys to answer this question. Below is my firewall and routing script, without any port forwarding rules, because they don't work. I searched the forum, tried that rules, but still not working. please tell me what rule I have to add.
Thanxs in advance.


I A /etc/rc.firewall (sh) Row 1 Col 1 10:12 Ctrl-K H for help
#!/bin/sh
iptables -F

# Trimitem orice ... acceptam numai ce vrem
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

# Reguli propriu zise ...

iptables -A INPUT -p tcp -m multiport --dport 21,53,80,110,143,411,443,6238,8008 -j ACCEPT
iptables -A INPUT -p tcp --syn --dport 25 -j ACCEPT
iptables -A INPUT -p tcp --syn --dport 53 -j ACCEPT
iptables -A INPUT -p tcp --syn --dport 80 -j ACCEPT

# Lasam sa mearga orice pe localhost
iptables -A INPUT -m state --state "ESTABLISHED,RELATED" -j ACCEPT

# DoS
iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT

# The thing that actually does NAT !
iptables -t nat -F
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/ip_dynaddr
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ip_nat_irc
iptables -A INPUT -i eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -o eth1 -j SNAT --to-source 81.196.xxx.xx
 
Old 04-26-2006, 04:51 PM   #2
rubenscript
LQ Newbie
 
Registered: Dec 2005
Location: Romania
Distribution: CentOS 6 (2.6.32-279.el6.x86_64)
Posts: 18

Original Poster
Rep: Reputation: 0
Can anyone help me please ?
 
  


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
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
iptables problem.....port forwarding..... shahg_shahg Linux - Networking 1 03-22-2006 05:17 AM
IPTables port forwarding problem deadlydemon Linux - Security 2 04-25-2005 04:43 PM
iptables + NAT + Port forwarding problem SirGertrude Linux - Networking 9 05-14-2004 04:02 AM
IPTables Port Forwarding Problem delusi0n Linux - Networking 0 10-02-2001 01:34 AM

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

All times are GMT -5. The time now is 01:34 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
Open Source Consulting | Domain Registration