ip default-network在EIGRP中的应用

ip default-network在EIGRP中的应用
学习-ip default-network在EIGRP中的应用,由图可以看出R2与R3之间的网络分割内网与外网。R2是一个边界路由器,R1为内部路由器,所以在R1没有必要知道,网络中所有路由信息,只要知道,我通过那个接口可以到外网去就可以了,在EIGRP中,我们可以通过ip default-network 命令实现,具体如下:
R1,R2,R3配置如下:
RIP 协议下, ip default-network [ 直链网络主网号 ] 就可以把默认路由通告到网络内部。但在 EIGRP IGRP 协议下,这不足以让他们通告出默认路由。
以下以 EIGRP 为例:
-------------------------------------------------------------------------------------------------------
R1#show run
Building configuration...
 
Current configuration : 953 bytes
!
version 12.3
!
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
!
router eigrp 100
 network 112.0.0.0
 auto-summary
!        
end
-------------------------------------------------------------------------------------------------------
R2#show run
Building configuration...
 
Current configuration : 1043 bytes
!
version 12.3
!
hostname R2
!
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
!
interface Serial1/1
 ip address 23.1.1.2 255.255.255.0
!
router eigrp 100
 network 23.0.0.0                //EIGRP RIP 的不同
 network 112.0.0.0
 auto-summary
!         
ip default-network 23.0.0.0  把默认路由通告给R1
ip route 0.0.0.0 0.0.0.0 23.1.1.3
!
end
-------------------------------------------------------------------------------------------------------
R3#show run
Building configuration...
 
Current configuration : 934 bytes
!
version 12.3
!
hostname R3
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!        
interface Serial1/0
 ip address 23.1.1.3 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 23.1.1.2
!
end
-------------------------------------------------------------------------------------------------------
 
R2 没有配置network 23.0.0.0的时候,R1的路由表
R1#show ip ro
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 not set
 并没有收到带*的路由条目,这就是RIP与EIGRP的不同,因为ip default-network
在EIGRP中需要路由更新路由包发送带*的路由。
     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
 
R2的路由表为
R2#show ip ro
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 0.0.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          //ip default-network产生
C       23.1.1.0 is directly connected, Serial1/1
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 [1/0] via 23.1.1.3
-------------------------------------------------------------------------------------------------------
 
配置network 23.0.0.0了后R1路由表为
R1#show ip ro
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 23.0.0.0
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
D*   23.0.0.0/8 [90/2172416] via 112.1.1.2, 00:27:11, FastEthernet0/0 存在带*的了吧
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
 
配置后的R2路由表为
R2#show ip ro
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 0.0.0.0
 
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
 *   23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       23.1.1.0/24 is directly connected, Serial1/1
D*      23.0.0.0/8 is a summary, 00:28:39, Null0   //network 23.0.0.0产生,这里有个地方一定要注意,就是ip default-network 网络主网号 不然就出现后面的问题,请看注
     112.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       112.1.1.0/24 is directly connected, FastEthernet0/0
D       112.0.0.0/8 is a summary, 00:28:39, Null0
S*   0.0.0.0/0 [1/0] via 23.1.1.3
 
   
R1#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 = 64/96/180 ms
注:ip default network 网络主网号 如果不是,这就会出现
R2#sh ip rou
Gateway of last resort is 23.1.1.3 to network 0.0.0.0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
 *   23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       23.1.1.0/24 is directly connected, Serial1/1
S*      23.0.0.0/8 [1/0] via 23.1.1.0 它不是指向null 0

     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       12.1.1.0/24 is directly connected, Serial1/0
D       12.0.0.0/8 is a summary, 00:02:24, Null0
S*   0.0.0.0/0 [1/0] via 23.1.1.3
分析:S* 23.0.0.0/8 [1/0] via 23.1.1.0
它不是指向null 0,而是指定我们在ip default-network 23.1.1.0.如果这样的话,就出错了,我们在PING 3.3.3.3时
R1#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)
为什么会不通呢
1.首先:让我们分板数据包正常到R3的路由路径:(1)R1查找到3.3.3.3的路由,确是没有找到完全匹配3.3.3.3,只有一条D*   23.0.0.0/8 [90/2172416] via 112.1.1.2, 00:27:11, FastEthernet0/0通过EIGRP学过来路认路由 (2)数据包到达R2上,这时也没有查到匹配3.3.3.3的条目,这是S*      23.0.0.0/8 [1/0] via unll 0
S*   0.0.0.0/0 [1/0] via 23.1.1.3有两条默认路由,我们选那条呢?以前讲到了,ip defalut-network 在有路由协议时,才有作用。所以现在匹配,S*   0.0.0.0/0 [1/0] via 23.1.1.3 将数据包成功地发到了R3上。(3)在R3上,通过S*   0.0.0.0/0 [1/0] via 23.1.1.2发到R2 R2看到12.1.1.1是它直连的,R1收到了自己发出去的数据包。OK 完成路由的过程。
 
2。再讲不通的情况 看一个配置文件吧
R2#sh run
ip classless
ip default-network 23.1.1.0
ip route 0.0.0.0 0.0.0.0 23.1.1 .3
ip route 23.0.0.0 255.0.0.0 23.1.1.0 将数据出口指向了23.1.1.0

no ip http server
no ip http secure-server
虽然在R1看到的D*   23.0.0.0/8 [90/2681856] via 12.1.1.2, 00:07:52, Serial1/0这条信息,但ip deflaut-network 23.1.1.0 所以数据包跟本发不出去。在R1就被丢了,可以从debug ip packet信息中看出
*Apr 8 21:59:37.255: IP: tableid=0, s=12.1.1.1 (local), d=3.3.3.3 (Serial1/0), routed via FIB
*Apr 8 21:59:37.259: IP: s=12.1.1.1 (local), d=3.3.3.3 (Serial1/0), len 100, sending。

你可能感兴趣的:(IP,职场,休闲,EIGRP)