ciso dhcp vlan vrrp ospf 实验
一.拓扑
二.接口配置
IOU1(config)# hostname dhcp
dhcp(config)# int e0/0
dhcp(config-if)# ip add 1.1.1.1 255.255.255.0
dhcp(config-if)# no shut
dhcp(config)# int e0/1
dhcp(config-if)# ip add 2.2.2.1 255.255.255.0
dhcp(config-if)# no shut
IOU2(config)# hostname ospf
ospf(config)# int e0/2
ospf(config-if)# ip add 3.3.3.1 255.255.255.0
ospf(config-if)# no shut
IOU3(config)# hostname switch1
switch1(config)# int e0/0
switch1(config-if)# no switchport
switch1(config-if)# ip add 1.1.1.2 255.255.255.0
switch1(config-if)# no shut
IOU4(config)# hostname switch2
switch2(config)# int e0/1
switch2(config-if)# no switchport
switch2(config-if)# ip add 2.2.2.2 255.255.255.0
switch2(config-if)# no shut
switch2(config)# int e0/2
switch2(config-if)# no switchport
switch2(config-if)# ip add 3.3.3.2 255.255.255.0
switch2(config-if)# no shut
三.DHCP
dhcp(config)# ip dhcp pool vlan2.0
dhcp(dhcp-config)# default-router 192.168.2.1
dhcp(dhcp-config)# network 192.168.2.0 255.255.255.0
dhcp(dhcp-config)# exit
dhcp(config)# ip dhcp pool vlan3.0
dhcp(dhcp-config)# default-router 192.168.3.1
dhcp(dhcp-config)# network 192.168.3.0 255.255.255.0
dhcp(dhcp-config)# exit
dhcp(config)# ip dhcp excluded-address 192.168.2.1 192.168.2.10
dhcp(config)# ip dhcp excluded-address 192.168.3.1 192.168.3.10
DHCP原理,请参考:http://studyit2016.blog.51cto.com/2477884/1897793
四.Vlan
switch1# vlan data
switch1(vlan)# vlan 2 name vlan2.0
switch1(vlan)# vlan 3 name vlan3.0
switch1(vlan)#exit
switch1# conf t
switch1(config)# int vlan 2
switch1(config-if)# ip add 192.168.2.1 255.255.255.0
switch1(config-if)# ip helper-address 1.1.1.1
switch1(config-if)# no shut
switch1(config)# int vlan 3
switch1(config-if)# ip add 192.168.3.1 255.255.255.0
switch1(config-if)# ip helper-address 1.1.1.1
switch1(config-if)# no shut
switch1(config-if)# exit
switch1(config)# int e1/0
switch1(config-if)# switchport trunk encapsulation dot1q
switch1(config-if)# switchport mode trunk
switch2# vlan data
switch2(vlan)# vlan 2 name vlan2.0
switch2(vlan)# vlan 3 name vlan3.0
switch2(vlan)#exit
switch2# conf t
switch2(config)# int vlan 2
switch2(config-if)# ip add 192.168.2.2 255.255.255.0
switch2(config-if)# ip helper-address 1.1.1.1
switch2(config-if)# no shut
switch2(config)# int vlan 3
switch2(config-if)# ip add 192.168.3.2 255.255.255.0
switch2(config-if)# ip helper-address 1.1.1.1
switch2(config-if)# no shut
switch2(config-if)# exit
switch2(config)# int range e1/0 -1
switch2(config-if)# switchport trunk encapsulation dot1q
switch2(config-if)# switchport mode trunk
IOU5(config)# no ip routing
IOU5(config)# host switch3
switch3(config)# exit
switch3# vlan data
switch3(vlan)# vlan 2 name vlan2.0
switch3(vlan)# vlan 3 name vlan3.0
switch3(vlan)#exit
switch3(config)# int range e1/0 -1
switch3(config-if)# switchport trunk encapsulation dot1q
switch3(config-if)# switchport mode trunk
switch3(config)#exit
switch3(config)# int e2/0
switch3(config-if)# switchport access vlan 2
IOU6(config)# no ip routing
IOU6(config)# host switch4
switch4(config)# exit
switch4# vlan data
switch4(vlan)# vlan 2 name vlan2.0
switch4(vlan)# vlan 3 name vlan3.0
switch4(vlan)#exit
switch4(config)# int range e1/0
switch4(config-if)# switchport trunk encapsulation dot1q
switch4(config-if)# switchport mode trunk
switch4(config)#exit
switch4(config)# int e2/0
switch4(config-if)# switchport access vlan 3
Vlan详解,请参考:http://studyit2016.blog.51cto.com/2477884/1907709
五.OSPF
dhcp(config)# router ospf 100
dhcp(config-router)# router-id 10.10.10.10
dhcp(config-router)# network 1.1.1.0 0.0.0.255 a 0
dhcp(config-if)# network 2.2.2.0 0.0.0.255 a 0
switch1(config)# router ospf 100
switch1(config-router)# router-id 20.20.20.20
switch1(config-router)# network 1.1.1.0 0.0.0.255 a 0
switch1(config-router)# network 192.168.2.0 0.0.0.255 a 0
switch1(config-router)# network 192.168.3.0 0.0.0.255 a 0
switch2(config)# router ospf 100
switch2(config-router)# router-id 30.30.30.30
switch2(config-rotuer)# network 3.3.3.0 0.0.0.255 a 1
switch2(config-router)# network 192.168.2.0 0.0.0.255 a 0
switch2(config-router)# network 192.168.3.0 0.0.0.255 a 0
ospf(config)# router ospf 100
ospf(config-router)# router-id 40.40.40.40
ospf(config-router)# network 3.3.3.0 0.0.0.255 a 1
OSF相关概念http://studyit2016.blog.51cto.com/2477884/1947284
http://studyit2016.blog.51cto.com/2477884/1951166
六.VRRP
switch1(config)# int vlan 2
switch1(config-if)# vrrp 1 ip 192.168.2.254
switch1(config-if)# vrrp 1 preempt
switch1(config-if)# vrrp 1 priority 120
switch1(config-if)# vrrp 1 track 1
switch1(config-if)# vrrp 1 track 2
switch1(config)# int vlan 3
switch1(config-if)# vrrp 2 ip 192.168.3.254
switch1(config-if)# vrrp 2 preempt
switch1(config-if)# vrrp 2 priority 95
switch1(config-if)# vrrp 2 track 1
switch1(config-if)# vrrp 2 track 2
switch1(config)# track 1 interface e1/0 line-protocol
switch1(config)# track 2 interface e0/0 line-protocol
switch2(config)# int vlan 2
switch2(config-if)# vrrp 1 ip 192.168.2.254
switch2(config-if)# vrrp 1 preempt
switch2(config-if)# vrrp 1 priority 95
switch2(config-if)# vrrp 1 track 1
switch2(config-if)# vrrp 1 track 2
switch2(config)# int vlan 3
switch2(config-if)# vrrp 2 ip 192.168.3.254
switch2(config-if)# vrrp 2 preempt
switch2(config-if)# vrrp 2 priority 120
switch2(config-if)# vrrp 2 track 1
switch2(config-if)# vrrp 2 track 2
switch2(config)# track 1 interface e1/1 line-protocol
switch2(config)# track 2 interface e0/1 line-protocol
注:vrrp在IOU中测试,虚拟IP不通,需要使用是本地ios测试
STP请参考:http://studyit2016.blog.51cto.com/2477884/1908456
本文转自wanglm51051CTO博客,原文链接:http://blog.51cto.com/studyit2016/1906454 ,如需转载请自行联系原作者