- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Having trouble adding a route....
Operating System - Linux
1819681
Members
3514
Online
109605
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2011 10:08 AM
тАО05-06-2011 10:08 AM
Having trouble adding a route....
When I try to add a route the Gateway is defaulting to the default...
I've coded the route file as:
# cat /etc/sysconfig/network-scripts/route-eth2
208.14.204.0/24 via 155.90.142.251 dev eth2
155.90.142.0/24 via 155.90.142.251 dev eth2
#
On network restart or reboot, the 208.14.204.0/24 is defined as expected, but the 155.90.142.0/24 defaults to: 0.0.0.0
# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
155.90.142.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
208.14.204.0 155.90.142.251 255.255.255.0 UG 0 0 0 eth2
192.168.35.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
155.90.245.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
0.0.0.0 155.90.245.251 0.0.0.0 UG 0 0 0 eth0
#
When I try to add it manually I can't get it to set either:
# ip route del 155.90.142.0/24 dev eth2
# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
208.14.204.0 155.90.142.251 255.255.255.0 UG 0 0 0 eth2
192.168.35.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
155.90.245.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
0.0.0.0 155.90.245.251 0.0.0.0 UG 0 0 0 eth0
#
# ip route add 155.90.142.0/24 gw 155.90.142.251 dev eth2 Error: either "to" is duplicate, or "gw" is a garbage.
#
Or if i try with -net I get:
# ip route add -net 155.90.142.0/24 gw 155.90.142.251 dev eth2
Error: an inet prefix is expected rather than "-net".
#
Not sure what is wrong at this point....
Can anyone tell me where to look ??
I've coded the route file as:
# cat /etc/sysconfig/network-scripts/route-eth2
208.14.204.0/24 via 155.90.142.251 dev eth2
155.90.142.0/24 via 155.90.142.251 dev eth2
#
On network restart or reboot, the 208.14.204.0/24 is defined as expected, but the 155.90.142.0/24 defaults to: 0.0.0.0
# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
155.90.142.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
208.14.204.0 155.90.142.251 255.255.255.0 UG 0 0 0 eth2
192.168.35.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
155.90.245.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
0.0.0.0 155.90.245.251 0.0.0.0 UG 0 0 0 eth0
#
When I try to add it manually I can't get it to set either:
# ip route del 155.90.142.0/24 dev eth2
# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
208.14.204.0 155.90.142.251 255.255.255.0 UG 0 0 0 eth2
192.168.35.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
155.90.245.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
0.0.0.0 155.90.245.251 0.0.0.0 UG 0 0 0 eth0
#
# ip route add 155.90.142.0/24 gw 155.90.142.251 dev eth2 Error: either "to" is duplicate, or "gw" is a garbage.
#
Or if i try with -net I get:
# ip route add -net 155.90.142.0/24 gw 155.90.142.251 dev eth2
Error: an inet prefix is expected rather than "-net".
#
Not sure what is wrong at this point....
Can anyone tell me where to look ??
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2011 10:43 AM
тАО05-06-2011 10:43 AM
Re: Having trouble adding a route....
Thought maybe I had the command syntax wrong, but if I try as follows I get network unreachable....
# ip route add 155.90.142.0/24 via 155.90.142.251 dev eth2
RTNETLINK answers: Network is unreachable
#
# ip route add 155.90.142.0/24 via 155.90.142.251 dev eth2
RTNETLINK answers: Network is unreachable
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2011 10:44 AM
тАО05-06-2011 10:44 AM
Re: Having trouble adding a route....
Your "ip route add" syntax is wrong.
You should use:
ip route add 155.90.142.0/24 via 155.90.142.251 dev eth2
Note: no "-net" and "via" instead of "gw".
Alternatively, you're thinking about the syntax of the older "route" command:
route add -net 155.90.142.0 netmask 255.255.255.0 gw 155.90.142.251 dev eth2
Besides, your post-reboot routing table suggests that your eth2 has an IP address like 155.90.142.x and netmask 255.255.255.0, so the system very reasonably expects to be able to contact all the 155.90.142.* hosts directly via eth2, without using any gateway at all. If this is not true, you either have a wrong netmask on eth2 or the network to which your eth2 is plugged into behaves very strangely.
What kind of netmask does "ifconfig eth2" or "ip addr show dev eth2" display?
MK
You should use:
ip route add 155.90.142.0/24 via 155.90.142.251 dev eth2
Note: no "-net" and "via" instead of "gw".
Alternatively, you're thinking about the syntax of the older "route" command:
route add -net 155.90.142.0 netmask 255.255.255.0 gw 155.90.142.251 dev eth2
Besides, your post-reboot routing table suggests that your eth2 has an IP address like 155.90.142.x and netmask 255.255.255.0, so the system very reasonably expects to be able to contact all the 155.90.142.* hosts directly via eth2, without using any gateway at all. If this is not true, you either have a wrong netmask on eth2 or the network to which your eth2 is plugged into behaves very strangely.
What kind of netmask does "ifconfig eth2" or "ip addr show dev eth2" display?
MK
MK
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP