说明问题:1、ip default-network 后面的网络地址只能是主网络号;
2、如果不将1中说的主网络号作为目的地址来建立一个有对应端口
. 的静态路由,rip会将0.0.0.0/0的默认路由通告出去;
注意:此时 ip default-network 后面的网络地址必须在路由表中有,
否则不起作用;但是具体是哪个地址,效果一样。也就是说这个
地址没有实际作用,该路由并不可以ping到外部路由的环回口地址。
3、手动加上该主类网络号的静态路由时,默认路由就有了对应端口,
此时该路由器就可以ping外部路由器的环回口地址了。
问题1、
R2(config)#ip default-network 23.1.1.0
(非主类网络号)
R2#show run
Building configuration...
Building configuration...
Current configuration : 789 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 23.0.0.0 255.0.0.0 23.1.1.0 (自动产生此路由条目,此路由为无效路由;故事内容是这样的“一个身在北京的人在天安门那碰见一个路人便发问中国在哪里?这个路人告诉他沿着天安门广场那条路走就能找到了。”)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 23.0.0.0 255.0.0.0 23.1.1.0 (自动产生此路由条目,此路由为无效路由;故事内容是这样的“一个身在北京的人在天安门那碰见一个路人便发问中国在哪里?这个路人告诉他沿着天安门广场那条路走就能找到了。”)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
R2#
-------------------------------
R2(config)#no ip default-network 23.1.1.0
R2(config)#ip default-
R2(config)#ip default-network 23.0.0.0 (主网络号)
R2(config)#exit
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#show run
Building configuration...
R2(config)#ip default-
R2(config)#ip default-network 23.0.0.0 (主网络号)
R2(config)#exit
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#show run
Building configuration...
Current configuration : 779 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip default-network 23.0.0.0 (产生正确默认路由)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip default-network 23.0.0.0 (产生正确默认路由)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
R2#
说明:ip default-network 后面的网络地址只能是主网络号
;
问题2、
R2#show run
Building configuration...
Current configuration : 811 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 112.0.0.0 (启用rip)
!
ip classless
ip default-network 23.0.0.0 (默认路由无对应端口)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 112.0.0.0 (启用rip)
!
ip classless
ip default-network 23.0.0.0 (默认路由无对应端口)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
R2#
R1#show run
Building configuration...
Building configuration...
Current configuration : 545 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 112.0.0.0 (启用rip)
!
ip classless
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 112.0.0.0 (启用rip)
!
ip classless
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5 )(默认路由无实际对应端口无实际作用所以ping不通对应的环回地址)
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5 )(默认路由无实际对应端口无实际作用所以ping不通对应的环回地址)
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 112.1.1.2 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
112.0.0.0/24 is subnetted, 1 subnets
C 112.1.1.0 is directly connected, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 112.1.1.2, 00:00:25, FastEthernet0/0 (rip将默认路由通告出去)
C 1.1.1.0 is directly connected, Loopback0
112.0.0.0/24 is subnetted, 1 subnets
C 112.1.1.0 is directly connected, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 112.1.1.2, 00:00:25, FastEthernet0/0 (rip将默认路由通告出去)
R1#ping 23.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/10/10 ms
Sending 5, 100-byte ICMP Echos to 23.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/10/10 ms
说明:如果不将1中说的主网络号作为目的地址来建立一个有对应端口
. 的静态路由,rip会将0.0.0.0/0的默认路由通告出去
问题3、
R2#show run
Building configuration...
Building configuration...
Current configuration : 859 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 112.0.0.0
!
ip classless
ip default-network 192.168.0.0 (任意有类网络,但必须与下面的静态路由对应)
ip route 192.168.0.0 255.255.255.0 23.1.1.3 (默认路由建立了对应端口)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
clock rate 4800
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 112.0.0.0
!
ip classless
ip default-network 192.168.0.0 (任意有类网络,但必须与下面的静态路由对应)
ip route 192.168.0.0 255.255.255.0 23.1.1.3 (默认路由建立了对应端口)
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 23.1.1.3 to network 192.168.0.0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
112.0.0.0/24 is subnetted, 1 subnets
C 112.1.1.0 is directly connected, FastEthernet0/0
S* 192.168.0.0/24 [1/0] via 23.1.1.3
R2#ping 3.3.3.3
C 2.2.2.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
112.0.0.0/24 is subnetted, 1 subnets
C 112.1.1.0 is directly connected, FastEthernet0/0
S* 192.168.0.0/24 [1/0] via 23.1.1.3
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/10/10 ms
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/10/10 ms
R2#
R3#show run
Building configuration...
Building configuration...
Current configuration : 723 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R3
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.3 255.255.255.0
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R3
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 23.1.1.3 255.255.255.0
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
R3#
说明:手动加上该主类网络号的静态路由时,默认路由就有了对应端口,
此时该路由器就可以ping外部路由器的环回口地址了。
有阐述的不对、不明确的地方还望高手指点,帮助兄弟提高!谢谢!