LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-26-2009, 02:33 PM   #1
arty
Member
 
Registered: Nov 2008
Posts: 66

Rep: Reputation: 17
Lightbulb problem with linux router with 2 interfaces


hello guys,

something very wierd is going on and i don't know if anybody can help me on this

i have the following setup
CentOS 5.3(clean installation)
eth0 is my lan interface
eth2 is my internet interface
DMZ is set to the ADSL modem/router for interface eth2 of linux
dhcpd running on eth0
eth2 is set to be configured with dhcp getting it from the modem/router(the dhcp address is the internet address not from router's dhcpd,due to DMZ set on the linux box)


i have set in /etc/sysctl.conf
net.ipv4.ip_forward = 1

and have added the following rules in iptables:
iptables --append FORWARD --in-interface eth0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADE

the box pass all data from eth0 to eth2
and internet works
and lan works perfectly

now the problem:
from time to time and for a wierd reason
this stops working
meaning i can connect from another lan machine using ssh for example to the internal interface
but internet stops working
this is verified by wireless client connected directly to the router with dhcp enabled

i can't figure out what's going on
i even changed the internet NIC(used to be eth1)

any clues guys?
any help is really appreciated
 
Old 06-27-2009, 02:34 AM   #2
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
When you are having trouble, try clearing out all the firewall rules and see if the problem is still there, if it is not, then you may just have some iptables rules that maybe causing a conflick somewhere.

You this to clear all the iptables rules.

Quote:
iptables -F
iptables -F -t mangle
iptables -F -t nat
iptables -X
iptables -X -t mangle
iptables -X -t nat

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

If the problem is still there, it maybe a routing problem, you can check the output of the routing table with (as root).

Quote:
route -n

Last edited by fotoguy; 06-27-2009 at 02:35 AM.
 
Old 06-27-2009, 08:39 AM   #3
arty
Member
 
Registered: Nov 2008
Posts: 66

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by fotoguy View Post
When you are having trouble, try clearing out all the firewall rules and see if the problem is still there, if it is not, then you may just have some iptables rules that maybe causing a conflick somewhere.

You this to clear all the iptables rules.




If the problem is still there, it maybe a routing problem, you can check the output of the routing table with (as root).
i have already tried that fotoguy
the rules that i show here are the only rules applied in the firewall
 
Old 06-27-2009, 12:52 PM   #4
intermod
LQ Newbie
 
Registered: Oct 2003
Location: Pleasanton, CA USA
Posts: 13

Rep: Reputation: 0
I have a PC configured as a linux router RH9, but with:

eth0 extint WAN
eth1 intif 192.168 /24
eth2 intif1 10.0 /8


I am using an old rc.firewall-2.4 script from years ago.

Could not ping or SSH into a box on the 10.0 from the 192.168. FOTOGUY suggested clearing the firewall - bingo. This enabled this traffic. The two lines I added to my firewall script to enable eth1<>eth2 traffic:

$IPTABLES -A FORWARD -i $INTIF -o $INTIF1 -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF1 -o $INTIF -j ACCEPT


intermod

Last edited by intermod; 06-27-2009 at 02:24 PM.
 
Old 06-28-2009, 01:39 PM   #5
arty
Member
 
Registered: Nov 2008
Posts: 66

Original Poster
Rep: Reputation: 17
now it seems to be working for about 24 hours
i will wait to see what will happen and i will let you know
thanks a lot guys :-)
 
Old 06-30-2009, 01:48 AM   #6
arty
Member
 
Registered: Nov 2008
Posts: 66

Original Poster
Rep: Reputation: 17
i managed to find what's the problem
you can't believe this but for a wierd reason my isp changes the gateway so i have to renew with dhcp in order to get the new gateway(note that my ip is static)
i will have to contact them to clear this out
 
Old 07-01-2009, 05:49 AM   #7
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
Quote:
Originally Posted by arty View Post
i managed to find what's the problem
you can't believe this but for a wierd reason my isp changes the gateway so i have to renew with dhcp in order to get the new gateway(note that my ip is static)
i will have to contact them to clear this out
Well it's good to hear you have found the cause.
 
  


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
changed router wireless essid, /etc/network/interfaces no longer works! snow_bound Linux - Wireless Networking 0 12-29-2006 06:21 AM
Qos,router with 2 interfaces (lan+internet) problem Dimitris_Papadakis Linux - Networking 0 02-02-2006 09:21 AM
Problem with the interfaces... Tomanas Slackware 1 10-09-2005 12:38 PM
Problem with routing between interfaces Kostko Linux - Networking 6 12-01-2003 01:47 PM
Problem forwarding between interfaces wlewis Linux - Networking 13 09-15-2002 07:12 PM

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

All times are GMT -5. The time now is 04:20 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
Open Source Consulting | Domain Registration