DIY项目拓扑:
DIY项目配置:(路由和交换部分)
一、VTP部分配置(小提示:在配置过程中,如遇到忘记的命令可以用“?”查找和tab补齐)
3L-sw1
1、配置VTP
enable
vlan database
vtp server
vtp domain benet
vtp password benet
vtp pruning
2、划分VLAN
vlan 1 name caiwu
vlan 2 name gongcheng
vlan 3 name server
exit
3、配置trunk
configure terminal
interface range f0/1 -3
switch mode trunk
exit
4、ethernet-channel(以太网通道)的配置
interface range f0/14 -15
switch mode trunk
channel-group 1 mode on
3L-sw2
1、配置VTP
enable
vlan database
vtp server
vtp domain benet
vtp password benet
vtp pruning
2、划分VLAN
vlan 1 name caiwu
vlan 2 name gongcheng
vlan 3 name server
exit
3、配置trunk
configure terminal
interface range f0/1 -3
switch mode trunk
exit
4、ethernet-channel(以太网通道)的配置
interface range f0/14 -15
switch mode trunk
channel-group 1 mode on
2L-sw1
1、配置VTP
enable
vlan database
vtp clinet
vtp domain benet
vtp password benet
exit
2、配置trunk
configure termial
interface range f0/1 -2
switch mode trunk
end
2L-sw2
1、配置VTP
enable
vlan database
vtp client
vtp domain benet
vtp password benet
exit
2、配置trunk
configure terminal
interface range f0/1 -2
switch mode trunk
end
2L-sw3
1、配置VTP
enable
vlan database
vtp client
vtp domain benet
vtp password benet
exit
2、配置trunk
configure terminal
interface range f0/1 -2
switch mode trunk
end
注意:在VTP配置完成之后,注意验证VTP的配置的正确性。
(注意:下面都是在模拟器上用的命令,真实机上也许不是这个命令)
show vlan-switch ##查看vlan的配置信息
show vtp status ##查看vtp的配置信息
show etherchannel 1 summary ##查看ethernet-channel配置信息
show ip interface brief ##查看端口信息
show running-config ##查看所有配置信息
二、STP部分配置
3L-sw1
1、配置vlan1~2的主网桥,vlan3的辅网桥
configure terminal
spanning-tree vlan 1 root primary
spanning-tree vlan 2 root primary
spanning-tree vlan 3 root seconday
3L-sw2
1、配置vlan1~2的辅网桥、vlan3的主网桥
configure terminal
spannig-tree vlan 1 root seconday
spannig-tree vlan 2 root seconday
spannig-tree vlan 3 root primary
2L-sw1
1、配置上行速链路
configure terminal
spanning-tree uplinkfast
2、配置速端口(在这里只用一个接口做范例,真实环境不止有一个接口需配置)
interface f0/3
spanning-tree portfast
2L-sw2
1、配置上行速链路
configure terminal
spanning-tree uplinkfast
2、配置速端口(同上)
interface f0/3
spanning-tree portfast
2L-sw3
1、配置上行速链路
configure terminal
spannig-tree uplinkfast
2、配置速端口(同上)
interface f0/3
spanning-tree portfast
注意:STP配置完成之后,注意验证配置的正确性。
show spanning-tree brief ##查看STP的配置信息
show running-config ##查看全部的配置信息
三、三层交换的配置部分
事先说明:接在2L-sw1上的客户端被划分到了vlan1,并且分配192.168.1.0/24网段IP
接在2L-sw2上的客户端被划分到了vlan2,并且分配192.168.2.0/24网段IP
接在2L-sw3上的服务器被划分到了vlan3,并且分配192.168.3.0/24网段IP
3L-sw1与R1相连,分配的192.168.4.0/24网段IP
3L-sw2与R2相连,分配的192.168.5.0/24网段IP
web、DHCP服务器IP:192.168.3.1
DC、DNS服务器IP:192.168.3.2
exchange服务器IP:192.168.3.3
3L-sw1
1、启动三层交换路由功能
configure terminal
ip routing
2、配置各VLAN的IP地址
interface vlan 1
ip address 192.168.1.253 255.255.255.0
no shutdown
exit
interface vlan 2
ip address 192.168.2.253 255.255.255.0
no shutdown
exit
interface vlan 3
ip addess 192.168.3.253 255.255.255.0
no shutdown
exit
3、在三层交换机上配置路由接口,并配置接口的IP地址
interface f0/0
no switchport
ip address 192.168.4.1 255.255.255.0
no shutdown
exit
4、在三层交换机上配置路由(RIP)
router rip
no auto-summary
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
network 192.168.4.0
exit
5、配置DHCP中继
interface vlan 1
ip helper-address 192.168.3.1
exit
interface vlan 2
ip helper-address 192.168.3.1
exit
3L-sw2
1、启动三层交换路由功能
configure terminal
ip routing
2、配置各VLAN的IP地址
interface vlan 1
ip address 192.168.1.252 255.255.255.0
no shutdown
exit
interface vlan 2
ip address 192.168.2.252 255.255.255.0
no shutdown
exit
interface vlan 3
ip addess 192.168.3.252 255.255.255.0
no shutdown
exit
3、在三层交换机上配置路由接口,并配置接口的IP地址
interface f0/0
no switchport
ip address 192.168.5.1 255.255.255.0
no shutdown
exit
4、在三层交换机上配置路由(RIP)
router rip
no auto-summary
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
network 192.168.5.0
exit
5、配置DHCP中继
interface vlan 1
ip helper-address 192.168.3.1
exit
interface vlan 2
ip helper-address 192.168.3.1
exit
2L-sw1
1、将端口加入相应vlan
enable
configure terminal
interface f0/3
switchport access vlan 1
exit
2L-sw2
1、将端口加入相应vlan
enable
configure terminal
interface f0/3
switchport access vlan 2
exit
2L-sw3
1、将端口加入相应vlan
enable
configure terminal
interface f0/3
switchport access vlan 3
exit
注意:三层交换配置完成之后,注意验证配置的正确性。
show ip interface brief ##显示所有接口信息
show ip cef ##查看FIB表
show adjacency detail ##查看邻接关系表
show ip route ##查看路由表
show running-config ##查看全部配置信息
四、HSRP部分配置
3L-sw1
1、将3L-sw1的vlan1加入备份组1(虚拟路由器IP:192.168.1.254)
enable
configure terminal
interface vlan 1
standby 1 ip 192.168.1.254
##设置优先级
standby 1 priority 200
##配置占先权
standby 1 preempt
##配置路由跟踪
standby 1 track f0/0 60
2、将3L-sw1的vlan2加入备份组2(虚拟路由器IP:192.168.2.254)
enable
configure terminal
interface vlan 2
standby 2 ip 192.168.2.254
##设置优先级
standby 2 priority 200
##配置占先权
standby 2 preempt
##配置路由跟踪
standby 2 track f0/0 60
3、将3L-sw1的vlan3加入备份组3(虚拟路由器IP:192.168.3.254)
enable
configure terminal
interface vlan 3
standby 3 ip 192.168.3.254
##设置优先级
standby 3 priority 150
3L-sw2
1、将3L-sw2的vlan1加入备份组1(虚拟路由器IP:192.168.1.254)
enable
configure terminal
interface vlan 1
standby 1 ip 192.168.1.254
##设置优先级
standby 1 priority 150
2、将3L-sw2的vlan2加入备份组2(虚拟路由器IP:192.168.2.254)
enable
configure terminal
interface vlan 2
standby 2 ip 192.168.2.254
##设置优先级
standby 2 priority 150
3、将3L-sw2的vlan3加入备份组3(虚拟路由器IP:192.168.3.254)
enable
configure terminal
interface vlan 3
standby 3 ip 192.168.3.254
##设置优先级
standby 3 priority 200
##配置占先权
standby 3 preempt
##配置路由跟踪
standby 3 track f0/0 60
注意:HSRP配置完成之后,注意验证配置的正确性。
show standby brief ##查看HSRP组的配置情况