1. //配置路由器接口地址
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 10.0.0.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 20.0.0.1 24
2. //配置交换机 vlan等信息
[sw1]vlan ba 2 3 10
[sw1]int e 0/0/1
[sw1-Ethernet0/0/1]por l a
[sw1-Ethernet0/0/1]po d v 10
[sw1]int Vlanif 10
[sw1-Vlanif10]ip add 10.0.0.2 24
[sw1-Ethernet0/0/1]int e 0/0/5
[sw1-Ethernet0/0/5]po l t
[sw1-Ethernet0/0/5]p t a v a
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]por l a
[sw2-Ethernet0/0/1]po d v 20
[sw2-Ethernet0/0/1]int vlanif 20
[sw2-Vlanif20]ip add 20.0.0.2 24
[sw2]int e0/0/05
[sw2-Ethernet0/0/5]p l t
[sw2-Ethernet0/0/5]p t a v a
3./ 配置ETH-TRUNK
//sw2
[sw2]int Eth-Trunk 1
[sw2-Eth-Trunk1]q
[sw2]int Eth 0/0/3
[sw2-Ethernet0/0/3]eth-trunk 1
[sw2-Ethernet0/0/3]int e0/0/02
[sw2-Ethernet0/0/2]eth 1
[sw2]int Eth-Trunk 1
[sw2-Eth-Trunk1]port l t
[sw2-Eth-Trunk1]port t a v a
//sw1
[sw1]int Eth-Trunk 1
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]eth-trunk 1
[sw1-Ethernet0/0/2]int e0/0/03
[sw1-Ethernet0/0/3]eth-trunk 1
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]port l t
[sw1-Eth-Trunk1]port l trunk
[sw1-Eth-Trunk1]port t a v a
4. //配置vrrp
[sw1]int vlan 2
[sw1-Vlanif2]ip add 12.2.2.1 24
[sw1-Vlanif2]vrrp vrid 2 virtual-ip 12.2.2.12
[sw1-Vlanif2]vrrp vr 2 priority 105
[sw1-Vlanif2]vrrp vrid 2 track interface Ethernet 0/0/1 //追踪上线接口状态,该接口断掉 自动降级(降10)
[sw1]int vlan 3
[sw1-Vlanif3]ip add 12.3.3.1 24
[sw1-Vlanif3]vrrp v 3 v
[sw1-Vlanif3]vrrp v 3 virtual-ip 12.3.3.12
[sw2]int vlan 2
[sw2-Vlanif2]ip add 12.2.2.2 24
[sw2-Vlanif2]vrrp vrid 2 virtual-ip 12.2.2.12
[sw1-Vlanif2]vrrp vrid 2 track interface Eth 0/0/1 //追踪上线接口状态,该接口断掉 自动降级
[sw2-Vlanif2]int vlan 3
[sw2-Vlanif3]ip add 12.3.3.2 24
[sw2-Vlanif3]vrrp vrid 3 virtual-ip 12.3.3.12
[sw2-Vlanif3]vrrp vr 3 priority 105
5. //配置动态路由协议 实现全vlan互通
[r1]ospf 1
[r1-ospf-1]are 0
[r1-ospf-1-area-0.0.0.0]net 10.0.0.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]net 20.0.0.0 0.0.0.255
[sw1]ospf 1
[sw1-ospf-1-area-0.0.0.0]net 10.0.0.1 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]net 12.2.2.1 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]net 12.3.3.1 0.0.0.255
[sw2-ospf-1]are 0
[sw2-ospf-1-area-0.0.0.0]net 12.2.2.2 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]net 12.3.3.2 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]net 20.0.0.2 0.0.0.255
6.//配置接入层交换机
[sw 3]vla b 2 3
[sw 3]int e0/0/1
[sw 3-Ethernet0/0/1]por l t
[sw 3-Ethernet0/0/1]po t a v a
[sw 3]int e 0/0/2
[sw 3-Ethernet0/0/2]p l t
[sw 3-Ethernet0/0/2]p t a v a
[sw 3-Ethernet0/0/1]int e0/0/04
[sw 3-Ethernet0/0/4]port l a
[sw 3-Ethernet0/0/4]port d v 3
[sw 3]int e0/0/3
[sw 3-Ethernet0/0/3]po l a
[sw 3-Ethernet0/0/3]p d v 2
```
三层交换机与路由器互联
最新推荐文章于 2024-04-11 21:44:12 发布