分类:
2009-07-26 16:25:13
netstat –rn
Routing tables
Destination Gateway Flags Refs Use If PMTU Exp Groups
Route Tree for Protocol Family 2 (Internet):
default 172.16.18.1 UGc 0 0 en2 - - - =>
default 172.16.18.1 UGc 0 0 en1 - - -
9/8 172.16.18.1 UGc 0 0 en2 - - -
9.181.49.76 172.16.18.1 UGHW 1 772 en2 1500 - -
9.181.49.136 172.16.18.1 UGHW 1 272 en2 1500 - -
9.181.49.146 172.16.18.1 UGHW 1 49 en2 1500 - -
9.181.50.88 172.16.18.1 UGHW 2 489 en2 1500 - -
9.181.50.89 172.16.18.1 UGHW 3 59144 en2 1500 - -
9.181.50.92 172.16.18.1 UGHW 1 234 en2 1500 - -
.......
HA_node2:/etc>lsattr -El inet0
authm 65536 Authentication Methods True
bootup_option no Use BSD-style Network Configuration True
gateway Gateway True
hostname HA_node2 Host Name True
rout6 IPv6 Route True
route net,-hopcount,0,,-if,en1,,0,172.16.18.1 Route True
route net,-hopcount,0,,-if,en2,,0,172.16.18.1 Route True
上面重复的两条默认路由除了可以通过Flush Route Table
的方法删除之外,还可以用如下方法删除。
1. 通过route delete 删除kernel 中的route 信息:
HA_node2:/>route delete -if en1 default 172.16.18.1
172.16.18.1 net default: gateway 172.16.18.1
HA_node2:/>netstat -rn
Routing tables
Destination Gateway Flags Refs Use If PMTU Exp Groups
Route Tree for Protocol Family 2 (Internet):
default 172.16.18.1 UGc 0 0 en2 - - -
9/8 172.16.18.1 UGc 0 0 en2 - - -
9.181.49.76 172.16.18.1 UGHW 1 772 en2 1500 - -
9.181.49.136 172.16.18.1 UGHW 1 272 en2 1500 - -
9.181.49.146 172.16.18.1 UGHW 1 49 en2 1500 - -
9.181.50.88 172.16.18.1 UGHW 2 489 en2 1500 - -
9.181.50.89 172.16.18.1 UGHW 3 59144 en2 1500 - -
9.181.50.92 172.16.18.1 UGHW 1 234 en2 1500 - -
……
从上的结果可以看出,kernel中的重复default route 已经被删除。
但是从下面的结果可以看到,odm中的default route 仍然存在。
HA_node2:/etc>lsattr -El inet0
authm 65536 Authentication Methods True
bootup_option no Use BSD-style Network Configuration True
gateway Gateway True
hostname HA_node2 Host Name True
rout6 IPv6 Route True
route net,-hopcount,0,,-if,en1,,0,172.16.18.1 Route True
route net,-hopcount,0,,-if,en2,,0,172.16.18.1 Route True
2.通过chdev 删除odm中的route 信息:
HA_node2:/>chdev -l inet0 -a delroute=net,-hopcount,0,,-if,en1,,0,172.16.18.1
inet0 changed
HA_node2:/etc>lsattr -El inet0
authm 65536 Authentication Methods True
bootup_option no Use BSD-style Network Configuration True
gateway Gateway True
hostname HA_node2 Host Name True
rout6 IPv6 Route True
route net,-hopcount,0,,-if,en2,,0,172.16.18.1 Route True
HA_node2:/>netstat –rn
Routing tables
Destination Gateway Flags Refs Use If PMTU Exp Groups
Route Tree for Protocol Family 2 (Internet):
default 172.16.18.1 UGc 0 0 en2 - - -
9/8 172.16.18.1 UGc 0 0 en2 - - -
9.181.49.76 172.16.18.1 UGHW 1 772 en2 1500 - -
9.181.49.136 172.16.18.1 UGHW 1 272 en2 1500 - -
9.181.49.146 172.16.18.1 UGHW 1 49 en2 1500 - -
9.181.50.88 172.16.18.1 UGHW 2 489 en2 1500 - -
9.181.50.89 172.16.18.1 UGHW 3 59144 en2 1500 - -
9.181.50.92 172.16.18.1 UGHW 1 234 en2 1500 - -
......
执行chdev 删除默认路由之后,odm库和kernel中的多余默认路由都被删除