LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-31-2005, 02:39 PM   #1
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Rep: Reputation: 30
route add


I want to add route to reach the computer 192.168.1.141 through the gateway 192.168.1.41.
I tried the following but the error is "SIOCADDRT: Network is unreachable".

# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.31.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 172.31.1.1 0.0.0.0 UG 0 0 0 eth0

# ping 192.168.1.41
PING 192.168.1.41 (192.168.1.41) 56(84) bytes of data.
64 bytes from 192.168.1.41: icmp_seq=0 ttl=64 time=61.7 ms
64 bytes from 192.168.1.41: icmp_seq=1 ttl=64 time=1.53 ms
64 bytes from 192.168.1.41: icmp_seq=2 ttl=64 time=56.1 ms

--- 192.168.1.41 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 1.538/39.821/61.780/27.168 ms, pipe 2

# route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.41
SIOCADDRT: Network is unreachable

Last edited by powah; 08-31-2005 at 02:40 PM.
 
Old 08-31-2005, 03:43 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,569

Rep: Reputation: 171Reputation: 171
Routing table is local. You can only set up routing via gateway if the gateway is in your local network (network addresses of any of your nics). The route you're trying to add doesn't look local, so it should be handled somewhere later, for example by your default gateway.
 
Old 08-31-2005, 09:32 PM   #3
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Original Poster
Rep: Reputation: 30
Do you mean my routing table do not need to be modified and
the route for 192.168.1.x should be added at the default gateway (172.31.1.1)?

Quote:
Originally posted by Mara
Routing table is local. You can only set up routing via gateway if the gateway is in your local network (network addresses of any of your nics). The route you're trying to add doesn't look local, so it should be handled somewhere later, for example by your default gateway.
 
Old 08-31-2005, 11:24 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
All traffic that doesn't have another route defined for it will be sent to the default gateway (this is the point of having a default gateway). As long as the gateway knows how to route the traffic or pass it on to another gateway that does, you are fine.
 
Old 09-01-2005, 03:24 PM   #5
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,569

Rep: Reputation: 171Reputation: 171
To clarify, yes. You don't need to modify your routing table.
 
  


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
How do I add a route??? moonmoth Linux - Networking 3 09-04-2005 07:25 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 05:34 AM
route add robf2301 Linux - Networking 6 03-11-2005 05:06 AM
ip route add ducati620 Linux - Networking 0 06-06-2004 07:11 AM
Help with Route Add command? graystarr Linux - Networking 4 01-13-2004 05:12 PM


All times are GMT -5. The time now is 09:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration