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 01-05-2005, 08:23 AM   #1
RajaRC
Member
 
Registered: Feb 2003
Distribution: Redhat
Posts: 58

Rep: Reputation: 15
Routing and IPtables problem


Hi,

I am trying to configure Iptables on Redhat Linux. Since I am very much new to Iptables I am finding it difficult to get it working even after going through the manuals of IPtables.

The setup as below.

The Internal interface eth0 – 192.168.4.x
The External interface eth1 – 192.168.2.x

The IP Address of the system is – 192.168.4.y

I have connected a system directly to the eth0 using a cross-over cable. The eth1 is directly connected to external world i.e. router (internet).

The traffic reached upto eth1. It doesn’t reach the router.

I am able to ping eth0 and eth1 from the connected system. It seems the routing or the ip forwarding is not working properly.

I have checked by disabling IPtables, but still it doesn’t work.

Can I configure it as a route?

Is there any network related configuration I need to check or make.

Also please can anyone help me in configuring the IPtables.

Regards
 
Old 01-05-2005, 08:34 AM   #2
kopikat
Member
 
Registered: Dec 2004
Location: Argentina
Distribution: Slack 10
Posts: 45

Rep: Reputation: 15
Are you using a adsl or dsl to connect to the internet??
if so, are you using a pppoe client?

A couple of days ago I had the same problem as you. It turned out that when I connected to the internet using adsl with a pppoe client, even thoung I was physically connected to the modem via eth0, once I started the pppoe client a device called ppp0 was created, by which I connected to the internet. So all I had to do was replace in my iptables config file eth0 for ppp0, and everything worked fine.
Maybe that will help.
 
Old 01-05-2005, 08:41 AM   #3
RajaRC
Member
 
Registered: Feb 2003
Distribution: Redhat
Posts: 58

Original Poster
Rep: Reputation: 15
my router is connected to internet through leased line which has got a fixed static ip. Also the routing at the router has been taken care properly.

I can ping to the external interface - eth1 of the linux box, but it i cannot ping to the internal interface of the router i.e i cannot ping any web site such as cisco.com
 
Old 01-05-2005, 12:55 PM   #4
kopikat
Member
 
Registered: Dec 2004
Location: Argentina
Distribution: Slack 10
Posts: 45

Rep: Reputation: 15
Quote:
Originally posted by RajaRC
my router is connected to internet through leased line which has got a fixed static ip. Also the routing at the router has been taken care properly.

I can ping to the external interface - eth1 of the linux box, but it i cannot ping to the internal interface of the router i.e i cannot ping any web site such as cisco.com
Does your router have an IP? Cause if it has, then you should specify that Ip as gateway.
 
Old 01-06-2005, 02:09 AM   #5
RajaRC
Member
 
Registered: Feb 2003
Distribution: Redhat
Posts: 58

Original Poster
Rep: Reputation: 15
My configuration as below --

The default gateway for eth0 is eth1

The default gateway for eth1 is my router's ip address

Still it doesn't work. I think routing is not working. Can u please help?
 
Old 01-06-2005, 07:52 AM   #6
RajaRC
Member
 
Registered: Feb 2003
Distribution: Redhat
Posts: 58

Original Poster
Rep: Reputation: 15
I managed to do some configuration changes -

Now I am able to ping from my local lan to external interface i.e eth1 of my linux box. But I cannot ping to internet.

If I ping www.cisco.com, I get this error - unknown host www.cisco.com

The /etc/resolve.conf contains all my dns server ip addresses. The dns server are of my isp

Please anyone can help me.

Regards,
 
Old 01-06-2005, 09:23 AM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
what does
Code:
cat /proc/sys/net/ipv4/ip_forward
say?
 
Old 01-06-2005, 10:41 PM   #8
RajaRC
Member
 
Registered: Feb 2003
Distribution: Redhat
Posts: 58

Original Poster
Rep: Reputation: 15
The output of - cat /proc/sys/net/ipv4/ip_forward

1

The output of - iptables -L -n -v

Chain INPUT (policy ACCEPT 56439 packets, 4753K bytes)
pkts bytes target prot opt in out source destination

0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0
state INVALID LOG flags 0 level 4 prefix `INVALID input: '

Chain FORWARD (policy ACCEPT 3191 packets, 718K bytes)
pkts bytes target prot opt in out source destination


Chain OUTPUT (policy ACCEPT 50709 packets, 3357K bytes)
pkts bytes target prot opt in out source destination

1961 205K LOG all -- * eth0 0.0.0.0/0 0.0.0.0/0
LOG flags 0 level 4
2254 141K LOG all -- * eth1 0.0.0.0/0 0.0.0.0/0
LOG flags 0 level 4

Please let me know if I need to configure anything else.

Regards,
 
Old 01-07-2005, 08:19 AM   #9
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
OK... sounds like you are having a masquerading problem. How about the output of
Code:
iptables -t nat -L -v
?
 
Old 01-09-2005, 11:37 PM   #10
RajaRC
Member
 
Registered: Feb 2003
Distribution: Redhat
Posts: 58

Original Poster
Rep: Reputation: 15
The output is -


Chain PREROUTING (policy ACCEPT 154 packets, 12104 bytes)
pkts bytes target prot opt in out source destination


Chain POSTROUTING (policy ACCEPT 142 packets, 9165 bytes)
pkts bytes target prot opt in out source destination


Chain OUTPUT (policy ACCEPT 142 packets, 9165 bytes)
pkts bytes target prot opt in out source destination

Regards,
 
Old 01-10-2005, 07:17 AM   #11
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
The problem is that you don't have a MASQUERADE rule in the POSTROUTING table.

Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
or is it eth1? Can't remember. It's the interface connected to the router.

Last edited by eantoranz; 01-10-2005 at 07:18 AM.
 
  


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
routing by iptables ali_dd15 Linux - Networking 14 10-14-2005 05:38 AM
iptables/routing problem Mephisto123 Linux - Networking 1 07-18-2005 07:50 AM
iptables routing CJ_Grobler Linux - Security 1 06-14-2005 02:13 AM
More Help routing with iptables LAR12345 Linux - Networking 2 02-02-2003 10:28 AM
routing with iptables Han_Solo Linux - Security 0 10-28-2001 06:04 PM

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

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