13

How to delete a route like the one below from a UNIX server?

122.252.228.38/255.255.255.255  122.252.228.38     UH        0  lan4       4136
  • What Unix is this on. It may differ depending on Unix flavour. – Kusalananda Nov 9 '17 at 12:52
  • Please also add the command that you used to generate this output. – igal Nov 9 '17 at 13:12
17

You haven't included which system you're on or which tool-set you're using, but the two most common commands for managing the routing tables are the route and ip commands.

Here is how you might remove the route by using the route command (from the net-tools package):

route del -net 122.252.228.38 netmask 255.255.255.255

And here is how you might delete the same route using the ip command (from the iproute2 package):

ip route del 122.252.228.38/32
|improve this answer|||||
0
sudo ip route del 122.252.228.38/32   # or any valid selector
sudo ip addr flush dev DEVICE    # then flush the cache and the route will be gone
|improve this answer|||||
  • 3
    Do not follow this advice, it will nuke all entries for a specified devices and will likely ruin your day/week/month, potentially locking your out of the system your are managing, and require an on-site console. sudo ip addr flush dev DEVICE is WAY too greedy for the problem at hand! The question just wants to remove a single entry! flush (as written) will remove ALL ENTRIES for a device!!!!! – Sandwich Mar 20 at 5:15

Your Answer

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

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