Chinaunix

标题: route add 和 ip rule add 区别 [打印本页]

作者: qiaobinbin    时间: 2007-04-09 09:36
标题: route add 和 ip rule add 区别

route
route add -net 61.147.0.0 netmask 255.255.0.0 gw 192.168.0.254

ip rule 中建表
ip rule add .......................
有何区别
有一定区别,用ip route可以增加新的路由表,然后在指定的路由表中添加路由,因此可以设置策略路由。
而用route 命令只能在缺省路由表中添加路由。

例如:ip route add  default via 203.86.61.45 table 1 添加个路由表1
     ip rule add from 192.168.30.0/24 table 1  添加一个规则
//以下的可以在默认的route表(table main)中得到:
ip route add 203.86.61.44/30 dev eth2  proto kernel  scope link  src 203.86.61.46 table 1
ip route add 192.168.100.0/24 dev eth0  proto kernel  scope link  src 192.168.100.254 table 1





本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31568/showart_273604.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2