Home>Article>Operation and Maintenance> How to delete routes in linux

How to delete routes in linux

WBOY
WBOY Original
2022-01-06 14:45:13 42726browse

In Linux, you can use the route command to delete routes. This command is used to operate the kernel-based IP routing table. You can create or delete the specified route. When the parameter is set to "del", the specified route will be deleted. The syntax is "route del -net gw" or "route del -host dev".

How to delete routes in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to delete routes in Linux

In Linux, you can use the route command to delete routes.

1. Command format:

route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]

2. Command function:

Route command is used to operate the kernel-based ip routing table. Its main function is to create a static route to specify a host or a network through a network interface, such as eth0. When the "add" or "del" parameter is used, the routing table is modified. If there are no parameters, the current contents of the routing table are displayed.

3. Command parameters:

  • -c Display more information

  • -n Do not resolve names

  • -v Display detailed processing information

  • -F Display sending information

  • -C Display routing cache

  • -f clears the routing tables of all gateway entries.

  • -p makes the route permanent when used with the add command.

Examples are as follows:

Delete route route del -net 192.168.0.0/24 gw 192.168.0.1

add Add route del Delete route -net Set the route to a certain network segment -host Set the route to a certain host gw Exit gateway IP address dev Exit gateway physical device name

Delete route ip route del 192.168.0.0/24 via 192.168.0.1

add add route del delete route via gateway export IP address dev gateway export physical device name
add default route ip route add default via 192.168.0.1 dev eth0 via 192.168.0.1 is my default router

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to delete routes in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn