LinuxQuestions.org
Help answer threads with 0 replies.
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 04-07-2005, 12:34 PM   #1
stakhous
Member
 
Registered: May 2003
Location: PA
Posts: 82

Rep: Reputation: 15
2 NIC's stopped routing, iptable problem?


Hi, I know this type of thread as been posted many times, but specifically for JordanH, the following is the output to various commands. Again, I am having problems with eth1 being able to contact the network on eth0. I have a windows computer at 10.51.1.100 connected to eth1(RH box, 10.51.1.1) with a crossover cable. From there eth0(192.168.1.107) is connected to a switch which in turn is connected to linksys router. I can no longer get 10.51.1.100 to connect to the outside 192.168.1.0/24 network.

Ive made sure ip_forward is at 1. I think i might need to add another route.


iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state NEW,RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


/sbin/service iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 10.51.1.0/24 anywhere to:192.168.1.107
MASQUERADE all -- 10.51.1.0/24 192.168.1.0/24

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state NEW,RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

/sbin/route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.51.1.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:41:1EC8
inet addr:192.168.1.107 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1546 errors:0 dropped:0 overruns:0 frame:0
TX packets:303 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:148554 (145.0 Kb) TX bytes:27838 (27.1 Kb)
Interrupt:11 Base address:0xc00

eth1 Link encap:Ethernet HWaddr 00:40:33:A3:37:0F
inet addr:10.51.1.1 Bcast:10.51.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:4 dropped:0 overruns:0 carrier:4
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:9 Base address:0x2800

Thanks for everyone's help so far on this Issue, especially JordanH.

Cheers
 
Old 04-07-2005, 06:06 PM   #2
JordanH
Member
 
Registered: Oct 2003
Location: Toronto, Canada
Distribution: Ubuntu, FC3, RHEL 3-4 AS Retired: SuSE 9.1 Pro, RedHat 6-9, FC1-2
Posts: 360

Rep: Reputation: 30
Start by clearing all from your iptables. I think your SNAT is killing you.
Try this script... it is completely open and not a firewall. It clears out all the junk so we can start fresh. It does not masquerade but it does forward traffic (i.e. routing between the two networks).
Quote:
#!/bin/bash
echo "1" > /proc/sys/net/ipv4/ip_forward
ipt=/sbin/iptables

# Set policies
$ipt -P INPUT ACCEPT
$ipt -P FORWARD ACCEPT
$ipt -P OUTPUT ACCEPT

# Delete table rules, chains and counters
for table in filter nat mangle
do
$ipt -t $table -F # flush
$ipt -t $table -X # delete
$ipt -t $table -Z # zero
done

$ipt -t nat -A POSTROUTING -o eth0 -j MASQUERADE
edit: changed the last line of the script to masquerade through eth0

Your routing table looks fine.
(sorry for my long delay, they actually made me *DO* work today. )

p.s. if this does not work this time, please post the results of
/sbin/service iptables status

Last edited by JordanH; 04-07-2005 at 06:29 PM.
 
Old 04-07-2005, 06:15 PM   #3
stakhous
Member
 
Registered: May 2003
Location: PA
Posts: 82

Original Poster
Rep: Reputation: 15
Hey dont worry about the long delay, I appreciate your help!

Ok I cleared the iptables out and ran your script, here is the ouput:

/sbin/service iptables status
Table: mangle
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Table: nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Then I ran:

ping google.com -I eth1
PING google.com (216.239.39.99) from 10.51.1.1 eth1: 56(84) bytes of data.
From 10.51.1.1 icmp_seq=1 Destination Host Unreachable

Looks like still no luck.

Cheers
 
Old 04-07-2005, 06:20 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Forgive me here, but why would you not connect both computers to the switch which is then connected to the router as you say? The router should do a good job of a firewall setup for you.
 
Old 04-07-2005, 06:22 PM   #5
JordanH
Member
 
Registered: Oct 2003
Location: Toronto, Canada
Distribution: Ubuntu, FC3, RHEL 3-4 AS Retired: SuSE 9.1 Pro, RedHat 6-9, FC1-2
Posts: 360

Rep: Reputation: 30
Whoa... wait a minute. I may have goofed. In the other thread, I thought you were just trying to connect the two networks. What you want to do is a little masquerading... It must have been a long day for me.

I have updated the script above... check out the LAST line I added.

The following thread will shed some light.
http://www.linuxquestions.org/questi...hreadid=140064
http://www.linuxquestions.org/questi...hreadid=115427
(if you search on my name and choose "older than one year", you'll hit tonnes of these threads)
 
Old 04-07-2005, 06:27 PM   #6
JordanH
Member
 
Registered: Oct 2003
Location: Toronto, Canada
Distribution: Ubuntu, FC3, RHEL 3-4 AS Retired: SuSE 9.1 Pro, RedHat 6-9, FC1-2
Posts: 360

Rep: Reputation: 30
Quote:
Originally posted by Brian1
Forgive me here, but why would you not connect both computers to the switch which is then connected to the router as you say? The router should do a good job of a firewall setup for you.
Perhaps. Do you trust the Linksys router with your firewall setup? Some do, some don't. *shrug*

You can config it this way...

Internet -- modem -- linksys -- linux router -- internal lan (this is the current config, no?)
or
Internet -- modem -- linux router -- internal lan (take out the middle man)
or
Internet -- modem -- linksys -- internal lan (windows and linux now both reside on same internal network) This is assuming that the linksys is a multiport hub/switch as well as router. If Stakhous is limited by not owning a switch and the linksys is a single-port unit, this last config won't work.

In my case at home, I do not have a linksys device so I use option 2... *shrug* too each their own.
 
Old 04-07-2005, 06:34 PM   #7
stakhous
Member
 
Registered: May 2003
Location: PA
Posts: 82

Original Poster
Rep: Reputation: 15
Forgive me, I probably should have been more clear.

And sure the linksys router does a good job filtering out traffic. But managing a linux router is a great learning process. I get to mess with IDS's, iptables, etc.

I made the approriate change in the bash script, but still no luck. But i'll look over those threads you posted.

Thanks again
 
Old 04-10-2005, 04:46 PM   #8
JordanH
Member
 
Registered: Oct 2003
Location: Toronto, Canada
Distribution: Ubuntu, FC3, RHEL 3-4 AS Retired: SuSE 9.1 Pro, RedHat 6-9, FC1-2
Posts: 360

Rep: Reputation: 30
Any luck?
 
  


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
iptable routing help DarkCaesar Linux - Networking 11 09-17-2004 06:54 AM
samba and ip masquerading = iptable/routing conflict? wlfdgcrkz Linux - Software 5 04-26-2003 04:11 PM
Problem getting 2 NIC's working campo Linux - Networking 9 01-30-2003 02:24 PM
Problem setting up two NIC's Ryan_Sutton Linux - Networking 1 05-29-2002 08:43 AM
Problem with 2 NIC's BadSeed Linux - Networking 7 08-16-2001 10:27 PM

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

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