我有以下设置:
左边的路由器是一个单根路由器,用于在具有不同 VLAN 的 LAN 内路由流量。
左侧交换机是 LAN 的根交换机,用作 VTP 服务器。它也连接到路由器 6。
这是我想要做的:
我想使用这四个路由器将此 LAN 连接到未来的其他 LAN(将以类似的方式与路由器 4 和 5 连接),因为链路必须具有高可用性。
但当然,交换机不能有 2 个默认网关(对吧?),而且我不能为路由器提供同一范围内的 IP 地址。我该如何最好地解决这个问题?这样交换机就可以 ping 通这些路由器中的任何一个,并且将来可以 ping 通另一个 LAN 中的任何设备。
以下是运行配置:
左侧的路由器:
Building configuration...
Current configuration : 1291 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation dot1Q 1 native
ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet0/0.10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
ip helper-address 192.168.2.2
!
interface FastEthernet0/0.20
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
ip helper-address 192.168.2.2
!
interface FastEthernet0/0.30
encapsulation dot1Q 30
ip address 192.168.30.1 255.255.255.0
ip helper-address 192.168.2.2
!
interface FastEthernet0/0.40
encapsulation dot1Q 40
ip address 192.168.40.1 255.255.255.0
ip helper-address 192.168.2.2
!
interface FastEthernet0/0.99
encapsulation dot1Q 99
ip address 192.168.99.1 255.255.255.0
ip helper-address 192.168.2.2
!
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
左侧开关:
Building configuration...
Current configuration : 1907 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/2
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/3
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/4
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/5
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/6
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/7
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/8
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/9
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/10
switchport trunk native vlan 99
switchport mode trunk
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet1/1
switchport trunk native vlan 99
switchport mode trunk
!
interface GigabitEthernet1/2
switchport trunk native vlan 99
switchport mode trunk
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
no ip address
!
interface Vlan20
no ip address
!
interface Vlan30
no ip address
!
interface Vlan40
no ip address
!
interface Vlan99
ip address 192.168.1.2 255.255.255.0
!
ip default-gateway 192.168.1.1
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end
路由器6
Building configuration...
Current configuration : 630 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 172.16.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.2.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0/0
no ip address
!
interface Serial0/0/1
no ip address
!
interface Serial0/1/0
no ip address
!
interface Serial0/1/1
no ip address
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end
答案1
您想研究 HSRP。基本上,路由器 5 和路由器 6 将共享 192.168.1.1,但它们的实际地址将是 .200 和 .201(例如)。
HSRP 是为了让非路由(静态)主机能够享受高可用性的好处。这是这个想法的要点,我稍后会添加更多配置。
答案2
HSRP 可能是您的最佳选择,但由于您似乎正在运行路由协议,因此您可以考虑传递默认路由。只需确保您有一个具有高度量(如 254)的备用默认路由作为备份或帮助网络冷启动即可。
L3 3550 似乎支持的另一个选项是使用ip sla
和跟踪表。我没有在交换机上使用它,但曾在分支路由器上成功使用它,当路由无法 ping 通时切换默认路由。
ip sla 4
icmp-echo 10.10.10.2 source-interface FastEthernet0
threshold 1000
frequency 5
ip sla schedule 4 life forever start-time now
track 4 ip sla 4
delay down 5 up 3
ip route 0.0.0.0 0.0.0.0 1.1.1.1 track 4
轨迹表也可以与路线图一起使用set ip next-hop verify-availability 1.1.1.1 250 track 4
我猜这些可能适用于 L3 3560 或 2960 或更高版本,但不能肯定。我仍然会投票通过 OSPF 传递默认路由 :)