实验目的:
1.掌控中小型园区网络的基本部署
2.熟悉中小型园去网络的部署流程,排错思路等。
实验拓扑:
实验要求:
一.设备管理
- 依据图中拓扑,为不同设备定义主机名
- 全局关闭域名解析
- Console和VTY线路下关闭线路超时并开启输出同步
- 为实现安全登录,要求创建本地用户名为bdqn,密码为benet,并将其调用到console和vty线路下;要求设置特权密码benet,并要求加密存储。
- 所有交换机管理vlan为vlan 1,所在网段为192.168.1.0/24,其中sw1的管理IP为192.168.1.1/24,sw2为192.168.1.2/24,sw3为192.168.1.3/24,要求能够实现远程管理。
二.交换技术
1.Trunk技术
- 所有交换机之间强制启动trunk,并采用802.1Q进行封装
- 全局native vlan定义为vlan10.
- 要求trunk上只允许vlan1,vlan10,vlan20的数据通过。
2.VTP技术
- sw1为server,其他交换机为client。
- vtp管理区域为bdqn,密码为benet。
- 全局开启vtp修剪
- 在sw1上创建vlan10/20,并要求同步。
- 将不同用户接口放入相应的vlan中。
3.STP技术
- 部署PVST,要求sw1为vlan10的root,vlan20的secondary,sw2的vlan20的root, vlan10的secondary,实现负载均衡
- 开启portfast,加速用户接入网络接口
- 开启Uplinkfast,加速直连链路收敛
- 开启Backbonefast,加速骨干链路收敛
4.L3Sithching技术
- sw1身为vlan10的主网关,vlan20的备网关,其中vlan10的地址为192.168.10.252/24,vlan20的地址为192.168.20.252/24;sw2作为vlan20的主网关,vlan10的备网关,其中vlan10的网关为192.168.10.2253/24。
- 在sw1和sw2上部署HSRP,vlan10的网关为192.168.10.254/24,vlan20的网关为192.168.20.254/24
- 在sw1部署dhcp服务,方便不同vlan的主机接入网络,其中主dns为202.96.128.96,备用为119.29.29.29
- 在三层交换机上开启三层接口功能,并要求vlan间主机能够互相通信
5.Ethernetchannel技术
为实现链路冗余并提供网络宽带,要求在汇聚层交换机之间部署L2 Ethernetchannel技术。
6.Port-Security技术
- 为实现用户接入安全,要求所有用户接入接口启用端口安全技术。
- 开启地址学习,并定义最大MAC数为1
- 定义用户违法规则为shutdown模式,并要求在30s后自动恢复
三.路由技术
- 在三层交换机sw1,sw2和R1部署动态路由协议OSPF,并通告到骨干区域中。
- 在边缘路由器R1上部署默认路由,用与访问互联网。
四.安全策略
- 要求只允许管理员地址192.168.10.1/24能够远程访问边缘路由器R1。
- 为实现内网主机访问互联网,要求部署PAT技术
实验开始,配置命令如下
先给SW1和SW2配置主机名
SW1(config)#hostname 3F_hx01
SW2(config)#hostname 3F_hx02
然后关闭全局域名解析,console和vty线路下关闭线路超时并开启输出同步
SW1
3F_hx01(config)#no ip domain-lookup
3F_hx01(config)#line console 0
3F_hx01(config-line)#logging synchronous
3F_hx01(config-line)#exec-timeout 0 0
3F_hx01(config-line)#exit
创建本地用户名bdqn,密码benet,并将其调用console和vty线路下;
要求设置特权密码benet,并要求加密存储
SW1
3F_hx01(config)#username bdqn privilege 15 password benet
3F_hx01(config)#line console 0
3F_hx01(config-line)#login local
3F_hx01(config-line)#exit
3F_hx01(config)#enable secret benet
SW2
3F_hx02(config)#username bdqn privilege 15 password benet
3F_hx02(config)#enable secret benet
3F_hx02(config)#line console 0
3F_hx02(config-line)#login local
3F_hx02(config-line)#exit
然后在各个SW中配置VLAN1接口
SW1
3F_hx01(config)#interface vlan 1
3F_hx01(config-if)#ip address 192.168.1.1 255.255.255.0
3F_hx01(config-if)#no shutdown
3F_hx01(config-if)#ex
SW2
3F_hx02(config)#interface vlan 1
3F_hx02(config-if)#ip address 192.168.1.2 255.255.255.0
3F_hx02(config-if)#no shutdown
3F_hx02(config-if)#exit
SW3
SW3(config)#interface vlan 1
SW3(config-if)#ip address 192.168.1.3 255.255.255.0
SW3(config-if)#no shutdown
SW3(config-if)#ex
然后对
- 所有交换机之间强制启动trunk,并采用802.1Q进行封装
- 全局native vlan定义为vlan10.
- 要求trunk上只允许vlan1,vlan10,vlan20的数据通过。
SW1
3F_hx01(config)#interface range ethernet 0/1-3
3F_hx01(config-if-range)#switchport trunk encapsulation dot1q
3F_hx01(config-if-range)#switchport mode trunk
3F_hx01(config-if-range)#switchport trunk native vlan 10
3F_hx01(config-if-range)#switchport trunk allowed vlan 1,10,20
3F_hx01(config-if-range)#exit
SW2
3F_hx02(config)#interface range ethernet 0/1-3
3F_hx02(config-if-range)#switchport trunk encapsulation dot1q
3F_hx02(config-if-range)#switchport trunk native vlan 10
3F_hx02(config-if-range)#switchport trunk allowed vlan 1,10,20
3F_hx02(config-if-range)#exit
SW3
IOU5(config)#interface range ethernet 0/0-1
IOU5(config-if-range)#switchport trunk encapsulation dot1q
IOU5(config-if-range)#switchport mode trunk Ethernet0/3 (10).
IOU5(config-if-range)#switchport trunk native vlan 10
IOU5(config-if-range)#switchport trunk allowed vlan 1,10,20
IOU5(config-if-range)#exit
- 接下来就是VTP技术了
- sw1为server,其他交换机为client
- vtp管理为bdqn,密码为benet
- 全局开启vtp修建
- 在sw1上创建vlan10,20,并要求同步
- 将不同的用户接口放入相应的vlan接口中
SW1
3F_hx01(config)#vtp domain bdqn
3F_hx01(config)#vtp mode server
3F_hx01(config)#vtp password benet
3F_hx01(config)#vtp pruning
3F_hx01(config)#vlan 10,20
3F_hx01(config-vlan)#exit
SW2
3F_hx02(config)#vtp domain bdqn
3F_hx02(config)#vtp mode client
3F_hx02(config)#vtp password benet
SW3
IOU5(config)#vtp domain bdqn
IOU5(config)#vtp mode client
IOU5(config)#vtp password benet
IOU5(config)#interface ethernet 0/2
IOU5(config-if)#switchport mode access
IOU5(config-if)#switchport access vlan 10
IOU5(config-if)#exit
IOU5(config)#interface ethernet 0/3
IOU5(config-if)#switchport mode access
IOU5(config-if)#switchport access vlan 20
IOU5(config-if)#exit
这里要用到show vlan 查看vlan是否创建
- 然后是STP技术
- 部署pvst,要求sw1为vlan10的root,vlan20的secondary,sw2为vlan20的root,vlan10的secondary,实现负载均衡
- 开启Portfast,加速用户接入网络接口
- 开启Uplinkfast,加速直连链路收敛
- 开启Backbonefast,加速骨干链路收敛
SW1
3F_hx01(config)#spanning-tree vlan 10 root primary
3F_hx01(config)#spanning-tree vlan 20 root secondary
3F_hx01(config)#spanning-tree backbonefast
SW2
3F_hx02(config)#spanning-tree vlan 10 root secondary
3F_hx02(config)#spanning-tree vlan 20 root primary
3F_hx02(config)#spanning-tree backbonefast
然后用show spanning-tree vlan10/20来查看spanning-tree是否配置正确
SW3
IOU5(config)#interface e0/2
IOU5(config-if)#spanning-tree portfast edge
IOU5(config-if)#exit
IOU5(config)#interface ethernet 0/3
IOU5(config-if)#spanning-tree portfast edge
IOU5(config-if)#exit
IOU5(config)#spanning-tree uplinkfast
IOU5(config)#spanning-tree backbonefast
接下来就是L3switching技术了
- sw1身为vlan10的主网关,vlan20的备网关,其中vlan10的地址为192.168.10.252/24,vlan20的地址为192.168.20.252/24;sw2作为vlan20的主网关,vlan10的备网关,其中vlan10的网关为192.168.10.2253/24。
- 在sw1和sw2上部署HSRP,vlan10的网关为192.168.10.254/24,vlan20的网关为192.168.20.254/24
- 在sw1部署dhcp服务,方便不同vlan的主机接入网络,其中主dns为202.96.128.96,备用为119.29.29.29
- 在三层交换机上开启三层接口功能,并要求vlan间主机能够互相通信
SW1
3F_hx01(config)#interface vlan 10
3F_hx01(config-if)#ip address 192.168.10.252 255.255.255.0
3F_hx01(config-if)#standby 10 ip 192.168.10.254
3F_hx01(config-if)#standby 10 priority 110
3F_hx01(config-if)#standby 10 preempt
3F_hx01(config-if)#no shutdown
3F_hx01(config-if)#exit
3F_hx01(config)#track 100 interface ethernet 0/0 line-protocol
3F_hx01(config-track)#exit
3F_hx01(config)#interface vlan 10
3F_hx01(config-if)#standby track 100 decrement 30
3F_hx01(config-if)#exit
3F_hx01(config)#interface vlan 20
3F_hx01(config-if)#ip address 192.168.20.252 255.255.255.0
3F_hx01(config-if)#standby 20 ip 192.168.20.254
3F_hx01(config-if)#standby 20 priority 90
3F_hx01(config-if)#standby 20 preempt
3F_hx01(config-if)#no shutdown
3F_hx01(config-if)#exit
3F_hx01(config)#ip dhcp pool vlan10
3F_hx01(dhcp-config)#network 192.168.10.0 /24
3F_hx01(dhcp-config)#default-router 192.168.10.254
3F_hx01(dhcp-config)#dns-server 8.8.8.8
3F_hx01(dhcp-config)#exit
3F_hx01(config)#ip dhcp pool vlan20
3F_hx01(dhcp-config)#network 192.168.20.0 /24
3F_hx01(dhcp-config)#default-router 192.168.20.254
3F_hx01(dhcp-config)#dns-server 8.8.8.8
3F_hx01(dhcp-config)#exit
3F_hx01(config)#ip routing
3F_hx01(config)#ip dhcp pool vlan20
3F_hx01(dhcp-config)#dns-server 9.9.9.9 8.8.8.8
3F_hx01(dhcp-config)#exit
SW2
3F_hx02(config)#interface vlan 10
3F_hx02(config-if)#ip address 192.168.10.253 255.255.255.0
3F_hx02(config-if)#standby 10 ip 192.168.10.254
3F_hx02(config-if)#standby 10 priority 90
3F_hx02(config-if)#standby 10 preempt
3F_hx02(config-if)#no shutdown
3F_hx02(config-if)#exit
3F_hx02(config)#track 100 interface ethernet 0/0 line-protocol
3F_hx02(config-track)#exit
3F_hx02(config)#interface vlan 20
3F_hx02(config-if)#ip address 192.168.20.253 255.255.255.0
3F_hx02(config-if)#standby 20 ip 192.168.20.254
3F_hx02(config-if)#standby 20 priority 110
3F_hx02(config-if)#standby 20 preempt
3F_hx02(config-if)#standby 20 track 100 decrement 30
3F_hx02(config-if)#no shutdown
3F_hx02(config-if)#exit
然后在PC1和PC2中给接口启用dhcp服务
PC1
PC1(config)#interface ethernet 0/0
PC1(config-if)#duplex full
PC1(config-if)#ip address dhcp
PC1(config-if)#no shutdown
PC1(config-if)#exit
PC2
PC2(config)#interface ethernet 0/0
PC2(config-if)#duplex full
PC2(config-if)#ip address dhcp
PC2(config-if)#no shutdown
PC2(config-if)#exit
然后PC1和PC2之间ping一下
接下来是Ethernetchannel技术
为实现链路冗余并提供网络宽带,要求在汇聚层交换机之间部署L2 Ethernetchannel技术。
SW1
3F_hx01(config)#interface range ethernet 0/1-2
3F_hx01(config-if-range)#channel-group 1 mode on
3F_hx01(config-if-range)#exit
3F_hx01(config)#interface port-channel 1
3F_hx01(config-if)#switchport trunk encapsulation dot1q
3F_hx01(config-if)#switchport mode trunk
3F_hx01(config-if)#switchport trunk native vlan 10
3F_hx01(config-if)#switchport trunk allowed vlan 1,10,20
SW2
3F_hx02(config)#interface range ethernet 0/1-2
3F_hx02(config-if-range)#channel-group 1 mode on
3F_hx02(config-if-range)#exit
3F_hx02(config)#interface port-channel 1
3F_hx02(config-if)#switchport trunk encapsulation dot1q
3F_hx02(config-if)#switchport mode trunk
3F_hx02(config-if)#switchport trunk native vlan 10
3F_hx02(config-if)#switchport trunk allowed vlan 1,10,20
3F_hx02(config-if)#exit
然后是port-security技术
- 为实现用户接入安全,要求所有用户接入接口启用端口安全技术。
- 开启地址学习,并定义最大MAC数为1
- 定义用户违法规则为shutdown模式,并要求在30s后自动恢复
SW3
IOU5(config)#interface range ethernet 0/2-3
IOU5(config-if-range)#switchport port-security
IOU5(config-if-range)#exit
IOU5(config)#interface range ethernet 0/2-3
IOU5(config-if-range)#switchport port-security mac-address sticky
IOU5(config-if-range)#switchport port-security maximum 1
IOU5(config-if-range)#switchport port-security violation shutdown
IOU5(config-if-range)#exit
IOU5(config)#errdisable recovery cause all
IOU5(config)#errdisable recovery interval 60
然后是路由技术
SW1
3F_hx01(config)#interface ethernet 0/0
3F_hx01(config-if)#no switchport
3F_hx01(config-if)#ip address 172.16.1.1 255.255.255.0
3F_hx01(config-if)#no shutdown
3F_hx01(config-if)#exit
SW2
3F_hx02(config)#interface ethernet 0/0
3F_hx02(config-if)#no switchport
3F_hx02(config-if)#ip address 172.16.2.1 255.255.255.0
3F_hx02(config-if)#no shutdown
3F_hx02(config-if)#ex
R1
IOU1(config)#interface ethernet 0/1
IOU1(config-if)#duplex full
IOU1(config-if)#ip address 172.16.1.2 255.255.255.0
IOU1(config-if)#no shutdown
IOU1(config-if)#exit
IOU1(config)#interface ethernet 0/2
IOU1(config-if)#duplex full
IOU1(config-if)#ip address 172.16.2.2 255.255.255.0
IOU1(config-if)#no shutdown
IOU1(config-if)#exit
IOU1(config)#interface loopback 0
IOU1(config-if)#ip address 1.1.1.1 255.255.255.255
IOU1(config-if)#exit
R2
IOU2(config)#interface ethernet 0/0
IOU2(config-if)#duplex full
IOU2(config-if)#ip address 100.1.1.2 255.255.255.0
IOU2(config-if)#no shutdown
IOU2(config-if)#exit
IOU2(config)#interface loopback 0
IOU2(config-if)#ip address 2.2.2.2 255.255.255.255
IOU2(config-if)#exit
在三层交换机sw1、sw2和r1上部署动态路由协议ospf,并通告到骨干区域中
SW1
3F_hx01(config-router)#router-id 3.3.3.3
3F_hx01(config-router)#network 172.16.1.0 0.0.0.255 area 0
3F_hx01(config-router)#redistribute connected subnets
SW2
3F_hx02(config)#router ospf 1
3F_hx02(config-router)#router-id 4.4.4.4
3F_hx02(config-router)#network 172.16.2.0 0.0.0.255 area 0
3F_hx02(config-router)#redistribute connected subnets
3F_hx02(config-router)#exit
R1
IOU1(config-router)#router-id 1.1.1.1
IOU1(config-router)#network 1.1.1.1 0.0.0.0 area 0
IOU1(config-router)#network 172.16.1.0 0.0.0.255 area 0
IOU1(config-router)#network 172.16.2.0 0.0.0.255 area 0
IOU1(config-router)#default-information originate always
IOU1(config-router)#exit
在边缘路由器R1上部署默认路由,用于访问互联网
R1
IOU1(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.2
使用show ip route查看路由表确认路由是否配置正确
最后就是安全策略
要求只允许管理员地址192.168.10.1能够远程访问边缘路由器R1
R1
IOU1(config)#access-list 1 permit host 192.168.10.1
IOU1(config)#username bdqn privilege 15 password benet
IOU1(config)#line vty 0 4
IOU1(config-line)#login local
IOU1(config-line)#transport input telnet
IOU1(config-line)#access-class 1 in
IOU1(config-line)#exit
为实现内网主机访问互联网,要求部署PAT技术
R1
IOU1(config)#ip nat inside source list 2 interface ethernet 0/0 overload
IOU1(config)#interface ethernet 0/1
IOU1(config-if)#ip nat inside
IOU1(config-if)#exit
IOU1(config)#interface ethernet 0/2
IOU1(config-if)#ip nat inside
IOU1(config-if)#exi
实验结束