-1

I've a remote linux machine whose the routing table is :

[root@hostname]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth0
10.10.10.16    0.0.0.0         255.255.255.240 U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0

The default gateway I should use is 10.10.10.17, and should be given by a linux dhcp server. So to be able to connect to the system I call someone on the site ask him to add the route manually (route add default gw 10.10.10.17). When the route has been added I can now connect to the system. And once connected when I check the routing table again I have this :

[root@hostname]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.10.10.17    0.0.0.0         UG    0      0        0 eth0 (UG flag means it's up and is the gateway)
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth0
10.10.10.16    0.0.0.0         255.255.255.240 U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0

And when I restart the system, it boots without the right default gateway, and I'm obliged to call again to set the route manually. The dhclient lease file has the good "option routers" taken from the dhcp server.

Now I'm trying to remove the unspecified route from the routing table but each time I try I'm disconnected from the machine.

I've tried these different ways :

route del -net 0.0.0.0 netmask 0.0.0.0 metric 0

route del default gw 0.0.0.0

route del -net 0.0.0.0 gw 0.0.0.0

The three attempts disconected me from the server, and the guy at the other side tells me that each time I try to remove the route the default route becomes a star (default *). I'm obliged to let him add the route again mannualy, and when I'm connected, and I restart the network I lose the connection again.

So my questions are : 1) Why does this unspecified default route come back every time? 2) How can I (what's the way to) remove it without spoiling the routing table (losing the good default gateway).


etho configuration :

[PRD][root@UAE-DBX-LX105 jcdprod]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
# Generated by parse-kickstart 
UUID=b6a65dbe-6524-4070-b4b7-3cb2b1333187 
BOOTPROTO=dhcp 
DEVICE=eth0 
ONBOOT=yes 
IPV6INIT=no 
PERSISTENT_DHCLIENT=yes
1
  • Is this CentOS 6.x? Feb 16, 2015 at 14:01

1 Answer 1

1

Route of 169.254.0.0 is Zero-Configuration IPv4 special block (169.254.0.0/16) as described in RFC 3927. From your current routing table, 169.254.0.0/16 is set up as network route and not as default gateway, so you don't need to remove it.

If you still want to disable that route, simply run:

echo 'NOZEROCONF=yes' >> /etc/sysconfig/network

I would also advise you to add the following, which will solve the issue of your default gateway not appearing after reboots:

echo 'GATEWAY=10.10.10.17' >> /etc/sysconfig/network

and restart networking service afterwards:

service network restart

Note: If your provider changes gateway on his side this would create problem again for you. You should check what is the problem with dnsclient, why it refuses to add default gateway properly. You can help us to locate the problem by pasting contents of /etc/sysconfig/network-scripts/ifcfg-eth0.

Note2: these commands will work for CentOS 5.x and 6.x and probably some older Fedora versions, if you are running something different please note in your question.

4
  • Hi Jakov. Thanks for your reply. First of all, I would like to be more clear, cause it seems like you mistook my problem. I don't have prioblem with the route for 169.254.0.0. my proble; is with the route 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0.
    – nixmind
    Feb 17, 2015 at 10:34
  • The system network configuration is OK. [PRD][root@UAE-DBX-LX105 jcdprod]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Generated by parse-kickstart UUID=b6a65dbe-6524-4070-b4b7-3cb2b1333187 BOOTPROTO=dhcp DEVICE=eth0 ONBOOT=yes IPV6INIT=no PERSISTENT_DHCLIENT=yes
    – nixmind
    Feb 17, 2015 at 10:40
  • Ah so. Do you have maybe GATEWAY set in /etc/sysconfig/network or a file called /etc/sysconfig/network-scripts/route-eth0 (or eth1)? And just for the clarity sake, copy/paste your last answer to your question, beacuse it's easier to read code in a question then in an answer Feb 17, 2015 at 19:37
  • Ok Jakov, but I don't if the site will accept it as answer.
    – nixmind
    Feb 18, 2015 at 15:16

You must log in to answer this question.

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