【实验环境】
Cisco Packet Tracer 5.3.2
【实验目的】
练习在eigrp路由协议中使用ip default-network命令宣告默认路由。
【实验拓扑】
【实验说明】
路由器GW与ISP互指默认路由模拟园区网网关与运营商网络,eigrp协议只在园区网内部署
路由器ISP上的loop 0接口模拟外部网络(1.1.1.1)
通常情况下,R1和R2需要手工指定默认路由 ip route 0.0.0.0 0.0.0.0 xxxx才可以使得PC0和PC1访问外部网络(1.1.1.1),如果GW下面的路由器很多,这样做就会增加大量工作量,此时可以让eigrp自动宣告 默认路由给其他路由器
在EIGRP中使用ip default-network宣告默认路由的条件:
1、ip default-network后面必须跟主类网络号
2、该路由器必须存在指向默认网络的路由
3、必须在eigrp进程中宣告默认网络
如果默认网络不是一个主类网络,例如/30的网络,则必须自动汇总或者手工汇总成主类网络进行宣告才可以成功,个人觉得与其这样倒不如直接使用redistribute static将默认路由重分布进eigrp更好,这是NP的内容了,以后说。
【实验步骤】
1、路由器ISP:
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Serial0/0/0
ip address 220.220.220.1 255.255.255.0
clock rate 4000000
!
ip classless
ip route 0.0.0.0 0.0.0.0 220.220.220.2
!
2、路由器GW:
!
interface FastEthernet0/0
ip address 172.16.0.2 255.255.255.0
!
interface FastEthernet0/1
ip address 172.16.1.2 255.255.255.0
!
interface Serial0/0/0
ip address 220.220.220.2 255.255.255.0
!
router eigrp 1
passive-interface Serial0/0/0
network 172.16.0.0
network 220.220.220.0
no auto-summary
!
ip classless
ip default-network 220.220.220.0
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
!
GW(config)#router ei 1
//关闭自动汇总
GW(config-router)#no au
//宣告默认网络
GW(config-router)#network 220.220.220.0
//因为eigrp只在园区网内部部署,因此外部接口可以设置为被动
GW(config-router)#passive-interface Serial0/0/0
GW(config-router)#exit
//设置到ISP的默认路由
GW(config)#ip route 0.0.0.0 0.0.0.0 Serial0/0/0
//指定默认网络进行宣告(主类网络)
GW(config)#ip default-network 220.220.220.0
3、路由器R1:
!
interface FastEthernet0/0
ip address 172.16.0.1 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.0.254 255.255.255.0
!
router eigrp 1
network 172.16.0.0
network 192.168.0.0
no auto-summary
!
4、路由器R2:
!
interface FastEthernet0/0
ip address 192.168.1.254 255.255.255.0
!
interface FastEthernet0/1
ip address 172.16.1.1 255.255.255.0
!
router eigrp 1
network 172.16.0.0
network 192.168.1.0
no auto-summary
!
5、验证:
GW#sh ip ro
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.0.0 is directly connected, FastEthernet0/0
C 172.16.1.0 is directly connected, FastEthernet0/1
D 192.168.0.0/24 [90/30720] via 172.16.0.1, 01:08:19, FastEthernet0/0
D 192.168.1.0/24 [90/30720] via 172.16.1.1, 01:08:20, FastEthernet0/1
C* 220.220.220.0/24 is directly connected, Serial0/0/0
S* 0.0.0.0/0 is directly connected, Serial0/0/0
GW#
R1#sh ip ro
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.0.0 is directly connected, FastEthernet0/0
D 172.16.1.0 [90/30720] via 172.16.0.2, 01:08:43, FastEthernet0/0
C 192.168.0.0/24 is directly connected, FastEthernet0/1
D 192.168.1.0/24 [90/33280] via 172.16.0.2, 01:08:43, FastEthernet0/0
D* 220.220.220.0/24 [90/20514560] via 172.16.0.2, 01:00:04, FastEthernet0/0
R1#
R2#sh ip ro
172.16.0.0/24 is subnetted, 2 subnets
D 172.16.0.0 [90/30720] via 172.16.1.2, 01:16:10, FastEthernet0/1
C 172.16.1.0 is directly connected, FastEthernet0/1
D 192.168.0.0/24 [90/33280] via 172.16.1.2, 01:16:10, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
D* 220.220.220.0/24 [90/20514560] via 172.16.1.2, 01:07:31, FastEthernet0/1
R2#
PC>ipconfig
IP Address......................: 192.168.0.1
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.0.254
PC>ping 1.1.1.1
Pinging 1.1.1.1 with 32 bytes of data:
Reply from 1.1.1.1: bytes=32 time=34ms TTL=253
Reply from 1.1.1.1: bytes=32 time=93ms TTL=253
Reply from 1.1.1.1: bytes=32 time=94ms TTL=253
Reply from 1.1.1.1: bytes=32 time=93ms TTL=253
Ping statistics for 1.1.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 34ms, Maximum = 94ms, Average = 78ms
PC>