LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-28-2004, 09:20 AM   #1
ryedunn
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Fedora, ubuntu
Posts: 459

Rep: Reputation: 30
ip tables with MASQUERADE


this should work....what am I doing wrong..

Code:
iptables -t nat -L:
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Looks good right?
now my rc.firewall
Code:
#!/bin/sh

IPTABLES=/sbin/iptables

#flush existing rules
$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD

#Set Default Policies
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP

$IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE

#This allows all data that has been sent out for the computer running the
#firewall to come back (for all of ICMP/TCP/UDP). For example, if a ping
#request is made it will allow the reply back
$IPTABLES -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED -i eth0 -p icmp
$IPTABLES -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED -i eth0 -p tcp
$IPTABLES -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED -i eth0 -p udp

#Accept everything from eth1
$IPTABLES -A INPUT -i eth1 -j ACCEPT
#Forward packets from eth1 through eth0
$IPTABLES -A FORWARD -i eth1 -o eth0 -j ACCEPT
$IPTABLES -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

#Allow incoming FTP requests
$IPTABLES -A INPUT -p tcp --dport 20 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 21 -j ACCEPT

#Allow incoming SSH requests
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT

#Allow incoming HTTP requests (to Web server)
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT

#Drop and log all other data
#The logging is set so if more than 5 packets are dropped in
#three seconds they will be ignored. This helps to prevent a DOS attack
#Crashing the computer the firewall is running on
$IPTABLES -A INPUT -m limit --limit 3/second --limit-burst 5 -i ! lo -j LOG
$IPTABLES -A INPUT -i ! lo -j DROP
I can ping both ways, I can connect to the internet from the linux box, shh works from my xp box.... but I cannot ping anything on the internet from XP...

Im sure my XP box is setup correct as it was working before I bought this new box....

the only thing strange is
Code:
service network restart
Shutting down interface eth0:                                   [  OK  ]
Shutting down interface eth1:                                   [  OK  ]
Shutting down loopback interface:                               [  OK  ]
Setting network parameters:                                     [  OK  ]
Bringing up loopback interface:                                 [  OK  ]
Bringing up interface eth0:                                     [FAILED]
Bringing up interface eth1:                                     [  OK  ]
any suggestions?

Last edited by ryedunn; 03-28-2004 at 09:42 AM.
 
Old 03-28-2004, 04:13 PM   #2
ryedunn
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Fedora, ubuntu
Posts: 459

Original Poster
Rep: Reputation: 30
ok it seems like it works when it wants to...
twice I have been looking at the rc.firewall and it just started working?
very confusing.
 
Old 03-28-2004, 07:40 PM   #3
ryedunn
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Fedora, ubuntu
Posts: 459

Original Poster
Rep: Reputation: 30
ok this is strange

Im an idiot.

Last edited by ryedunn; 03-28-2004 at 07:58 PM.
 
  


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
Masquerade nanoprobe Linux - Networking 7 06-12-2005 08:48 AM
IP Masquerade qbik Slackware 3 09-11-2003 03:02 PM
IP Masquerade help armcfall Linux - Networking 6 06-24-2003 09:06 AM
IP Masquerade problems andrew001 Linux - Networking 2 02-04-2003 06:51 PM
About masquerade Nuts Linux - Networking 8 08-30-2002 09:56 AM

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

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