思科hsrp
<R1>
#进入全局配置模式,进入各个接口配置IP地址并设置不关闭接口
conf t
ip routing 开启路由功能
int f0/0
ip add 192.168.100.1 255.255.255.0
no shutdown
int f1/0
ip add 192.168.2.1 255.255.255.0
no shutdown
int f2/0
ip add 192.168.3.1 255.255.255.0
no shutdown
#进入rip,版本2,关闭自动汇总并宣告路由
router rip
version 2
no auto-summary
network 192.168.100.0
network 192.168.2.0
network 192.168.3.0
<ESW1>
#进入vlan数据库模式,创建vlan2
vlan datebase
vlan 2
#开启路由功能,进入接口f0/0关闭交换接口配置ip;然后同时进入f0/1和f0/2两个接口封装trunk,封装类型为dot1q,将交换模式更改为trunk模式
ip routing
int f0/0
no switchport
ip add 192.168.2.1 255.255.255.0
no shutdown
int range f0/1 - 2
switchport trunk encapsulation dot1q
swichport mode trunk
#进入vlan2配置虚接口IP,hsrp组号20虚拟ip为192.168.1.254,优先级200,配置抢占权和端口跟踪,如果跟踪的接口出现故障优先级降100
int vlan 2
ip add 192.168.1.1 255.255.255.0
no shutdown
standby 20 ip 192.168.1.254
standby 20 priority 200
standby 20 preempt
standby 20 track f0/0 100
#进入rip,版本2,关闭自动汇总并宣告路由
router rip
version 2
no auto-summary
network 192.168.2.0
network 192.168.1.0
<ESW2>
#进入vlan数据库模式,创建vlan2
vlan datebase
vlan 2
#开启路由功能,进入接口f0/0关闭交换接口配置ip;然后同时进入f0/1和f0/2两个接口封装trunk,封装类型为dot1q,将交换模式更改为trunk模式
ip routing
int f0/0
no swichport
ip add 192.168.3.2 255.255.255.0
no shutdown
int range f0/1 - 2
switchport trunk encapsulation dot1q
swichport mode trunk
#进入vlan2配置虚接口IP,hsrp组号20虚拟ip为192.168.1.254,优先级150,配置抢占权和端口跟踪,如果跟踪的接口出现故障优先级降100;如果esw1跟踪端口出现故障,那么esw2会抢占为活跃路由器
int vlan 2
ip add 192.168.1.2 255.255.255.0
no shutdown
standby 20 ip 192.168.1.254
standby 20 priority 150
standby 20 preempt
standby 20 track f0/0 100
#进入rip,版本2,关闭自动汇总并宣告路由
router rip
version 2
no auto-summary
network 192.168.2.0
network 192.168.1.0
<ESW3>
#进入vlan数据库模式,创建vlan2
vlan datebase
vlan 2
# 进入f0/0和f0/1两个接口封装trunk,封装类型为dot1q,将交换模式更改为trunk模式
进入f0/2和f0/3两个接口,交换模式为access,将两个接口加入vlan2
int range f0/0 - 1
switchport trunk encapsulation dot1q
swichport mode trunk
int range f0/2 - 3
swichport mode access
swichport access vlan 2
<pc1>ip 192.168.1.5/24 192.168.1.254
<pc2>ip 192.168.1.6/24 192.168.1.254
<pc3>ip 192.168.100.2/24 192.168.100.1
#各pc配IP地址,子网掩码以及网关