nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Iptables

This is a discussion on Iptables within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; Hi All, I am george. I am trying to write some iptable rules to allow traffic from one network to ...


Go Back   nixCraft Linux Forum > Linux Distribution > CentOS / RHEL / Fedora

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 11-27-2007, 05:16 PM
Junior Member
User
 
Join Date: Nov 2007
My distro: Fedora core 6, RHEL
Posts: 1
Rep Power: 0
nixsen is on a distinguished road
Default Iptables

Hi All,

I am george. I am trying to write some iptable rules to allow traffic from one network to another. my set up is as follows:

1. I have a linux box(FC6) with 2 ethernet cards ( eth0 and eth1) with IP forwarding enabled.

2. IP address eth0 : 192.168.8.1/24, eth1 : 192.168.9.1/24
3. I have 1 node each on both the networks with IP addresses 192.168.8.2 and 192.168.9.2 respectively.
4. I can ping the linux box from my nodes and i can reach the nodes from my linux box.

My Requirement:
-------------------
I want to ping from 192.168.9.2 to 192.168.8.2. How do i allow this traffic on my linux box using the FORWARD chain in iptables. Currently i have written the following rule which is not working:

iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT.

my default policy of the FORWARD Chain is to DROP everything.

Also i would like to know to forward packets based on some network services like WEB, MAIL etc. Also suggest me some good books on IPTABLES.

Anyone please help me.

Thanks & Regards,
George
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-28-2007, 01:57 PM
Junior Member
User
 
Join Date: Nov 2007
My distro: RedHat
Posts: 1
Rep Power: 0
drunkendog is on a distinguished road
Default

Not sure about the Firewall part you did, but to forward packets between two networks through a linux box, you have to enable ip_forward in it

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

This enables the ip forwarding till next reboot, to make this packet forwarding permanent

# vi /etc/sysctl.conf
change the line net.ipv4.ip_forward = 0 to net.ipv4.ip_forward=1.

This should do the stuff, to check if your iptables rules works correctly.
First turn the iptables off
# service iptables off
#iptables -F

then try pinging between the boxes, if ping is successful, then turn the iptables on and edit the rule as needed, and verify.

Meanwhile, i will try to figure out the rule which will help you.

Cheers
DD
Reply With Quote
  #3 (permalink)  
Old 11-29-2007, 03:01 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 481
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

How to setup Linux as a router for DSL, T1 line etc
__________________
May the force with you!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
iptables help vitaminme Networking, Firewalls and Security 1 09-04-2007 02:42 AM
IPTABLES Help asim.mcp Linux software 3 07-08-2006 02:53 AM
IPTABLES help vasanth Linux software 1 03-09-2005 09:15 AM


All times are GMT +5.5. The time now is 12:18 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36