【實驗環境】
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>