步骤一:配置vlan
1.选用5台pc机模拟服务器集群,在此基础上选用5台s3700交换机,启动。
2.用vlan对不同的pc进行划分,进入交换机机命令行,先关闭日志提示,再依次对每台交换机都创建vlan10、vlan20、vlan30、vlan40
3.为了方便操作用sysname 把每台交换机由左到右改设备名为sw1、sw2、sw3、sw4
步骤二:把终端加入对应的vlan
[sw1]in e0/0/1
[sw1-Ethernet0/0/1]port link-type access //配置为接入链路
[sw1-Ethernet0/0/1]port default vlan 10 //将1口加入vlan10
[sw2]in e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 20 //将1口加入vlan20
[sw3]in e0/0/1
[sw3-Ethernet0/0/1]port link-type access
[sw3-Ethernet0/0/1]port default vlan 30 //将1口加入vlan30
[sw4]in e0/0/1
[sw4-Ethernet0/0/1]port link-type access
[sw4-Ethernet0/0/1]port default vlan 40 //将1口加入vlan40
[sw4-Ethernet0/0/1]in e0/0/2
[sw4-Ethernet0/0/2]port link-type access
[sw4-Ethernet0/0/2]port default vlan 40 //将2口也加入vlan40
(可用display vlan 进行查看是否将对应的端口都加入相应的vlan中,如果配置错误可用clear configuration 端口号,然后进入其端口用undo shudown重启端口)
2.对所有的交换机的gbit0/0/1 0/0/2口配置中继链路
[sw1-Ethernet0/0/1]in g0/0/1 //常规手段一个一个接口配置
[sw1-GigabitEthernet0/0/1]port link-type trunk //配置中继链路
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all //放行所有
[sw1-GigabitEthernet0/0/1]in g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[sw2]port-group 1 //或者使用接口组,创建1号接口组
[sw2-port-group-1]group-member GigabitEthernet 0/0/1
GigabitEthernet 0/0/2 //加成员是g1口与g2口
[sw2-port-group-1]port link-type trunk //也同样配置为中继链路
[sw2-port-group-1]port trunk allow-pass vlan all //放行所有
[sw3]port-group 1
[sw3-port-group-1]group-member GigabitEthernet 0/0/1 GigabitEthernet 0/0/2
[sw3-port-group-1]port link-type trunk
[sw3-port-group-1]port trunk allow-pass vlan all
[sw4]port-group 1
[sw4-port-group-1]group-member GigabitEthernet 0/0/1 GigabitEthernet 0/0/2
[sw4-port-group-1]port link-type trunk
[sw4-port-group-1]port trunk allow-pass vlan all
步骤三:添加两台s5700交换机,分别修改名称为sw5与sw6
1,
[Huawei]sysname sw5 //分别修改主机名
[sw5]undo info-center enable //关闭日志
2,
[sw5]vlan batch 10 20 30 40 //批量创建4个vlan
[sw6]vlan batch 10 20 30 40
步骤四:为两台s5700连接了s3700的接口配置中继链路,
1,配置两台s5700的中继链路
[sw5]port-group 1 //由于需要配置g1~g4口,这里使用接口组
[sw5-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/4 //加g1~g4接口
[sw5-port-group-1]port link-type trunk //配置为中继链路
[sw5-port-group-1]port trunk allow-pass vlan all //放行所有
[sw6]port-group 1 //另外一台也是相同配置
[sw6-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/4
[sw6-port-group-1]port link-type trunk
[sw6-port-group-1]port trunk allow-pass vlan all
2,将每台s5700的5口和6口捆绑成链路聚合,并配置中继链路
[sw5]interface Eth-Trunk 1 //创建(进入)链路聚合接口
[sw5-Eth-Trunk1]trunkport GigabitEthernet 0/0/5 0/0/6 //捆绑5口
与6口
[sw5-Eth-Trunk1]port link-type trunk //配置成中继链路
[sw5-Eth-Trunk1]port trunk allow-pass vlan all //放行所有
[sw6]interface Eth-Trunk 1 //sw6的配置一样
[sw6-Eth-Trunk1]trunkport GigabitEthernet 0/0/5 0/0/6
[sw6-Eth-Trunk1]port link-type trunk
[sw6-Eth-Trunk1]port trunk allow-pass vlan all
步骤五:为s5700配置ip地址
Sw5
Vlan10 192.168.10.252
Vlan20 192.168.20.252
Vlan30 192.168.30.252
Vlan40 192.168.40.252
Sw6
Vlan10 192.168.10.253
Vlan20 192.168.20.253
Vlan30 192.168.30.253
Vlan40 192.168.40.253
1,s5700的vlan配置不同ip
[sw5]in vlan 10
[sw5-Vlanif10]ip add 192.168.10.252 24
[sw5-Vlanif10]in vlan 20
[sw5-Vlanif20]ip add 192.168.20.252 24
[sw5-Vlanif20]in vlan 30
[sw5-Vlanif30]ip add 192.168.30.252 24
[sw5-Vlanif30]in vlan 40
[sw5-Vlanif40]ip add 192.168.40.252 24
[sw6]in vlan 10
[sw6-Vlanif10]ip add 192.168.10.253 24
[sw6-Vlanif10]in vlan 20
[sw6-Vlanif20]ip add 192.168.20.253 24
[sw6-Vlanif20]in vlan 30
[sw6-Vlanif30]ip add 192.168.30.253 24
[sw6-Vlanif30]in vlan 40
[sw6-Vlanif40]ip add 192.168.40.253 24
依次为pc配置好ip
Pc1 192.168.10.1
Pc2 192.168.20.1
Pc3 192.168.30.1
Pc4 192.168.40.1
Pc5 192.168.40.2
(然后检测同网段间是否可以互通,如果不通,检查:
1, ip地址
2, 是否所有交换机创建所有vlan
3, pc连接交换机接口的链路是否加入到对应vlan,交换
机与交换机之间的链路是否为trunk)
步骤六:配置vrrp
Sw5 vlan10、vlan20 主 vlan30、vlan40 备
Sw6 vlan10、vlan20 备 vlan30、vlan40 主
[sw5]in vlan 10 //进入vlan10接口
[sw5-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254 //开启vrrp
并配置虚拟路由器ip是10.254
[sw5-Vlanif10]vrrp vrid 10 priority 105 //修改优先级为105
[sw5-Vlanif10]in vlan 20
[sw5-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[sw5-Vlanif20]vrrp vrid 20 priority 105
[sw5-Vlanif20]in vlan 30
[sw5-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[sw5-Vlanif30]in vlan 40
[sw5-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[sw6]in vlan 10
[sw6-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[sw6-Vlanif10]in vlan 20
[sw6-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[sw6-Vlanif20]in vlan 30
[sw6-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[sw6-Vlanif30]vrrp vrid 30 priority 105 //sw6要成为vlan30的主,所以
要修改优先级
[sw6-Vlanif30]in vlan 40
[sw6-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[sw6-Vlanif40]vrrp vrid 40 priority 105 //sw6要成为vlan40的主,所以
要修改优先级
<sw5>display vrrp brief //vrrp配置好之后检查每台三层交换机应该是
两主两备的状态
将所有pc的网关按照所在vlan配置好对应的虚拟路由器的ip,并测试全网互通效果
步骤七:添加两台ar2220路由器
1,
[Huawei]sysname r1 //改名
[r1]in g0/0/0 //进入0接口
[r1-GigabitEthernet0/0/0]ip add 192.168.50.1 24 //配置ip
[sw5]vlan 50 //创建vlan50
[sw5-vlan50]in vlan 50 //进入vlan50
[sw5-Vlanif50]ip add 192.168.50.2 24 //配置ip
[sw5-Vlanif50]in g0/0/7 //进入7口
[sw5-GigabitEthernet0/0/7]port link-type access
[sw5-GigabitEthernet0/0/7]port default vlan 50 //加入vlan50
[r1]in g0/0/1 //进入1接口
[r1-GigabitEthernet0/0/1]ip add 192.168.60.1 24 //配置ip
[sw6]vlan 60 //创建vlan60
[sw6-vlan60]in vlan 60 //进入vlan60
[sw6-Vlanif60]ip add 192.168.60.2 24 //配置ip
[sw6-Vlanif60]in g0/0/7 //进入7口
[sw6-GigabitEthernet0/0/7]port link-type access
[sw6-GigabitEthernet0/0/7]port default vlan 60 //加入vlan60
其他ip按上图配置,此处省略
步骤八:在所有路由器以及s5700配置动态路由
1,
[sw5]ospf //开启动态路由协议ospf
[sw5-ospf-1]area 0 //进入区域0
[sw5-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255 //宣告
直连网段
[sw5-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.70.0 0.0.0.255
[sw6]ospf
[sw6-ospf-1]area 0
[sw6-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.60.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.80.0 0.0.0.255
[r1]ospf //然后在两台路由器上也配置ospf
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.60.0 0.0.0.255
[r2]ospf
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.70.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.80.0 0.0.0.255
然后测试全网互通的效果
dis ip routing-table | include /24 //检查路由表
步骤九:最上端添加s3700一台充当外部网络设备,并配置三个外网ip
1,
[Huawei]in vlan 1
[Huawei-Vlanif1]ip add 100.0.0.10 8
两台路由器的g0/0/2口也按图配置ip,配置步骤此处省略。
步骤十:配置nat
1,
[r1]acl 2000 //创建acl
[r1-acl-basic-2000]rule permit source any //创建规则,放行所有
[r1-acl-basic-2000]in g0/0/2 //进入外网接口
[r1-GigabitEthernet0/0/2]nat outbound 2000 //开启nat
[r2]acl 2000 //第二台路由器配置一样的内容
[r2-acl-basic-2000]rule permit source any
[r2-acl-basic-2000]in g0/0/2
[r2-GigabitEthernet0/0/2]nat outbound 2000
步骤十一:配置默认路由
默认路由,是特殊的静态路由,可以匹配任意网段,专门用来从内部网络访问外部的海量网段时使用
1.
[r1]ip route-static 0.0.0.0 0 100.0.0.10 //路由器配置默认路由,可以访问
任意网络(主要用来匹配海量外网网段)
[r1]ospf
[r1-ospf-1]default-route-advertise //发布默认路由,相当于宣告,然后
下面的三层交换就就可以学习到该默认路由
[r2]ip route-static 0.0.0.0 0 100.0.0.10 //另外一台路由器配置相同
[r2]ospf
[r2-ospf-1]default-route-advertise //发布默认路由
到此为止已经完成所以的配置了