当前位置: 代码迷 >> 综合 >> linux route 操作命令
  详细解决方案

linux route 操作命令

热度:74   发布时间:2023-12-06 14:44:00.0

假如有以下的路由表:

10.101.184.32   *               255.255.255.224 U     0      0        0 eth0
10.101.186.0    *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
152.102.0.0     *               255.255.0.0     U     0      0        0 eth0
10.0.0.0        *               255.0.0.0       U     0      0        0 eth1
default         10.101.184.33   0.0.0.0         UG    0      0        0 eth1
default         10.101.184.33   0.0.0.0         UG    0      0        0 eth0
default         static-ip-65-19 0.0.0.0         UG    0      0        0 eth0

 

要把default         10.101.184.33   0.0.0.0         UG    0      0        0 eth1 这条路由删除:

route  del default gw 10.101.184.33 eth1

 

要添加一条路由:

凡是走192.168.33.0/27 的路由都通过eth0出去:

route add -net 192.168.33.0 netmask  255.255.255.224 dev eth0