EIGRP 路由问题

网络工程 思科 路由 eigrp
2022-02-05 10:03:04

我有关于 EIGRP 的问题。但首先,这是拓扑: 拓扑 我已经完成了 EIGRP 路由,但这有点奇怪。PC0 -> PC1 可以 ping,PC3 -> PC2 可以 ping。但是,我无法 ping PC0 -> PC2、PC0 -> PC3。这也发生在 PC1 上。这是我所有的路由器配置:

-ROUTER0-

interface FastEthernet0/0
 ip address 10.10.0.1 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet0/0.20
 encapsulation dot1Q 20
 ip address 10.10.3.1 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router eigrp 10
 network 10.0.0.0
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 network 192.168.4.0
 auto-summary
!
ip classless
ip route 192.168.0.0 255.255.255.0 FastEthernet0/1 
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

-ROUTER1-

interface FastEthernet0/0
 ip address 10.10.0.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet0/0.30
 encapsulation dot1Q 30
 ip address 10.10.1.1 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.2.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router eigrp 10
 network 10.0.0.0
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 network 192.168.4.0
 auto-summary
!
ip classless
ip route 192.168.0.0 255.255.255.0 FastEthernet0/1 
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

-路由器2-

interface FastEthernet0/0
 ip address 10.10.2.1 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet0/0.30
 encapsulation dot1Q 30
 ip address 10.10.1.2 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.3.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router eigrp 1
 auto-summary
!
router eigrp 10
 network 10.0.0.0
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 network 192.168.4.0
 auto-summary
!
ip classless
ip route 192.168.0.0 255.255.255.0 FastEthernet0/1 
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

-ROUTER3-

interface FastEthernet0/0
 ip address 10.10.2.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet0/0.20
 encapsulation dot1Q 20
 ip address 10.10.3.2 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.4.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router eigrp 10
 network 10.0.0.0
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 network 192.168.4.0
 auto-summary
!
ip classless
ip route 192.168.0.0 255.255.255.0 FastEthernet0/1 
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

看来路由已经启动了。但是有人知道为什么会这样吗?谢谢你。

2个回答

我已经创建了与图像上显示的相同的拓扑,并将您的配置放入路由器,我能够从 PC0 ping 所有 PC。所有 PC 的 IP 地址都在与路由器 Fa0/1 接口相同的 /24 网络中,并且都将默认网关设置为路由器的 IP (192.168.x.254)。

Cat 3560 的配置:

interface FastEthernet0/1
 switchport trunk allowed vlan 1,20
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface FastEthernet0/2
 switchport trunk allowed vlan 1,30
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface FastEthernet0/3
 switchport trunk allowed vlan 1,30
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface FastEthernet0/4
 switchport trunk allowed vlan 1,20
 switchport trunk encapsulation dot1q
 switchport mode trunk
!

我还在交换机上创建了 VLAN:

Switch(config)# vlan 20
Switch(config)# vlan 30

平结果:

C:\>ping 192.168.2.1

Pinging 192.168.2.1 with 32 bytes of data:

Request timed out.
Reply from 192.168.2.1: bytes=32 time<1ms TTL=126
Reply from 192.168.2.1: bytes=32 time<1ms TTL=126

