sw-B(config-if)#no shutdown sw-B(config-if)#exit
sw-B(config)#interface vlan 20
sw-B(config-if)#ip address 192.168.20.1 255.255.255.0 sw-B(config-if)#no shutdown sw-B(config-if)#exit
sw-B(config)#interface vlan 30
sw-B(config-if)#ip address 192.168.30.1 255.255.255.0 sw-B(config-if)#no shutdown sw-B(config-if)#exit
sw-B(config)#interface port-group 1
sw-B(config-if)#switchport mode trunk //设置trunk链路 sw-B(config-if)#switchport trunk allowed vlan all //允许所有Vlan通过trunk链路
sw-B(config-if)# switchport trunk encapsulation dot1q //封装802.1q协议
sw-B(config-if)#interface range fa0/23 – 24 //进入23、24端口
sw-B(config-if-range)#channel-group 1 mode on //端口聚合
下面配置三层交换机上采用SVI方式(switch virtual interface)实现VLAN之间的路由
sw-B>en sw-B#conf ter sw-B#conf ter
sw-B(config)#interface vlan 10
sw-B(config-if)#ip address 192.168.10.1 255.255.255.0 sw-B(config-if)#no shutdown sw-B(config-if)#exit
sw-B(config)#interface vlan 20
sw-B(config-if)#ip address 192.168.20.1 255.255.255.0 sw-B(config-if)#no shutdown sw-B(config-if)#exit
sw-B(config)#interface vlan 2 sw-B(config-if)#interface vlan 30
sw-B(config-if)#ip address 192.168.30.1 255.255.255.0
sw-B(config-if)#no shutdown sw-B(config-if)#exit
在三层交换机上启用Ripv2协议,同时启用端口安全,配置如下:
sw-B(config)#router rip sw-B(config-router)#version 2 sw-B(config-router)#no au
sw-B(config-router)#no auto-summary sw-B(config-router)#network 192.168.10.0 sw-B(config-router)#network 192.168.20.0 sw-B(config-router)#network 192.168.30.0 sw-B(config-router)#network 20.0.0.0 sw-B(config-router)#exit
sw-B(config)#interface range fa0/1 – 3 sw-B(config-if)# switchport mode access sw-B (config-if)# switchport port-security sw-B(config-if)# switchport port-security max 4 以上就是交换机的SW-B的配置,对于PC机的配置如下:
业务部PC机IP地址范围为:192.168.10.2 — 192.168.10.254 网关为:192.168.10.1
财务部部PC机IP地址范围为:192.168.20.2 — 192.168.20.254 网关为:192.168.20.1
综合部PC机IP地址范围为:192.168.30.254 网关为:192.168.30.1
192.168.30.2 — 8.OSPF扩展实验
实验拓扑:
实验目的:掌握OSPF的区域汇总
掌握OSPF的简单口令以及MD5认证
掌握如何修改hello、dead 间隔及cost的值
实验要求:做area1 在向Area0通告时进行汇总
在R1与R2之间做区域的简单口令认证
在R2 与R3之间做区域的MD5认证
修改R3 R4之间的hello、dead 间隔为5、20 修改R4的s0口的cost为80 在所有路由器上开启OSPF邻居日志
实验步骤:步骤1按如上拓扑做好底层配置,并检测相邻设备之间的连通性