一、实验目的
掌握通过ip default-network命令配置EIGRP默认网络。
二、实验拓扑


 
三、实验要求:
R1,R2,R3运行EIGRP,用ip default-network 命令使EIGRP向EIGRP域内传递缺省路由,各路由器的各环回口之间路由可达。
四:实验过程:
1、 基本接口的配置.(见图)
1(config)#int e0/0
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#^Z

R2(config)#int e0/0
R2(config-if)#ip add 12.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int e0/1
R2(config-if)#ip add 23.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0

R3(config)#int e0/1
R3(config-if)#ip add 23.0.0.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s1/0
R3(config-if)#ip add 34.0.0.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0

R4(config)#int s0/1
R4(config-if)#ip add 34.0.0.4 255.255.255.0
R4(config-if)#no sh
R4(config)#int lo 0
R4(config-if)#ip add 4.4.4.4 255.255.255.0


2、EIGRP的配置:
R1(config)#router eigrp 1
R1(config-router)#net 12.0.0.0 0.0.0.255
R1(config-router)#net 1.1.1.0 0.0.0.255
R1(config-router)#no au

R2(config)#router eigrp 1
R2(config-router)#net 12.0.0.0 0.0.0.255
R2(config-router)#net 23.0.0.0 0.0.0.255
R2(config-router)#net 2.2.2.0 0.0.0.255
R2(config-router)#no au

R3(config)#router eigrp 1
R3(config-router)#net 23.0.0.0 0.0.0.255
R3(config-router)#net 3.3.3.0 0.0.0.255
R3(config-router)#no au
在各台路由器上查看路由表,并相互ping,发现内部网络已经可以全部通信。
3:IP Default-network的配置:
R3做内部网络的出口路由器,R4做外部路由器,分别配置往返内外网的静态路由。
R3(config)#ip route 0.0.0.0 0.0.0.0 34.0.0.4

R4(config)#ip route 1.1.1.0 255.255.255.0 34.0.0.3
R4(config)#ip route 2.2.2.0 255.255.255.0 34.0.0.3
R4(config)#ip route 3.3.3.0 255.255.255.0 34.0.0.3
R3#ping 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
R2#ping 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
....
R1#ping 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
....
//发现R3可以互通,R1,R2不可以通。原因,R3上有默认路由而R1,R2无。要使用内部路由器能投也有到达外部的路由
解决方法:
使用ip default-network:通过配置缺省网络,通过动态路由协议(EIGRP)向相关路由器传递缺省路由。
R3(config)#ip default-network 34.0.0.0

R3#sho ip route

Gateway of last resort is 34.0.0.4 to network 0.0.0.0

 *   34.0.0.0/24 is subnetted, 1 subnets
C*      34.0.0.0 is directly connected, Serial1/0    //直连网络34.0.0.0/24承载了缺省路由。
     1.0.0.0/24 is subnetted, 1 subnets
D       1.1.1.0 [90/435200] via 23.0.0.2, 00:15:33, Ethernet0/1
     2.0.0.0/24 is subnetted, 1 subnets
D       2.2.2.0 [90/409600] via 23.0.0.2, 00:15:33, Ethernet0/1
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, Ethernet0/1
     12.0.0.0/24 is subnetted, 1 subnets
D       12.0.0.0 [90/307200] via 23.0.0.2, 00:15:33, Ethernet0/1
S*   0.0.0.0/0 [1/0] via 34.0.0.4
查看R1,R2的路由表:
R2#ping 4.4.4.4 source 2.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
R1#ping 4.4.4.4 source 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
//发现R1,R2也可以和外部网络相互通信了,原因是它已经学习到了R3通过eigrp向域内发布的缺省路由。
R1#sho ip route eigrp
     34.0.0.0/24 is subnetted, 1 subnets
D*      34.0.0.0 [90/2221056] via 12.0.0.2, 00:10:50, Ethernet0/0
     2.0.0.0/24 is subnetted, 1 subnets
D       2.2.2.0 [90/409600] via 12.0.0.2, 00:11:05, Ethernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/435200] via 12.0.0.2, 00:11:05, Ethernet0/0
     23.0.0.0/24 is subnetted, 1 subnets
D       23.0.0.0 [90/307200] via 12.0.0.2, 00:11:05, Ethernet0/0
R2#sho ip route eigrp
     34.0.0.0/24 is subnetted, 1 subnets
D*      34.0.0.0 [90/2195456] via 23.0.0.3, 00:11:03, Ethernet0/1
     1.0.0.0/24 is subnetted, 1 subnets
D       1.1.1.0 [90/409600] via 12.0.0.1, 00:11:13, Ethernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/409600] via 23.0.0.3, 00:11:13, Ethernet0/1

==============================================

其它方法:
• 法2:
Ip route 0.0.0.0 0.0.0.0 null 0  本地写缺省路由
Router eigrp 1
Redistribure static
• 法3:
Ip route 0.0.0.0 0.0.0.0 null 0
Router eigrp 1
Net 0.0.0.0
• 法4:汇总:
接口模式下:ip summary-address eigrp 1 0.0.0.0 0.0.0.0

此处不再实验了,有兴趣的读者可以自己再做一下^-^
五:实验总结:

使用ip default-network命令可以有效减少内部网络配置任务。不过需要注意的是ip default-network其指出默认网络,建议采用主类网络。如果使用无类网络,则可能会出现无法解释的问题。