Ping statistics for 192.168.2.1:
    Packets: Sent = 3, Received = 2, Lost = 1 (34% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Control-C
^C
C:\>ping 192.168.3.1

Pinging 192.168.3.1 with 32 bytes of data:

Request timed out.
Reply from 192.168.3.1: bytes=32 time<1ms TTL=125
Reply from 192.168.3.1: bytes=32 time<1ms TTL=125

Ping statistics for 192.168.3.1:
    Packets: Sent = 3, Received = 2, Lost = 1 (34% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Control-C
^C
C:\>ping 192.168.4.1

Pinging 192.168.4.1 with 32 bytes of data:

Request timed out.
Reply from 192.168.4.1: bytes=32 time<1ms TTL=126
Reply from 192.168.4.1: bytes=32 time=1ms TTL=126

Ping statistics for 192.168.4.1:
    Packets: Sent = 3, Received = 2, Lost = 1 (34% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

Control-C
^C

在再次查看网络图并考虑 OP 得到的提示(“子接口”)之后,我想我现在明白了这意味着什么。

这个答案假设:

  • Cat3560 将参与路由
  • Cat3560 只有一组 VLAN,每个 VLAN 都充当从一个路由器到另一个路由器的点对点链路的仿真,几乎就像它们之间有直接的电缆一样好。
  • 10.10.x.0/30 子网用于这些点对点链路。

有一个替代设置也可以解决这个挑战,但需要 L3 交换(可能是 EIGRP,为了它的乐趣)也可以在 Cat3560 上运行。我更喜欢这种替代方案,但挑战似乎是双重的:在 Cat3560 上使用 VLAN 进行 L2 交换,以及在路由器上使用子接口进行(动态)路由,因此我们将朝着这个方向努力。

这将需要交换机上的一些 VLAN:

vlan 10
 name R0-to-R1

vlan 20
 name R0-to-R3

vlan 30
 name R3-to-R2

vlan 40
 name R2-to-R1

以及将 VLAN 选择性映射到路由器所连接的 4 个交换端口:

int f0/1
 description Router0 fa0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 10,20
 spanning-tree portfast trunk

int f0/2
 description Router1 fa0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 10,40
 spanning-tree portfast trunk

int f0/3
 description Router2 fa0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 30,40
 spanning-tree portfast trunk

int f0/4
 description Router3 fa0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 20,30
 spanning-tree portfast trunk

请注意:从技术上讲,没有必要switchport trunk allowed vlan...在交换机端口上有。创建 VLAN 并将端口设置为mode trunk就足够了。在维护良好的环境中,最好定义给定交换机端口上可接受的 VLAN(组)。

然后,在每个路由器上,您需要

  • LAN 接口 192.168.x.0/24。我将为路由器选择 .1。有些人更喜欢子网中的最后一个地址 (.254) - 这只是给定环境的品味、指南和操作实践的问题。
  • WAN侧两个子接口,用VLAN标签隔开
  • 一个不错的 EIGRP 设置,请参阅命令片段中的注释。

我将举一个路由器的例子——其他的将留给读者作为练习。

!=========
!ROUTER 0
!========

int f0/0
 description Switch0 fast0/1

int f0/0.10
 description Router1 fast0/0.10 (via VLAN 10)
 enapsulation dot1q 10
 ip adress 10.10.0.1 255.255.255.252

int f0/0.20
 description Router3 fast0/0.20 (via VLAN 20)
 encapsulation dot1q 20
 ip adress 10.10.3.1 255.255.255.252

int fa0/1
 description LAN to PC0
 ip address 192.168.1.1 255.255.255.0


router eigrp 1
!
! Summarization is for large networks with multiple hierarchies and
! tiers of routing. 
! It just creates obstacles for a novice. Leave it off. (almost) always.
!
 no auto-summary 
!
! for the sake of clarity, add the to-be-EIGRP-activated 
! interfaces with the host wildcard mask. 
! in EIGRP, the network statements just define a filter list of IP adresses. 
! Interfaces on the router that have an address matching the 
! filter will be enanbled for EIGRP.
!   
 network 192.168.1.1 0.0.0.0
 network 10.10.0.1 0.0.0.0
 network 10.10.3.1 0.0.0.0
!
!
! good practice (optional): Don't be looking for EIGRP neighbors 
! in "client subnets", where there won't be any. 
! Make all interfaces passive, then explicitely enable 
! the (sub)interfaces that will actually have to speak EIGRP 
! to potential neighbors.
!
! YES, it is actually correct and valid to have the LAN 
! side enabled for EIGRP, but then leave it passive.

 passive-interface default
 no passive-interface fast0/0.10
 no passive-interface fast0/0.20