Celeb Glow
general | April 03, 2026

How to delete a route by its id or something easy to type

172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0

If I want to delete some route from above, I have to type everything: the ip, gateway, netmask and interface.

Is there an easy way to delete a route? I need it all the time and it gets annoying do type everything.

1 Answer

Not knowing which Ubuntu version you are using, but ip route del should do the trick.

You also should use ip route to list the routes. Then delete the routes as follows.

root@host:~# ip route
default via 192.168.122.1 dev ens3 proto dhcp metric 101
10.0.10.0/24 dev ens10 proto kernel scope link src 10.0.10.209 metric 100
169.254.0.0/16 dev ens10 scope link metric 1000
192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.47 metric 101
root@host:~# ip route del 10.0.10.0/24
root@host:~# ip route
default via 192.168.122.1 dev ens3 proto dhcp metric 101
169.254.0.0/16 dev ens10 scope link metric 1000
192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.47 metric 101 

If you cannot find the ip command, try to install it with apt-get install iproute2.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy