24

I've been bashing my head against a wall for a few days trying to figure this out: My ifconfig is:

eth0      Link encap:Ethernet  HWaddr 00:50:56:BB:XX:XX
          inet addr:192.168.36.132  Bcast:192.168.37.255  Mask:255.255.254.0

eth1      Link encap:Ethernet  HWaddr 00:50:56:BB:XX:XX
          inet addr:116.xx.xx.xx    Bcast:116.xx.xx.xx    Mask:255.255.255.192

When I try and add a static route to go out of eth0, I get the following error:

servername-test:/ # route add -net 10.248.12.0 netmask 255.255.255.240 gw 192.168.36.254 dev eth0 
SIOCADDRT: Network is unreachable

My Default gateway is:

servername-test:~ # netstat -anr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
116.xx.xx.xx    0.0.0.0         255.255.255.192 U         0 0          0 eth1
192.168.238.0   192.168.36.254  255.255.255.0   UG        0 0          0 eth0
192.168.239.0   192.168.36.254  255.255.255.0   UG        0 0          0 eth0
192.168.36.0    192.168.36.254  255.255.254.0   UG        0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo
0.0.0.0         116.xx.xx.xx    0.0.0.0         UG        0 0          0 eth1

ip route list output

116.66.240.64/26 dev eth1 proto kernel scope link src 116.xx.xx.xx 
192.168.238.0/24 via 192.168.36.254 dev eth0 
192.168.239.0/24 via 192.168.36.254 dev eth0 
192.168.36.0/23 via 192.168.36.254 dev eth0
169.254.0.0/16 dev eth0 scope link 
127.0.0.0/8 dev lo scope link 
default via 116.xx.xx.xx dev eth1
5
  • Could you please add the output of /sbin/ip addr and /sbin/ip route? These are more useful for debugging than ifconfig and netstat.
    – daff
    Mar 10, 2014 at 23:25
  • ip route:116.66.240.64/26 dev eth1 proto kernel scope link src 116.xx.xx.xx 192.168.238.0/24 via 192.168.36.254 dev eth0 192.168.239.0/24 via 192.168.36.254 dev eth0 192.168.36.0/23 via 192.168.36.254 dev eth0 169.254.0.0/16 dev eth0 scope link 127.0.0.0/8 dev lo scope link default via 116.xx.xx.xx dev eth1
    – AnonPoster
    Mar 10, 2014 at 23:30
  • 2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:50:56:xx:xx:xx brd ff:ff:ff:ff:ff:ff inet 192.168.36.132/23 brd 192.168.37.255 scope global eth0 inet6 fe80::xxx:xxx:xxx:xxx/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:50:56:xx:xx:xx brd ff:ff:ff:ff:ff:ff inet 116.xx.xx.xx/26 brd 116.xx.xx.xx scope global eth1 inet6 fe80::xxx:xxx:xxx:xxx/64 scope link valid_lft forever preferred_lft forever
    – AnonPoster
    Mar 10, 2014 at 23:32
  • I meant please edit your original post and include the information I requested. Pasting that output into the comments makes it entirely unreadable.
    – daff
    Mar 10, 2014 at 23:41
  • i also faced the same issue with my HPUX servers while adding the default route because i was unable to access the servers which are available in outside of my network. so i got the correct command to add the default and to check the routing table in hpux here you also can try, I hope this may help you to solve your problem too :)
    – user342489
    Mar 8, 2016 at 8:42

4 Answers 4

21

You have not declared 192.168.36.0/23 link local, despite the fact you have an address assigned for it, no link-local route appears to be listed in your routes.

192.168.36.0    192.168.36.254  255.255.254.0   UG        0 0          0 eth0
192.168.36.0/23 via 192.168.36.254 dev eth0

Instead its declared 192.168.36.0/23 should be passed to the gateway 192.168.36.254 which technically according to the rest of the routing table does not appear to be a neighbour (the kernel has no idea how to get to 192.168.36.254).

There should be no gateway assigned for 192.168.36.0/23 because according to your IP address 192.168.36.132/23 it is probably meant to be a a link-local range (neighbours directly responsive via ARP).

You should have an entry such as this instead:

192.168.36.0    0.0.0.0  255.255.254.0   U        0 0          0 eth0
192.168.36.0/23 dev eth0 scope link

To fix, you need to remove the gateway declaration for 192.168.36.0/23 and replace with an entry such as:

ip route add 192.168.36.0/23 dev eth0
1
  • This is the problem! I don't know what is causing it though. Somewhere on this server the ip address is being declared wrong, though I can't see where.
    – AnonPoster
    Mar 11, 2014 at 0:06
0

If so, forget command line, just append the Ethernet file entry directly and 'service network restart'. That works! I feel computer silly, because it irritated me first - then same route works perfectly while adding forcefully into the file.

0

Edit: I had added this answer before formatting, the problem is about network system of computer, there was a problem about network card. None of the solutions worked. I had to change the motherboard. Edit2: You may have connected the cable to the wrong place, double check your cables.

2
  • In a sense, can't this "solution" be used to solve every similar problem? Is this a useful solution to this specific problem?
    – Paul
    Jul 1, 2021 at 16:48
  • @Paul We think the motherboard is problematic. This can't help every solution but there can be people like me, struggling 5 hours or more, maybe this may help them figure out what is wrong.
    – Sahin
    Jul 2, 2021 at 6:59
-4

(Qouting) Whevener will add the default route need to specify a metric of 1 and execute the route add command:

Execute the below command to add default route in HPUX:

#route add default 192.168.178.1 1
add net default: gateway 192.168.178.1

Default route is added.

According to this http://expertisenpuru.com/1-easy-command-to-add-default-route-in-hpux/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .