欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux删除路由表条目_Linux路由表条目存储在磁盘上的什么位置?

程序员文章站 2024-02-17 10:02:28
...

linux删除路由表条目

I know the routing tables on Linux is in memory after being set. However, where are the routing table entries stored on disk? I mean where are the routing table is persistently stored so that the routing table can be reloaded like the iptables (under /etc/sysconfig/iptables on Fedora/RHEL/CentOS Linuxes).

我知道设置后Linux上的路由表已在内存中。 但是,路由表条目存储在磁盘上的什么位置? 我的意思是将路由表永久存储在哪里,以便可以像iptables(在Fedora / RHEL / CentOS Linuxes上的/etc/sysconfig/iptables下)一样重新加载路由表。

If the system uses the /etc/rc.d/init.d/network script to manage the network, the static routing rules are stored in /etc/sysconfig/static-routes. This is the related script about applying the rules from static-routes in the network script file:

如果系统使用/etc/rc.d/init.d/ network脚本来管理网络,则静态路由规则存储在/etc/sysconfig/static-routes 。 这是有关在network脚本文件中应用来自static-routes的规则的相关脚本:

# Add non interface-specific static-routes.
    if [ -f /etc/sysconfig/static-routes ]; then
       grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
          /sbin/route add -$args
       done
    fi    

The network script reads from /etc/sysconfig/static-routes the lines starting with “any” and passes the following arguments to the /sbin/route command.

network脚本从/etc/sysconfig/static-routes读取以“ any”开头的行,并将以下参数传递给/sbin/route命令。

For example: A line like this in static-routes:

例如:在静态路由中这样的一行:

any host 10.1.1.8 gw 8.9.10.11

runs command:

运行命令:

route add -host 10.1.1.8 gw 8.9.10.11

If the system uses NetworkManager to manage the network, the NetworkManager GUI tools provides a dialog to set the routing rules. In the “Editing config_name” dialog’s “IPv4 Settings” tab (for IPv4), there is a button “Routes” which will opens the form that you can configure the routing rules.

如果系统使用NetworkManager来管理网络,则NetworkManager GUI工具将提供一个对话框来设置路由规则。 在“编辑config_name”对话框的“ IPv4设置”选项卡(对于IPv4)中,有一个“路由”按钮,它将打开您可以配置路由规则的表单。

Answered by Peter M..
彼得·M。的回答

翻译自: https://www.systutorials.com/where-are-the-linux-routing-table-entries-stored-on-disk/

linux删除路由表条目