We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


why my syntax of "route" is bad?

gdmo asked
Medium Priority
Last Modified: 2008-01-09
I use centos4.2(RHEL4.2). I am a newbie in networking.
When I write : #route add -net netmask gw eth1
Centos answer "SIOCADDRT: Network is unreachable". What this message means?
Then, I write : #route add -net netmask eth1
this command is accepted by centos
Then I write :#route add -net netmask gw eth1
Now, this command is accepted by centos. why is this command now acceptedand not before?
and #route -n write two lines :
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   UG    0      0        0 eth1   U     0      0        0 eth1

The second line is useless. is it possible to have only one line?
Watch Question

Top Expert 2005
> When I write : #route add -net netmask gw eth1
> Centos answer "SIOCADDRT: Network is unreachable". What this message means?
It means, that currently (the gateway) in unreachable via eth1(ie eth1 has address from outside the network )...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
unfortunately route comes in different syntax flaviours, for example:
  route add -net ip.ip.ip.ip netmask gateway if eth1
  route add -net ip.ip.ip.ip netmask gw dev eth1
  route add -net ip.ip.ip.ip
and some more, even variations of the above
Same applies to the del/delete command.

you have to check your docs.
Gabriel OrozcoSolution Architect

first: you do not need to define the interface you are using to reach a route unless you have many ways to reach that network using different interfaces.

try your command erasing the "eth1" part =)
#route add -net netmask gw

now, I see a different problem: you cannot add a route to your own local network!!!


a) to be able to reach a different network, you need a gateway on your local network, so you can *see* that gateway.
b) when you assign an ip address on network (any ip address, but on that network) then such network becomes your local network. you do not need any gateway to see it. just with trying to access any host on that network, you are able to do so.
c) you are trying to define a route to your local network!!! this is weird and even if linux accepts it, it's not needed.

so, can you explain us what you are trying to do?


thanks to ravepl, to ahoffman, and to redimido. yours three comments were useful for me. I am sorry because I have no been able to understand completely yours answers.
Probably, there is a problem of "flavour" of the "route" command. Besides, as redimido said, it is useless to have a gateway.
I will ask a new question more precise, ans I hope, more clear.
I hesitate to choose which comment I will accept.  I choose the ravenpl comment.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.