免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1261 | 回复: 0
打印 上一主题 下一主题

HSRP(热备份路由协议)配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-03-09 11:49 |只看该作者 |倒序浏览

热备份路由协议(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#
从两次输出看出结果的正确性。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/2108/showart_492279.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP