Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2590377
  • 博文数量: 351
  • 博客积分: 76
  • 博客等级: 上将
  • 技术积分: 3555
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-13 21:27
文章分类

全部博文(351)

文章存档

2013年(1)

2012年(4)

2011年(7)

2010年(16)

2009年(34)

2008年(34)

2007年(34)

2006年(68)

2005年(82)

2004年(71)

分类: 系统运维

2008-03-09 11:49:33

 

热备份路由协议(HSRP)配置

热备份路由协议配置实验,拓扑图如下:
 

  

以下是.net文件
autostart = False
ghostios = True
sparemem = true
[localhost]
    port = 3600
    udp = 10000
    [[3620]]
        image = H:\tool\dynamips\cisco ios\c3620\c3620-i-mz.122-37.bin
        ram = 32
        confreg = 0x2102
        mmap = True
        exec_area = 32
        slot1 = NM-4T
        idlepc = 0x6042355c
   
    [[router R1]]
        model = 3620
        console = 4001
        S1/0 = R3 S1/0
        F0/0 = SW1 f0/0
    [[router R2]]
        model = 3620
        console = 4002
        S1/0 = R3 S1/1
        F0/0 = SW1 f0/1
    [[router R3]]
        model = 3620
        console = 4003
    [[router PC]]
        model = 3620
        console = 4005
        F0/0 = SW1 f0/2
    [[router SW1]]
        image = H:\tool\dynamips\cisco ios\c3640\c3640-ik9o3s-mz.124-10.bin
        ram = 86
        confreg = 0x2102
        mmap = True
        exec_area = 64
        slot0 = NM-16ESW
        model = 3640
        console = 4004
        idlepc = 0xffffffff855f7844


配置过程如下:

----PC的配置-------
PC#configure terminal
PC(config)#no ip routing
PC(config)#ip default-gateway 192.168.1.100
PC(config)#interface f0/0
PC(config-if)#ip address 192.168.1.200 255.255.255.0
PC(config-if)#no shutdown
PC(config-if)#end

----SW1的配置-------#因为是用Dynamips模拟出的交换机,所以要激活所连接的端口,真的交换机不需要激活,如果端口自动激活此步可省略
SW1#configure terminal
SW1(config)#no ip routing
SW1(config)#int range fa0/0 -2
SW1(config)#no sh
SW1(config)#end
SW1#

----R1的配置-------
R1#configure terminal
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#standby 1 ip 192.168.1.100
R1(config-if)#standby 1 priority 120
R1(config-if)#standby 1 preempt
R1(config-if)#standby 1 track s1/0 30
R1(config-if)#exit
R1(config-if)#interface s1/0
R1(config-if)#ip address 13.13.13.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#end

----R2的配置-------
R2#configure terminal
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#standby 1 ip 192.168.1.100
R2(config-if)#standby 1 priority 100    
R2(config-if)#standby 1 preempt
R2(config-if)#interface s1/1
R2(config-if)#ip address 23.23.23.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#end
----R3的配置-------
R3#configure terminal
R3(config)#interface s1/0
R3(config-if)#ip address 13.13.13.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#interface s1/1
R3(config-if)#ip address 23.23.23.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config-if)#interface loopback 0
R3(config-if)#ip address 202.101.18.8 255.255.255.0
R3(config-if)#end


----PC的配置-------
configure terminal
no ip routing
ip default-gateway 192.168.1.100
interface e0/0
ip address 192.168.1.200 255.255.255.0
no shutdown
end
----R1的配置-------
configure terminal
interface f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
standby 1 ip 192.168.1.100
standby 1 priority 120    
standby 1 preempt      
standby 1 track s1/0 30
interface s1/0
ip address 13.13.13.1 255.255.255.0
no shutdown
end
----R2的配置-------
configure terminal
interface f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
standby 1 ip 192.168.1.100
standby 1 priority 100    
standby 1 preempt      
interface s1/0
ip address 23.23.23.2 255.255.255.0
no shutdown
end
----R3的配置-------
configure terminal
interface s1/0
ip address 13.13.13.3 255.255.255.0
no shutdown
interface s1/1
ip address 23.23.23.3 255.255.255.0
no shutdown
interface loopback 0
ip address 202.101.18.8 255.255.255.0
end

验证:如果想查看配置的结果,可以在R1上输入命令
R1#show standby
可以看到如下信息
   Virtual IP address is 192.168.1.100 configured
   Active router is local
   Standby router is 192.168.1.2 expires in 7.900
说明192.168.1.2是Standby状态
如果禁用R1的s1/0口
R1#configure terminal
R1(config)#interface s1/0
R1(config-if)#shutdown
R1#show standby
可以看到如下信息:
   Virtual IP address is 192.168.1.100 configured
   Active router is 192.168.1.2, priority 100 expires in 7.940
   Standby router is local
说明192.168.1.2是Active状态
当然如果你想在PC上traceroute 202.101.18.8,则必须配置路由协议。
如果你不想让R1和R2通过RIP路由协议发现对方,则可以这样配置
R1(config)#router rip
R1(config-router)#network 13.13.13.0
R1(config-router)#network 192.168.1.0
R1(config-router)#passive-interface f0/0
R2(config)#router rip
R2(config-router)#network 23.23.23.0
R2(config-router)#network 192.168.1.0
R2(config-router)#passive-interface f0/0
现在,可以在PC上试一下traceroute命令
PC#traceroute 202.101.18.8
Type escape sequence to abort.
Tracing the route to 202.101.18.8
  1 192.168.1.1 52 msec 68 msec 20 msec
   2 13.13.13.3 28 msec *   12 msec
PC#
关闭R1的s1/0口,再试
PC#traceroute 202.101.18.8
Type escape sequence to abort.
Tracing the route to 202.101.18.8
  1 192.168.1.2 68 msec 109 msec 32 msec
   2 23.23.23.3 64 msec *   0 msec
PC#
从两次输出看出结果的正确性。
阅读(1865) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~