How to add delete routes in linux

There are two commands which are useful either to add or delete route, those are  route and ip. We will see how to change route using command route.

Route Synopsis

Adding route

Deleting route

A quick way to add default route

A  quick way to delete defualt route

 

2 thoughts on “How to add delete routes in linux”

  1. Can you tell how to delete a route based on interface name?

    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.1.32.1 * 255.255.254.0 U 0 0 0 eth0
    link-local * 255.255.0.0 U 1002 0 0 eth0
    171.16.1.1 * 255.255.0.0 U 0 0 0 docker0
    default xmas-core1.c 0.0.0.0 UG 0 0 0 eth0

    Like, say I want to delete all with iface “eth0”

Leave a Reply

Your email address will not be published. Required fields are marked *