How to clear the route table?

Steris

New Member
Joined
Jan 15, 2021
Messages
2
Reaction score
0
Credits
28
Hello all,

This is my first time posting and I am relatively new to Linux.

I work for a system integration company and part of my job is to add networking cards to servers and attach IP addresses to the devices and make sure that they can communicate with a test server.

I might have six devices at once (em1,em2,em3,em4,p1p1,p1p2).

I will assign six different ip addresses to those devices:

ip addr add 10.1.9.3/24 dev p1p1
ip addr add 10.1.10.3/24 dev p1p2
ip addr add 10.1.15.3/24 dev em1
ip addr add 10.1.16.3/24 dev em2
ip addr add 10.1.17.3/24 dev em3
ip addr add 10.1.18.3/24 dev em4


After I have assigned those IP addresses to those devices, I run the Route command and it shows me a table with the six devices and the corresponding IP addresses.

Currently, if I want to reassign those IP addresses I have to use the ip addr del x.x.x.x dev x command.

Is there a command I can use to clear the table completely in one command, rather than unassigning each device one at a time? I have to test multiple cards with a limited amount of cables/ip addresses, so I have to clear out the routing to reuse the ports to test the next set of cards in a server.

I am using a live boot disc of CentOS 7 on Dell R640/640 hardware.

I have tried to Google the problem for the last few days and I can't seem to find an easy solution. I have found solution for clearing individual entries on the table, but I haven't found a way to wipe all addresses on all devices in one shot. Perhaps I am not asking the right question?

I am a n00b and happy to take any constructive chewing out that the folks around here have to offer. :^)
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,893
Reaction score
2,631
Credits
28,122
Code:
ip route flush table main
 
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top