ubuntu 删除路由

ubuntu 删除路由

I have some route in my routing table. But I want to delete one route from routing table. How can accomplish this?

我的路由表中有一些路由。 但是我想从路由表中删除一条路由。 如何做到这一点?

列出现有路线 (List Existing Routes)

To get detailed information about route that will be removed we list the existing routes in our system.

为了获得有关将被删除的路由的详细信息,我们在系统中列出了现有的路由。

$ sudo ip route show


 default via 192.168.122.1 dev ens3
 10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1
 172.16.0.0/24 via 192.168.122.1 dev ens3
 192.168.122.0/24 dev ens3  proto kernel  scope link  src 192.168.122.211

删除特定路线 (Remove Specific Route)

This command can be run all modern Linux distributions like Kali, Debian, Ubuntu, Fedora, CentOS. We remove the route by giving specific details about route like below. We will use ip route del command and provide related parameters.

该命令可以运行所有现代Linux发行版,例如Kali,Debian,Ubuntu,Fedora,CentOS。 我们通过提供有关路线的具体细节(如下所示)来删除路线。 我们将使用ip route del命令并提供相关参数。

$ sudo ip route del 172.16.0.0/24 via 192.168.122.1 dev ens3
  • ip route del is the command issues for removal

    ip route del是要删除的命令问题

  • 172.16.0.0/24 via 192.168.122.1 dev ens3  is our route to be removed. We give the full detail route so there will no space for error.

    通过192.168.122.1 dev ens3 172.16.0.0/24是我们要删除的路由。 我们提供了详细的路线,因此不会有错误的空间。

检查一下 (Check)

We want to check the last status of our routing table. We issue the same command we issued when starting.

我们要检查路由表的最后状态。 我们发出与启动时相同的命令。

$ sudo ip route show 

default via 192.168.122.1 dev ens3  
10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1  
192.168.122.0/24 dev ens3  proto kernel  scope link  src 192.168.122.211

As we can see from the output the route to the 172.16.0.0/24 is deleted from routing table.

从输出中可以看到,从路由表中删除了到172.16.0.0/24路由。

如何在Ubuntu Linux中删除路由? 信息移植 (How To Delete Route In Ubuntu Linux? Infografic)

   How To Delete Route In Ubuntu Linux? Infografic
How To Delete Route In Ubuntu Linux? Infografic
如何在Ubuntu Linux中删除路由? 信息移植
LEARN MORE  Linux Network Administration with ping and ip Commands
通过ping和ip命令了解更多Linux网络管理

翻译自: https://www.poftut.com/delete-route-ubuntu-linux/

ubuntu 删除路由

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