≡ Menu

Ubuntu: SIOCADDRT: File exists Error and Solution

I‘m typing the following command under Ubuntu Linux:

route add default gw eth0

But it is giving me out the following error:

SIOCADDRT: File exists

How do I fix this problem?

This error normally displayed when you try to modify or or add a new routing IP address. For example, when you set the same route multiple times you will get this error.

Understanding SIOCADDRT: File exists Message

  1. SIOC: Serial Input Output Controller.
  2. ADD: ADD (addition).
  3. RT: RouTe (routing ip).
  4. File exists – Routing is already configured so delete wrong one and add the new one.

Display Current Routing Table

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to see your current routing table:
$ netstat -r
$ ip route list

Delete Wrong Routing IP Address

Use the following syntax:
$ sudo ip route delete {IP/SUBNET} dev {INTERFACE}
To delete default route via eth0, enter:
$ sudo ip route delete dev eth0

Add Correct Routing IP

Type the following command:
$ sudo ip route add default via
$ sudo route add default gw eth0

Network Configuration File

Edit, /etc/network/interfaces file and setup the correct routing address:

auto eth0
iface eth0 inet static
     ### set router default ip here ###

Say Hello To NetworkManager

Networking on Linux can be painful, especially in comparison to other operating systems. You should never need to use the command line or configuration files to manage your network (unless you want to!); everything should “Just Work” as automatically as possible and never stop you from doing what you want to do. NetworkManager attempts to make networking as invisible as you want it to be. Whether at home, work, or on the move, NetworkManager automatically connects to the last network you told it to connect to. From wired to wireless to mobile broadband to Bluetooth, NetworkManager has you covered.


The nm-applet is the applet which appears in the system tray. One can right-click the applet (the icon of two computers, one below to the other on the left-side) to manage and activate/deactivate your network connections. Clicking on NM-applet will give you the types of connection/hardware you have available. To modify your settings for eth0 or eth1 interface, right click on NM-applet > select Edit Connections. It will brings up the network-connections as follows:

Fig.01: Pain-Free Networking with NetworkManager

Fig.01: Pain-Free Networking with NetworkManager

Click on the Edit button after selecting the Wired tab in Network Connections as shown below:
Fig.02: Editing eth0 network connection

Fig.02: Editing eth0 network connection

Click on the IPv4 Settings tab. Now you can edit the default route and/or set the DNS server and other settings as per your requirements:
Fig.03: Setting up default gateway (routing table)

Fig.03: Setting up default gateway (routing table)

See also:

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 1 comment… add one }
  • mahdi October 6, 2012, 6:09 pm

    for Deleting Wrong Routing IP Address default gateway
    we should use
    ip route delete default via IPaddress

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , ,