ip classless

 no ip classless 在查找路由時僅查找主類及其子網的匹配路由,如主類存在但子網不匹配,則路由器認爲路由不存在,也不會再使用默認路由.如主類不存在,則路由器還會使用默認路由. 而ip classless 在查找路由時直接查找路由標中的匹配路由,如匹配路由不存在,則路由器會使用默認路由.

 
路由器A配置如下:
interface Loopback0
ip address 10.1.1.1 255.255.255.0
interface Loopback1
ip address 10.2.1.1 255.255.255.0
!
interface f0/0
ip address 12.1.1.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 12.1.1.2
!
 
 
show ip route顯示路由器A的路由如下:
Gateway of last resort is 12.1.1.2 to network 0.0.0.0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.2.1.0 is directly connected, Loopback1
C       10.1.1.0 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 [1/0] via 12.1.1.2
 
路由器B配置如下:
interface Loopback0
ip address 10.3.1.1 255.255.255.0
!
interface Loopback1
ip address 11.1.1.1 255.255.255.0
!
interface f0/0
ip address 12.1.1.2 255.255.255.0
 
測試一:
在路由器A上配置no ip classless,
ping 10.3.1.1結果如下:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.1.1, timeout is 2 
seconds:
.....
Success rate is 0 percent (0/5)
 
解釋:主類(10.0.0.0)存在,但子網(10.3.0.0)不匹配,則路由器認爲路不存在,也不會再使用默認路由.
 
測試二:
在路由器A上配置no ip classless, 
ping  11.1.1.1結果如下:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/16 ms
解釋:如主類(11.0.0.0)不存在,則路由器還會使用默認路由.
 
測試三:
在路由器A配置ip classless
ping 10.3.1.1結果如下:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/16 ms
 
ping 11.1.1.1結果如下:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/12/16 ms
解釋:可以看到不論所查詢路由的主類是否存在,路由器均使用了默認路由
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章