linux配置网卡IP地址命令详细介绍及一些常用网络配置命令
ip route replace default equalize nexthop via 211.139.218.145 dev eth0 weight 1 nexthop via 211.139.218.145 dev eth1 weight 1
7.7.ip route delete– 删除路由
缩写:delete、del、d
示例1:删除上一节命令加入的多路径路由
ip route del default scope global nexthop dev ppp0 nexthop dev ppp1
7.8.ip route show — 列出路由
缩写:show、list、sh、ls、l
示例1: 计算使用gated/bgp协议的路由个数
ip route ls proto gated/bgp |wc
1413 9891 79010
示例2: 计算路由缓存里面的条数,由于被缓存路由的属性可能大于一行,以此需要使用-o选项
ip -o route ls cloned |wc
159 2543 18707
示例3: 列出路由表TABLEID里面的路由。缺省设置是table main。TABLEID或者是一个真正的路由表ID或者是/etc/iproute2/rt_tables文件定义的字符串,
或者是以下的特殊值:
all — 列出所有表的路由;
cache — 列出路由缓存的内容。
ip ro ls 193.233.7.82 tab cache
示例4: 列出某个路由表的内容
ip route ls table fddi153
示例5: 列出默认路由表的内容
ip route ls
这个命令等于传统的: route
7.9.ip route flush — 擦除路由表
示例1: 删除路由表main中的所有网关路由(示例:在路由监控程序挂掉之后):
ip -4 ro flush scope global type unicast
示例2:清除所有被克隆出来的IPv6路由:
ip -6 -s -s ro flush cache
示例3: 在gated程序挂掉之后,清除所有的BGP路由:
ip -s ro f proto gated/bgp
示例4: 清除所有ipv4路由cache
ip route flush cache
*** IPv4 routing cache is flushed.
7.10 ip route get — 获得单个路由 .缩写:get