LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-18-2006, 03:03 AM   #1
notsosmart
LQ Newbie
 
Registered: Oct 2006
Posts: 6

Rep: Reputation: 0
forwarding packets with iptable and nat


I am trying to write a firewall script to allow packets to be forwarded from one network card eth0 to eth1 - the gateway. Since I do not have routing service set up on the machine, can I use NAT to have iptables route the packets across?

example copied from the www:
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT

Thanks for replying.


NotSoSmart
 
Old 10-18-2006, 03:13 AM   #2
SlackDaemon
Member
 
Registered: Mar 2006
Distribution: RedHat, Slackware, Experimenting with FreeBSD
Posts: 222

Rep: Reputation: 30
You need to enable IP forwarding on your system:

echo 1 > /proc/sys/net/ipv4/ip_forward

This is temporary and will be wiped once you reboot. Depending on your distribution, you can save the change permanently in /etc/sysctl.conf or /etc/rc.d/rc.local.
For Slackware just add the execute permission to /etc/rc.d/rc.ip_forward
 
Old 10-20-2006, 04:07 AM   #3
notsosmart
LQ Newbie
 
Registered: Oct 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks Slackdeamon:
I will give your suggestion a try
 
  


Reply


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
port forwarding using IPTABLE ...( Help) ad2005 Linux - Networking 5 03-15-2006 11:56 PM
Not forwarding packets meadensi Linux - Networking 0 02-08-2005 08:02 PM
how to nat playstation2 packets ( iptables ) nanoprobe Linux - Networking 1 01-23-2005 01:40 PM
IPTable Problems (Port Forwarding)... Arch3Angel Linux - Security 3 12-04-2004 05:56 PM
Iptable NAT issues and DCC Kristijan Linux - Security 9 01-08-2004 08:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration