13

This is from route -n command.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.x     0.0.0.0         UG    600    0        0 <wifi>
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 <wifi>
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 <wifi>

I have tried:

1) disabled ufw and ran from the terminal(same with ufw enabled):

sudo route del -net 169.254.0.0 gw 0.0.0.0

got SIOCDELRT: Invalid argument

2) commented link-local 169.254.0.0 line in the /etc/networks file and rebooted.

3) disabled avahi-deamon since it seems to be related.

Nothing works, I use static IP but always when I connect to my router and run route -n command it appears there. So. do you guys have any other ideas?

UPDATE:

Thanks to the answer below I have looked into avahi-autoipd manpage and managed to find a solution. To remove the route:

sudo route del -net 169.254.0.0 netmask 255.255.0.0 dev <interface> metric 1000

where <interface> is your network interface, such as wlan0 for example. However, this would only remove it until next network association because it spawns all over again. So to make it permanent, you need to modify the /etc/network/if-up.d/avahi-autoipd file, the root of the spawning.

I commented out the final part of the code:

#if [ -x /bin/ip ]; then
    # route already present?
    #ip route show | grep -q '^169.254.0.0/16[[:space:]]' && exit 0

    #/bin/ip route add 169.254.0.0/16 dev $IFACE metric 1000 scope link
#elif [ -x /sbin/route ]; then
    # route already present?
    #/sbin/route -n | egrep -q "^169.254.0.0[[:space:]]" && exit 0

    #/sbin/route add -net 169.254.0.0 netmask 255.255.0.0 dev $IFACE metric 1000
#fi
1
  • YES, it works! I only commented out the lines with "route add" and I can confirm: Your solution works fine! (Ubuntu 18.04) Another nice step to clean up the mess in modern Ubuntu .... Jun 1, 2018 at 8:54

3 Answers 3

13

There is nothing at all you need to do. The 169.254.0.0 route is typically present for everyone with internet connectivity. Here is the route information from my machine:

chili@T440p:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    600    0        0 wlp3s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlp3s0
192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0

Please see: https://serverfault.com/questions/132657/where-route-to-169-254-0-0-comes-from

Especially see:

The 169.254.0.0/16 network is used for Automatic Private IP Addressing, or APIPA. If a DHCP client attempts to get an address, but fails to find a DHCP server after the timeout and retries period it will randomly assume an address from this network. This allows communication with hosts that have failed to obtain a DHCP address.

In short, the entry is entirely normal.

2
  • 1
    I do not recall ever having such a route, unless I was having troubles. I checked two of my 16.04 Ubuntu servers just now, both with internet connectivity, and neither has such a route. However, and too my surprise, it is present on my test 16.10 Ubuntu desktop computer. Mar 14, 2017 at 22:59
  • ip route on my ubuntu 16.10 box shows: 169.254.0.0/16 dev eth0 scope link metric 1000
    – neofug
    Mar 14, 2017 at 23:03
2

You're right in your assumption that this route comes from avahi.

Disabling avahi-deamon may not be enough since your DHCP client may be configured to use avahi-autoipd in order to set a Link-local IP when the DHCP request fails.

There are several things I would try:

  • add a line deny-interfaces=wifi (that's the name of your network interface, right?) in /etc/avahi/avahi-daemon.conf
  • since you're using a static IP anyway, disable your DHCP client (dhcpcd?)
  • as this answer suggests, you can simply uninstall avahi-daemon. Sure, this amounts to killing a fly with a steamroller, but it'll work
4
  • 1
    First two options didn't work. Third, let's just say I want to keep it as a reserve. But your answer did help me find a solution so cheers for your effort!
    – user633551
    Mar 15, 2017 at 22:28
  • 1
    @user633551 You should post your answer as an answer then. I'll be happy to vote it up. Mar 16, 2017 at 7:52
  • In 16.04 avahi-autoipd is not using /etc/avahi/avahi-daemon.conf, so the first sugestion will not prevent dhcp for calling the /etc/network/if-up.d/avahi-autoipd hook that is part of avahi-autoipd package. In my case I even do not have avahi-daemon installed. Aug 23, 2017 at 10:28
  • in my installation of Ubuntu 18.04 the solution to comment out the "route add" helped; editing /etc/network/if-up.d/avahi-autoipd Thanks a lot to user633551. Jun 1, 2018 at 8:58
1

I've solved like this:

iface eth1 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    pre up ip r d 169.254.0.0/16

Simply the route gets deleted when network is starting. In Rhel distros it is easy to configure Zeroconf, but I haven't found a way in Debian/Ubuntu. Still, this should do a trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.