美文网首页
Centos7添加路由

Centos7添加路由

作者: Firetheworld | 来源:发表于2020-07-02 09:23 被阅读0次

显示路由:

[root@localhost ~]# ip route show |column -t
default        via  10.17.87.200  dev    ens32   proto  static  metric  100
10.17.87.0/24  dev  ens32         proto  kernel  scope  link    src     10.17.87.119  metric  100

添加静态路由(重网络启失效):
来自10.0.0.0的ip通过10.17.87.1到本机。

[root@localhost ~]# ip route add 10.0.0.0/8 via 10.17.87.1 dev ens32
[root@localhost ~]# ip route show |column -t
default        via  10.17.87.200  dev    ens32   proto  static  metric  100
10.0.0.0/8     via  10.17.87.1    dev    ens32   proto  static  metric  100
10.17.87.0/24  dev  ens32         proto  kernel  scope  link    src     10.17.87.119  metric  100

删除静态路由:

[root@localhost ~]# ip route show|column -t
default        via  10.17.87.200  dev    ens32   proto  static  metric  100
10.0.0.0/8     via  10.17.87.1    dev    ens32   proto  static  metric  100
10.17.87.0/24  dev  ens32         proto  kernel  scope  link    src     10.17.87.119  metric  100
[root@localhost ~]# ip route del 10.0.0.0/8   # 删除路由
[root@localhost ~]# ip route show|column -t
default        via  10.17.87.200  dev    ens32   proto  static  metric  100
10.17.87.0/24  dev  ens32         proto  kernel  scope  link    src     10.17.87.119  metric  100

配置永久静态路由(如果没有此文件,先创建写到配置中):
将路由写到 /etc/sysconfig/network-scripts/route-ens32 配置中,命名与网卡名称一致(ens32)。

[root@localhost ~]# cat /etc/sysconfig/network-scripts/route-ens32 
10.0.0.0/8 via 10.17.87.1 dev ens32

删除永久静态路由:
编辑 /etc/sysconfig/network-scripts/route-ens32 中的路由,把不需要的路由注释,或者直接删除,重启网卡即可。

相关文章

  • Centos7添加路由

    显示路由: 添加静态路由(重网络启失效):来自10.0.0.0的ip通过10.17.87.1到本机。 删除静态路由...

  • Centos7 添加静态路由

    环境: CentOS Linux release 7.2.1511 (Core)Linux server 3.10...

  • express CRUD

    添加路由拼接 修改路由途径 将路径加上 restful风格 - rest,并添加动态路由 :resource 添加...

  • centos 添加静态路由

    一、添加永久静态路由 二、添加临时路由

  • 20220726-Alma Linux8添加静态路由

    一、临时添加和删除静态路由 1、显示路由表 2、临时添加静态路由 3、临时删除静态路由 二、设置永久的静态路由 永...

  • RouterOS PCC 负载均衡

    vrrp冗余路由协议/ip route 添加路由标签 route mark/ip firewall mangle 添加

  • [vue-router] Duplicate named rou

    翻译:vue-router 重复的命名路由定义静态路由:只需要修改重复 name动态路由:没有添加过才添加

  • 添加路由

    Mac: Windows: Mac永久添加路由: 在Launchpad 中找到 Automastor 制作工具...

  • 简单的路由守卫

    需要在配置路由时给路由添加meta,如下:

  • linux命令

    查询进程并杀掉进程 查看路由 添加路由

网友评论

      本文标题:Centos7添加路由

      本文链接:https://www.haomeiwen.com/subject/nerlqktx.html