LinuxQuestions.org
Visit Jeremy's Blog.
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 02-23-2010, 09:31 AM   #1
n9nu
LQ Newbie
 
Registered: Jan 2010
Location: Sandwich, IL
Posts: 1

Rep: Reputation: 0
Assigning default route/gateway for Linux box w/ 2 NIC's - One LAN; One WAN


Hi


I have a question in regards to assigning Gateway(s) or routes to two of the NIC's I have on board a Linux box which is also acting as a FQDN FTP/HTTP server.

The source fibre comes in and initially routes to my Smoothwall box which acts as a router/gateway/firewall. From there the LAN side NIC is directed to a managed 18 port HP Gigabit switch which in turn connects to the various PC's and printers behind the Smoothwall box (my LAN).

The Linux box in which I have the servers on is connected directly to the Internet via the same fibre via a switch which is BEFORE the Smoothwall box so it will bypass everything at the moment. That NIC (eth1) is assigned one of several static IP's I have with a gateway of 208.71.147.xxx.

Now...I was told the machine can only have ONE gateway assigned to it rather than assigning 2 different ones (different subnet) for each NIC. The 2nd NIC in this case (eth1) is for accessing the local LAN (same system as above) and is assigned an IP of 192.168.0.2; mask of 255.255.255.0 and DNS of 192.168.0.1 (Smoothwall box).

My question is, how can I specify that traffic I want to route to the LAN side (eth1 to say...HP Network printer, FreeNAS box, etc.) is sent via the correct NIC (this case eth1) without setting a gateway for this NIC...as the WAN NIC is assigned a gateway already?

DO I even need to assign a gateway for the LAN side?

I had assigned it 192.168.0.1 and noticed that I have substantial delays when trying to access the Inet because (I assume) it is receiving conflicting routing information. Both NIC's will only 'activate' or start when I have the gateway field filled in.....the LAN side will not start when there is no gateway entered.

I was also just told that I need to 'add' a route so that LAN traffic (eth0) will be directed to the appropriate NIC and thus will fix the delay issues. To where do I add this route?



Tim

Last edited by n9nu; 02-23-2010 at 10:04 AM.
 
Old 02-23-2010, 11:03 AM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Gateway = router in most cases. If you talk about LAN (192.168.0.x) GW is not needed. But you have to make sure you can ping clients in this LAN. Packets in the LAN should go directly to destination.

GW is needed when you want to send you packet to different network, which is not included in network mask.
 
Old 02-23-2010, 03:28 PM   #3
Rush_898
Member
 
Registered: Mar 2004
Distribution: debian...
Posts: 31

Rep: Reputation: 16
Hey, I think I see what you are asking. Yeah so you don't need a 'gateway' for directly connected networks. So if you printer is on 192.168.1.0/24 and your box has a interface is that LAN they will be able to talk without routing through a gateway. It sounds like you want to have your server sit outside of the firewall, and have that serve stuff to the internet, and then have it also be connected to your internal network. Do not configure your network this way. Repeat. Do not configure your network this way. Put your server behind your firewall in a DMZ (a separate network off of your firewall from internal). If you do what you are saying you basically give complete access to anyone who comprises your server.
 
Old 02-26-2010, 02:07 PM   #4
jvaldivia
Member
 
Registered: Sep 2007
Distribution: Debian Lenny
Posts: 61
Blog Entries: 2

Rep: Reputation: 19
What you need is Iproute version 2, you can have 2 gateways on the same box, I wrote a blog entry about all this matters, give it a look:

http://soad1982.blogspot.com/2010/02...-on-linux.html
 
Old 02-26-2010, 09:40 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Here's a very simple routing table showing that no gateway is used (Gateway = 0.0.0.0) for the LAN (192.168.1.0) and that packets for any network (0.0.0.0) other than the specified LAN (192.168.1.0) and loopback (127.0.0.0) should be sent to 192.168.1.1 for forwarding
Code:
root@CW8:/lib/udev# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.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         192.168.1.1     0.0.0.0         UG    1      0        0 eth0
 
  


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
Problem assigning default gateway to clients through dhcpd (ubuntu) milpoer Linux - Networking 2 04-16-2009 08:05 AM
2 NIC's - one gateway, setup Static route to Host baba_jaga Linux - Newbie 1 04-14-2009 02:05 PM
assigning ip's to multiple NIC's in a Fedora Core 4 box vinnypie Linux - Networking 4 11-23-2005 03:21 PM
sles 9.2 dhcp server not assigning default gateway pat45 Linux - Networking 1 05-07-2005 05:51 AM
dhclient not setting default gateway - no WAN route kadissie Linux - Networking 2 03-10-2005 04:55 AM

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

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