侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

创建静态路由

2022-12-10 星期六 / 0 评论 / 0 点赞 / 37 阅读 / 2394 字

CLN-10026route -n -vKernel IP routing tableDestination Gateway Genmask Flags Metric Ref U

.

CLN-10026

route -n -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.40.0       0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         10.0.40.1       0.0.0.0         UG    0      0        0 eth0


route add -v a.b.c.d  gw c.c.c.c


route -n -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
a.b.c.d   c.c.c.c     255.255.255.255 UGH   0      0        0 eth0
10.0.40.0       0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         10.0.40.1       0.0.0.0         UG    0      0        0 eth0



if we need to delete the static route, here is the command:

delete static route to destination ip a.b.c.d
route del a.b.c.d



the 'route add' command is obsolete, the new command is 'ip route add'

ip route add a.b.c.d via 10.0.40.17 dev eth0  # add a static routeip route del   a.b.c.d            # delete a static route

the 'ip route add' command and 'route add' command are temporary, meaning the entries will be gone after reboot. to make it permanent.  Edit the file /etc/sysconfig/entwork-scripts/route-eth0

cat /etc/sysconfig/network-scripts/route-eth0a.b.c.d via 10.0.40.17 dev eth0
  • to manually reload the route-eth0 file, simply restart the network service
    service network restart




.

广告 广告

评论区