Fixing ‘SIOCADDRT: File Exists’ Error When Restarting Network on Ubuntu

ipnetUbuntu

Error/stdout

 /etc/init.d/networking restart
 * Reconfiguring network interfaces...
SIOCADDRT: File exists
Failed to bring up eth0.
   ...done.
netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.0.1.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0
0.0.0.0         10.0.1.1        0.0.0.0         UG        0 0          0 eth0
0.0.0.0         10.0.1.1        0.0.0.0         UG        0 0          0 eth0


ip route list
10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.14  metric 1 
default via 10.0.1.1 dev eth0  proto static 
default via 10.0.1.1 dev eth0  metric 100 


/etc/network# more interfaces 
auto eth0
iface eth0 inet static
    address 10.0.1.14
    netmask 255.255.255.0
    network 10.0.1.0
    broadcast 10.0.1.255
    gateway 10.0.1.1
more hosts
127.0.0.1   jenkins-server-1.bts.md  jenkins-server-1
10.0.1.14   jenkins-server-1.bts.md jenkins-server-1 # Added by NetworkManager
#127.0.0.1  localhost.localdomain   localhost
127.0.0.1   jenkins-server-1.bts.md  jenkins-server-1
#127.0.0.1  jenkins-server-1.bts.md  jenkins-server-1
::1 jenkins-server-1    localhost6.localdomain6 localhost6
#127.0.0.1  jenkins-server-1.bts.md jenkins-server-1
#::1    jenkins-server-1    localhost6.localdomain6 localhost6
#127.0.1.1  jenkins-server-1.bts.md
# The following lines are desirable for IPv6 capable hosts
#::1     localhost ip6-localhost ip6-loopback
::1     jenkins-server-1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Best Answer

If you are changing the network configuration, it is normal to get such type of errors when restarting the network. If you are not accessing the machine remotely, you can first stop the network and then start it. If your configuration is fine, the interface(s) should be up again.

If you are still getting errors, you can try using ifconfig directly.