LinuxQuestions.org
Register a domain and help support LQ
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 03-15-2005, 07:05 AM   #1
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Rep: Reputation: 30
how to set default entry in routing table?


hello,
I have 2 questions in setting routing table
1)What should be the Ideal configuration for my RH9 linux machine with
2 network interfaces
eth0:10.0.0.100
eth1:192.168.1.100

2) I set my routing table as
Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
172.16.1.0 10.0.2.100 255.255.255.0 UG 0 0 0 eth0
10.0.0.0 * 255.0.0.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.1.100 0.0.0.0 UG 0 0 0 eth1

wheras 10.0.2.10 is another router made on RH9.
I want to know how to set default to 10.0.0.100 as main network
connecting 10.0.0.100 and 10.0.2.10 (Router1 and Router 2 resp.)?

regaerds,
cranium

Last edited by cranium2004; 03-15-2005 at 07:10 AM.
 
Old 03-15-2005, 07:30 AM   #2
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

route is the commandto configure static routing, such as
route add default gw xxx.xxx.xxx.xxx
route del default gw xxx.xxx.xxx.xxx

But why is your default gw your machine ?
That's useless : the gw is the machine you're to send your packets when they have to go to a network you're not directly connected to... thus the gateway cannot be your machine...
 
Old 03-15-2005, 07:42 AM   #3
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
I have set hosta as 192.168.1.200 eth0
dirct connect(crossover) to
router1 192.168.1.100 eth1
10.0.0.100 eth0
which is thr' switch connected to
router2 10.0.2.100 eth0
172.16.1.100 eth1
direct connected tohostb
172.16.1.200 eth0

Router1 and Router2 are connected to switch which is connected to main proxy server

This is my configuration then how to set routing table for all 4 machnes
 
Old 03-15-2005, 07:51 AM   #4
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
host A :
route add -net 172.16.1.0 netmask 255.255.255.0 gw 192.168.1.100 metric 2

router 1 :
route add -net 172.16.1.0 netmask 255.255.255.0 gw 10.0.2.100 metric 1

router 2 :
route add -net 192.168.1.0 netmask 255.255.255.0 gw 10.0.0.100 metric 1

host B :
route add -net 192.168.1.0 netmask 255.255.255.0 gw 172.16.1.100 metric 2

Note that the 2 hosts don't know the 10.0.0.0 subnet, but they don't need it.
 
Old 03-15-2005, 10:03 AM   #5
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
Is that network configuration gives me simulation like i have 2 Routers in LAN ?
Why i need to specify metric also? Where is right place to put that network route statments in linux (i did it in /etc/rc.local) to make permenent changes in routing table, is that corret?

I want to communicate among all those 4 pcs. i already set Routers as packet forwarder.
 
Old 03-15-2005, 11:06 AM   #6
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Re,

Quote:
Is that network configuration gives me simulation like i have 2 Routers in LAN ?
Yes, but that's static routing. It's much more simple than dynamic routing like EIGRP, OSPF, BGP...

Quote:
Why i need to specify metric also?
You don't _need_ it, but the metrics are the correct values, so why not ? The only interest of metrics is to be able to choose the right route when several routes are available.

Quote:
Where is right place to put that network route statments
Depends on your distribution. On RH9 I believe it's /etc/sysconfig/static-routes. Try the manpage.
You can also create a small script and put it in /etc/rc.d/init.d and create the links in /etc/rcx.d.

Quote:
I want to communicate among all those 4 pcs
With the command lines I gave you, the hostA should be able to access routeur2 through it's interface in the 172.16.1.0 subnet, even if packets are incomming through the 10.0.2.0 interface... this should work.
If you want to access all your lans, just add the routes to the 10.0.0.0 subnet in hostA and hostB.

Quote:
i already set Routers as packet forwarder
Oki, that's all you need so as to route (statically) -- and knowing the routes of course
 
Old 03-15-2005, 11:39 AM   #7
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
Thanks for the answers. But what abt default entry setup in my case for all machines??
If i have 2 NIC then how can i set particular netID as default.
SAY eth0 10.0.0. and eth1 192.168.1.
then if i want to set 10.0.0.1 default route of my proxy server then how can i do that ???
How can i use metrics as you said they help in selecting routes???
 
Old 03-15-2005, 05:26 PM   #8
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Re,

I don't see what you mean by default netID... why would a nic be prioritary on the other ?

if you want to configure a default route, you just have to :
route add default gw 10.0.0.1 (assuming 10.0.0.1 is the gateway towards others nets).

usually, that's not configured in /etc/sysconfig/static-routes but in the nic config file.
 
  


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
Default Gateway Not Listed In Routing Table krazyace78 Linux - Networking 0 10-05-2004 12:09 PM
Double default gw in routing table ?? Help!! poj Linux - Networking 17 07-14-2004 07:05 AM
How to know when a routing entry is used? thanh Programming 7 06-12-2004 12:03 PM
file for storing routing entry becky_starr Linux - Networking 1 03-15-2004 09:52 AM
any tools help to set routing table? yenonn Linux - Networking 2 09-06-2003 07:41 AM


All times are GMT -5. The time now is 09:40 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration