首页 > 应用开发 > IT综合 > ospf+hsrp+stp
标题:路由器RO配置 作者:fd084 时间:2011-03-29 19:27 | |
| interface Serial0/0 ip address 172.168.0.2 255.255.255.248 ip nat outside ip virtual-reassembly encapsulation frame-relay serial restart-delay 0 ! interface Serial0/1 no ip address shutdown serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address shutdown serial restart-delay 0 ! interface Ethernet1/0 ip address 192.168.0.1 255.255.255.0 ip nat inside ip virtual-reassembly full-duplex ! interface Ethernet2/0 ip address 192.168.1.1 255.255.255.0 ip nat inside ip virtual-reassembly full-duplex ! router ospf 100 log-adjacency-changes network 172.168.0.0 0.0.0.255 area 0 network 192.168.0.0 0.0.0.255 area 0 network 192.168.1.0 0.0.0.255 area 0 ! ip http server no ip http secure-server ! ip route 0.0.0.0 0.0.0.0 Serial0/0 ! ip nat pool onlyone 172.168.0.2 172.168.0.2 netmask 255.255.255.252 ip nat inside source list 2 pool onlyone overload ip nat inside source list 3 pool onlyone overload ip nat inside source list 4 pool onlyone overload ip nat inside source list 5 pool onlyone overload ! access-list 2 permit 192.168.2.0 0.0.0.255 access-list 3 permit 192.168.3.0 0.0.0.255 access-list 4 permit 192.168.4.0 0.0.0.255 access-list 5 permit 192.168.5.0 0.0.0.255 ! ! control-plane ! ! ! ! | |
| 标题:说明 作者:fd084 时间:2011-03-29 19:30 | |
| 路由器上做NAT 所有地址转换为172.168.0.2出去 2台核心交换做HSRP 冗余和负载均衡 | |
| 标题:核心交换机配置 作者:fd084 时间:2011-03-29 19:31 | |
| spanning-tree uplinkfast spanning-tree vlan 2 priority 16384 spanning-tree vlan 3 priority 8192 spanning-tree vlan 4 priority 16384 spanning-tree vlan 5 priority 8192 ! ! ! ! ! ! ! interface Port-channel1 switchport mode trunk ! interface FastEthernet0/0 no switchport ip address 192.168.0.2 255.255.255.0 ! interface FastEthernet0/1 switchport mode trunk ! interface FastEthernet0/2 switchport mode trunk ! interface FastEthernet0/3 ! interface FastEthernet0/4 ! interface FastEthernet0/5 ! interface FastEthernet0/6 ! interface FastEthernet0/7 ! interface FastEthernet0/8 ! interface FastEthernet0/9 ! interface FastEthernet0/10 ! interface FastEthernet0/11 ! interface FastEthernet0/12 ! interface FastEthernet0/13 ! interface FastEthernet0/14 switchport mode trunk channel-group 1 mode on ! interface FastEthernet0/15 switchport mode trunk channel-group 1 mode on ! interface Vlan1 no ip address ! interface Vlan2 ip address 192.168.2.1 255.255.255.0 standby 2 ip 192.168.2.254 standby 2 priority 120 standby 2 preempt standby 2 authentication md5 key-string cisco standby 2 track FastEthernet0/0 30 standby 22 ip 192.168.2.253 standby 22 preempt standby 22 authentication md5 key-string cisco ! interface Vlan3 ip address 192.168.3.1 255.255.255.0 standby 3 ip 192.168.3.254 standby 3 priority 120 standby 3 preempt standby 3 authentication md5 key-string cisco standby 3 track FastEthernet0/0 30 standby 33 ip 192.168.3.253 standby 33 preempt standby 33 authentication md5 key-string cisco ! interface Vlan4 ip address 192.168.4.1 255.255.255.0 standby 4 ip 192.168.4.254 standby 4 priority 120 standby 4 preempt standby 4 authentication md5 key-string cisco standby 4 track FastEthernet0/0 30 standby 44 ip 192.168.4.253 standby 44 preempt standby 44 authentication md5 key-string cisco ! interface Vlan5 ip address 192.168.5.1 255.255.255.0 standby 5 ip 192.168.5.254 standby 5 priority 120 standby 5 preempt standby 5 authentication md5 key-string cisco standby 5 track FastEthernet0/0 30 standby 55 ip 192.168.5.253 standby 55 preempt standby 55 authentication md5 key-string cisco ! router ospf 100 log-adjacency-changes network 192.168.0.0 0.0.0.255 area 0 network 192.168.2.0 0.0.0.255 area 0 network 192.168.3.0 0.0.0.255 area 0 network 192.168.4.0 0.0.0.255 area 0 network 192.168.5.0 0.0.0.255 area 0 ! ip http server no ip http secure-server ! ! ! mac-address-table static 0000.0c07.ac02 interface FastEthernet0/15 vlan 2 mac-address-table static 0000.0c07.ac03 interface FastEthernet0/15 vlan 3 mac-address-table static 0000.0c07.ac04 interface FastEthernet0/15 vlan 4 mac-address-table static 0000.0c07.ac05 interface FastEthernet0/15 vlan 5 ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 | |
| 标题:核心2配置 作者:fd084 时间:2011-03-29 19:32 | |
| spanning-tree uplinkfast spanning-tree vlan 2 priority 8192 spanning-tree vlan 3 priority 16384 spanning-tree vlan 4 priority 8192 spanning-tree vlan 5 priority 16384 ! ! ! ! ! ! ! interface Port-channel1 switchport mode trunk ! interface FastEthernet0/0 switchport mode trunk ! interface FastEthernet0/1 switchport mode trunk ! interface FastEthernet0/2 no switchport ip address 192.168.1.2 255.255.255.0 ! interface FastEthernet0/3 ! interface FastEthernet0/4 ! interface FastEthernet0/5 ! interface FastEthernet0/6 ! interface FastEthernet0/7 ! interface FastEthernet0/8 ! interface FastEthernet0/9 ! interface FastEthernet0/10 ! interface FastEthernet0/11 ! interface FastEthernet0/12 ! interface FastEthernet0/13 ! interface FastEthernet0/14 switchport mode trunk channel-group 1 mode on ! interface FastEthernet0/15 switchport mode trunk channel-group 1 mode on ! interface Vlan1 no ip address ! interface Vlan2 ip address 192.168.2.2 255.255.255.0 standby track FastEthernet0/2 30 standby 2 ip 192.168.2.254 standby 2 preempt standby 2 authentication md5 key-string cisco standby 22 ip 192.168.2.253 standby 22 priority 120 standby 22 preempt standby 22 authentication md5 key-string cisco ! interface Vlan3 ip address 192.168.3.2 255.255.255.0 standby 3 ip 192.168.3.254 standby 3 preempt standby 3 authentication md5 key-string cisco standby 33 ip 192.168.3.253 standby 33 priority 120 standby 33 preempt standby 33 authentication md5 key-string cisco standby 33 track FastEthernet0/2 30 ! interface Vlan4 ip address 192.168.4.2 255.255.255.0 standby 4 ip 192.168.4.254 standby 4 preempt standby 4 authentication md5 key-string cisco standby 44 ip 192.168.4.253 standby 44 priority 120 standby 44 preempt standby 44 authentication md5 key-string cisco standby 44 track FastEthernet0/2 30 ! interface Vlan5 ip address 192.168.5.2 255.255.255.0 standby 5 ip 192.168.5.254 standby 5 preempt standby 5 authentication md5 key-string cisco standby 55 ip 192.168.5.253 standby 55 priority 120 standby 55 preempt standby 55 authentication md5 key-string cisco standby 55 track FastEthernet0/2 30 ! router ospf 100 log-adjacency-changes network 192.168.1.0 0.0.0.255 area 0 network 192.168.2.0 0.0.0.255 area 0 network 192.168.3.0 0.0.0.255 area 0 network 192.168.4.0 0.0.0.255 area 0 network 192.168.5.0 0.0.0.255 area 0 ! ip http server no ip http secure-server ! ! ! mac-address-table static 0000.0c07.ac21 interface FastEthernet0/15 vlan 3 mac-address-table static 0000.0c07.ac37 interface FastEthernet0/15 vlan 5 mac-address-table static 0000.0c07.ac16 interface FastEthernet0/15 vlan 2 mac-address-table static 0000.0c07.ac2c interface FastEthernet0/15 vlan 4 ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 |
使用HSRP和OSPF实现网络冗余 网络故障的成因有很多,可能是设备问题,可能是传输线路问题,可能是电源问题,也可能是人为操作失误引起。不说别的因素,其实就网络设备自身来说,由于24小时运行,相信没有一个厂家敢说自己的设备可以永远不出故障。因此网络故障可以说是无法避免的。但是一些重要的业务系统,对网络稳定性的要求非常高,是绝对不允许出现网络中断的。怎么办呢?为了适应这些需求,工程师在网络设计的过程中,通常会使用双设备和双链路的结构实现网络冗余。当主用链路发生故障时,快速自动的切换到备用链路,整个过程网络不中断,可以让用户完全察觉不到故障发生。
本文为大家介绍一个双设备和双链路组网的案例,并介绍如何使用HSRP和OSPF协议实现网络冗余。
一、网络结构和需求
网络结构如下图所示,A业务系统和B业务系统之间需要全天24小时传送重要的数据,不允许网络中断。为了提高网络稳定性,采用了双链路结构。四台路由器组成“口”字形的网络结构,并在路由器各接口之间运行OSPF动态路由协议,任何设备或链路发生故障都可以自动切换路由。R1、R2和R3、R4分别对A业务系统和B业务系统启用HSRP网络冗余协议。
650) this.width=650;" isimg="false" />二、配置方法
1、R1路由器配置
interface FastEthernet0/0
description to R2
ip address 192.168.4.2 255.255.255.252
duplex auto
speed auto
interface Serial0/0
description to R3
ip address 192.168.1.1 255.255.255.252
encapsulation ppp
interface FastEthernet0/1
ip address 10.10.10.2 255.255.255.0
duplex auto
speed auto
standby ip 10.10.10.1 /*配置HSRP的虚地址为10.10.10.1 */
standby priority 120 /*配置优先级为120 */
standby preempt /*允许抢占,即允许根据优先级自动切换主备状态 */
router ospf 1
log-adjacency-changes
network 10.10.10.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.3 area 0
network 192.168.4.0 0.0.0.3 area 0
/*把所有在用的接口地址宣告到OSPF区域0里 */
其他路由器的配置请查看原文链接:使用HSRP和OSPF实现网络冗余
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7868752/viewspace-1055583/ ,如需转载,请注明出处,否则将追究法律责任。