Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-22-2005, 02:52 AM
|
#1
|
Member
Registered: Jan 2004
Posts: 45
Rep:
|
Linux Gateway with 3 NICs
I have a working linux gateway server, with 2 NIC cards. But, now I have a need for third one, cuz I now administer two seperate netorks - 2 different class IP addresses. I have installed the third NIC but I just cant get the server to route the second network wia 3rd nic. Here is my config in diagram:
ADSL Router(10.0.0.138) --SWITCH-- Server[eth2(10.0.0.80)-eth1(10.40.0.10)-eth0(192.168.1.2)]
Quote:
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.40.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.0.0.138 0.0.0.0 UG 0 0 0 eth2
m
|
I have a masquerade working also:
Quote:
iptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADE
|
Last edited by pin_bk; 03-22-2005 at 07:17 AM.
|
|
|
03-22-2005, 05:08 AM
|
#2
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
Masquerade seems no to work in case of multiple NIC's. You have to do SNAT instead.
ex.:
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to your.public.ip.x
(if eth0 is the NIC connected to your modem/router)
|
|
|
03-22-2005, 05:15 AM
|
#3
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
The point is that the public IP is on the router which handles NAT, so will the SNAT thing work?
Last edited by pin_bk; 03-22-2005 at 05:16 AM.
|
|
|
03-22-2005, 06:14 AM
|
#4
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
If masquerade works, then snat will surely works.
|
|
|
03-22-2005, 07:14 AM
|
#5
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
I first do a flush:
Quote:
# iptables --table nat --flush
|
then:
Quote:
# iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to MY.PUBLIC.IP.X
|
still it doesnt work.
Last edited by pin_bk; 03-22-2005 at 07:16 AM.
|
|
|
03-22-2005, 07:25 AM
|
#6
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
When I use SNAT instead of MASQUERADE for LAN1 - 10.40.0.0 it works:
Quote:
iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to 10.0.0.80
|
But for the LAN2 - 192.168.1.0 it dowsnt.
|
|
|
03-22-2005, 07:35 AM
|
#7
|
Member
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384
Rep:
|
Hi,
here's what I use :
iptables -t nat -I POSTROUTING -o $EXT_IFACE -s $LAN_INT -j MASQUERADE
iptables -t nat -I POSTROUTING -o $EXT_IFACE -s $LAN_DMZ -j MASQUERADE
I just don't know why I didn't use only
iptables -t nat -I POSTROUTING -o $EXT_IFACE -j MASQUERADE
Maybe I tried and it didn't work... I don't remember
|
|
|
03-22-2005, 07:42 AM
|
#8
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
I think it would be nice to write a diagram of your network ^^.
|
|
|
03-22-2005, 07:45 AM
|
#9
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
ADSL_Router(10.0.0.138)--SWITCH--Server[eth2(10.0.0.80)-eth1(10.40.0.10)-eth0(192.168.1.2)]
|
|
|
03-22-2005, 10:01 AM
|
#10
|
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534
Rep: 
|
Well i can't help you anymore... I have build some network like yours, but snat always did the trick!! Hope some guru overhere will help ya!
|
|
|
03-22-2005, 12:57 PM
|
#11
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
thanx Linux.tar.gz , anyone else?
|
|
|
03-22-2005, 01:26 PM
|
#12
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
Should I maybe add some special route table for the 192.168.1.0 lan? Since SNAT works with 10.40.0.0 network.........
|
|
|
03-23-2005, 07:01 AM
|
#13
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
My ADSL ROUTER can operate in BRIDGE Mode. Would it be better for me to put it in bridge mode, so I would have my public IP address on 10.0.0.80 or eth2 ?!?!
|
|
|
03-23-2005, 07:13 AM
|
#14
|
Member
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384
Rep:
|
Hi
As for what I understand of your problem, it's not a routing issue, since your routes to both internal networks are similar.
Bridging won't solve your problem since the issue is before this on your Linux router...
I've got 2 (stupid) quesitons :
Are the correct gateways defined on your hosts on the non-working netw ?
Don't you have some firewall rules that would block the non-working netw ?
Last edited by fr_laz; 03-23-2005 at 07:15 AM.
|
|
|
03-23-2005, 07:57 AM
|
#15
|
Member
Registered: Jan 2004
Posts: 45
Original Poster
Rep:
|
The gateway on the nonworking net is correct, and the firewall rules are the same for both lans, I just blocked ports via iptables.
|
|
|
All times are GMT -5. The time now is 09:02 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|