天天看點

建立靜态路由

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

a.b.c.d   c.c.c.c     255.255.255.255 UGH   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'

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

to manually reload the route-eth0 file, simply restart the network service

service network restart

本文轉自chenzudao51CTO部落格,原文連結: http://blog.51cto.com/victor2016/1904632,如需轉載請自行聯系原作者

繼續閱讀