LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-09-2002, 01:45 PM   #1
tontod
LQ Newbie
 
Registered: May 2002
Distribution: Redhat 7.3
Posts: 7

Rep: Reputation: 0
Question Question about iptables


I'm having a problem setting up port forwarding using iptables in redhat 7.3 . I went to ipmasq.cjb.net and followed the HOWTO instructions, it still dosent work.


#Load the NAT module (This pulls in all the others).
#modprobe iptable_nat

EXTIF=ppp0
INTIF=eth1

IPTABLES=/sbin/iptables
/sbin/depmod -a
/sbin/insmod ip_tables
/sbin/insmod ip_conntrack
/sbin/insmod ip_conntrack_ftp ports=21,500
/sbin/insmod iptable_nat
/sbin/insmod ip_nat_ftp
echo " clearing any existing rules and setting default policy.."

PORTFWIP="192.168.0.2"

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p tcp \
--dport 500 -m state \
--state NEW,ESTABLISHED,RELATED -j ACCEPT

$IPTABLES -A PREROUTING -t nat -p tcp -d $EXTIP --dport 500 \
-j DNAT --to $PORTFWIP:500



$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

echo " FWD: Allow all connections OUT and only existing and related ones IN"
$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 LOG

echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

echo -e "\nrc.firewall-2.4 v$FWVER done.\n"


#Turn on IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward



When I run the file, i dont get errors except the lines with the port forwarding, I get this error:
Bad argument `500'

Anyone have any ideas why? Let me know, thanks.






 
Old 06-10-2002, 07:08 AM   #2
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
hmm
1.) your variable $EXTIP isn't defined
2.) you are defining rules, and then wipining out??
.
need to take a look what are you doing.
otherwise it should work somehow
 
Old 06-10-2002, 04:52 PM   #3
tontod
LQ Newbie
 
Registered: May 2002
Distribution: Redhat 7.3
Posts: 7

Original Poster
Rep: Reputation: 0
iptables

I changed the $EXTIP to $EXTIF, but now it says host/network ppp0 not found. I also commented out the 7 lines of iptables.
 
Old 06-10-2002, 05:03 PM   #4
tontod
LQ Newbie
 
Registered: May 2002
Distribution: Redhat 7.3
Posts: 7

Original Poster
Rep: Reputation: 0
iptables

I was defining it twice because that's how it was on ipmasq.cjb.net. I still get ppp0 not found, which does not make sense, since ppp0 is listed if i do ifconfig.
 
  


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
iptables question iomari Linux - Security 4 01-13-2005 12:14 AM
Iptables Question? unixfreak Linux - Security 1 09-01-2004 08:23 PM
iptables Question gauge73 Linux - Networking 3 12-14-2003 12:02 AM
IPtables Question jacovds Linux - Security 10 11-17-2003 09:46 AM
iptables question Texicle Slackware 7 01-19-2003 12:48 AM

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

All times are GMT -5. The time now is 05:15 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