Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Routing table configuration

Status
Not open for further replies.

glajos42

Programmer
Dec 20, 2002
8
US
with regards to the routing tables... Is there a way to configure the routing tables to know which device to use??

What I am trying to do is use a serial and ethernet connection for communications. The application needs to be able to connect through the right port based on information from the app. So what I am asking is there a way to have the routing table know which connection to use??

I am not sure if this is enough information to figure out the problem so let me know if you need more info.

It would be great if there is a link that explains how to do this

thanks
Josh
 
man route
man netstat (-r option)

Hope This Help
PH.
 
This depends on what the application is trying to do.
If it is a network or TCP connection it is trying to establish, then it will rely on the route table to make the connection based on the IP.

It may be easier to think of the "ports" (your term not mine) as a PPP link or a Lan link, or interfaces. The term ethernet refers to the entire network topology and is independent of the medium(type of wire(s)) used.

The routing table is a map on how to get to various logical networks in the ethernet.

So when you try to send an IP packet to a specific host, it resolves the host name to an IP address. It then looks at the routing table for the best match to the network portion of the IP address. It then uses the gateway defined in that route to send the packet. It may have to go back to route table to determine how to get to the gateway.

This is all handled generally behind the scenes so unless your application is directly talking to TCP/IP stack this will all be transparent.

So depending on what your application is trying to do the answer is yes.......or no...
 
just to recap what stanhubble has said
if your app is talking TCP\IP then yes you need route table entries

#/etc/route add 123.123.123.0 mask 255.255.255.0 192.168.1.1
#/etc/route add 321.321.321.0 mask 255.255.255.0 192.168.1.2

where 123.123.123.0 is first destination subnet and 192.168.1.1 is address of device #1

AND

where 321.321.321.0 is second destination subnet and 192.168.1.2 is address of device #2



Steve Bowman
steve.bowman@ultraex.com

 
so is there a way to automate the process of configuring the routing tables with a script or another process so that they will add the correct information that is in the /etc/hosts file?
 
No, the information that is in the hosts file is for name <-> ip resolution, not how to get there.
 
If you want to dynamically change the routing table, do a
Code:
man route
and consider the flush and the add options.

Hope This Help
PH.
 
if it is adding routes that you need place them in the /etc/rc2.d/S99Route file this will set then up on every boot

Steve Bowman
steve.bowman@ultraex.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top