三层架构综合实验
作者:互联网
目录
前言
如何根据实验要求完成本次实验?
实验要求:
1.内网IP地址172.16.0.0/16 合理分配
2.SW1/2之间互为备份
3.VRRP /STP /VLAN /TRUNK均使用
4.所有PC通过DHCP获取IP地址
网络拓扑思路:
1.拓扑设计 ---ip地址规划
2.实施
0)环境部署 ----搭建拓扑----所有的交换技术
E-trunk 创建vlan 划分vlan trunk干道 STP SVI VRRP DHCP
1)配置ip地址 ---所有节点ip ------路由
2)路由----全网可达
3)策略 ---规则 优化 安全
4)测试
5)排错
3.维护
4.升级
实验分析:
1.SW1、SW2间Erunk配置
SW1:
[SW1]int Eth-Trunk 0 --创建Etrunk 0 通道接口
将物理接口加入通道
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]eth-trunk 0
[SW1]int g0/0/4
[SW1-GigabitEthernet0/0/4]eth-trunk 0
SW2:
[SW2]int Eth-Trunk 0 --创建Etrunk 0 通道接口
将物理接口加入通道
[SW2]int g0/0/3
[SW2-GigabitEthernet0/0/3]eth-trunk 0
[SW2]int g0/0/4
[SW2-GigabitEthernet0/0/4]eth-trunk 0
2.创建vlan、划分vlan、trunk干道
SW1:
[SW1]vlan 2 -----创建vlan
[SW1]port-group group-member g0/0/1 g0/0/5 Eth-Trunk 0 ----划分vlan
[SW1-port-group]port link-type trunk
[SW1-port-group]port trunk allow-pass vlan 2
SW2:
[SW2]vlan 2 -----创建vlan
[SW2]port-group group-member g0/0/1 g0/0/5 Eth-Trunk 0 ----划分vlan
[SW2-port-group]port link-type trunk
[SW2-port-group]port trunk allow-pass vlan 2
SW3:
[sw3]vlan 2 ---创建vlan
[sw3]port-group group-member e0/0/3 e0/0/4
[sw3-port-group]port link-type trunk ------trunk模式
[sw3-port-group]port trunk allow-pass vlan 2
[sw3]int e0/0/2 ----access模式int
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
SW4:
[sw4]vlan 2 ---创建vlan
[sw4]port-group group-member e0/0/3 e0/0/4
[sw4-port-group]port link-type trunk ------trunk模式
[sw4-port-group]port trunk allow-pass vlan 2
[sw4]int e0/0/2 ----access模式int
[sw4-Ethernet0/0/2]port link-type access
[sw4-Ethernet0/0/2]port default vlan 2
3.配置STP
SW1:
[SW1]stp mode mstp ---华为默认使用MSTP
[SW1]stp enable ---开启stp
创建MST域
[SW1]stp region-configuration --进入MST域配置视图
[SW1-mst-region]region-name a ----设置域名 所有设备应在一个域内
[SW1-mst-region]instance 1 vlan 1 --将VLAN按照需求划分进实例中
[SW1-mst-region]instance 2 vlan 2
[SW1-mst-region]active region-configuration --- 激活MST域的配置(必须配置该指令)
SW2:
[SW2]stp mode mstp ---华为默认使用MSTP
[SW2]stp enable ---开启stp
创建MST域
[SW2]stp region-configuration --进入MST域配置视图
[SW2-mst-region]region-name a ----设置域名 所有设备应在一个域内
[SW2-mst-region]instance 1 vlan 1 --将VLAN按照需求划分进实例中
[SW2-mst-region]instance 2 vlan 2
[SW2-mst-region]active region-configuration --- 激活MST域的配置(必须配置该指令)
SW3:
[SW3]stp mode mstp ---华为默认使用MSTP
[SW3]stp enable ---开启stp
创建MST域
[SW3]stp region-configuration --进入MST域配置视图
[SW3-mst-region]region-name a ----设置域名 所有设备应在一个域内
[SW3-mst-region]instance 1 vlan 1 --将VLAN按照需求划分进实例中
[SW3-mst-region]instance 2 vlan 2
[SW3-mst-region]active region-configuration --- 激活MST域的配置(必须配置该指令)
SW4:
[SW4]stp mode mstp ---华为默认使用MSTP
[SW4]stp enable ---开启stp
创建MST域
[SW4]stp region-configuration --进入MST域配置视图
[SW4-mst-region]region-name a ----设置域名 所有设备应在一个域内
[SW4-mst-region]instance 1 vlan 1 --将VLAN按照需求划分进实例中
[SW4-mst-region]instance 2 vlan 2
[SW4-mst-region]active region-configuration --- 激活MST域的配置(必须配置该指令)
通过<SW1>display stp brief 查看根网桥所在的交换机并且需要实现SW1、SW2互为主根备份根
SW1:
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
SW2:
[SW2]stp instance 2 root primary
[SW2]stp instance 1 root secondary
查看验证:
优化:--- 给用户相连的交换机端口加速
SW3:
[sw3]port-group group-member e0/0/1 e0/0/2
[sw3-port-group]stp edged-port enable
SW4:
[sw4]port-group group-member e0/0/1 e0/0/2
[sw4-port-group]stp edged-port enable
4.配置SVI
SW1:
[sw1]int vlan 1
[sw1-Vlanif1]ip add 172.16.1.1 25
[sw1]int vlan 2
[sw1-Vlanif2]IP ADD 172.16.1.129 25
SW2:
[SW2]int vlan 1
[SW2-Vlanif1]ip add 172.16.1.2 25
[SW2-Vlanif1]int vlan 2
[SW2-Vlanif2]ip add 172.16.1.130 25
验证:
5.配置VRRP
SW1:
[sw1]int vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface g0/0/2 reduced 6 ----上行链路追踪g0/0/2
[sw1]int vlan 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
SW2:
[SW2]int vlan 1
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[SW2]int vlan 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[sw1-Vlanif2]vrrp vrid 1 priority 105
[SW2-Vlanif2]vrrp vrid 1 track interface g0/0/2 reduced 6
验证:
查看VRRP可以看到在SW1中vlan1为master,vlan2为backup
6.配置DHCP
SW1:
[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.126
[sw1-ip-pool-v1]dns-list 114.114.114.114
[sw1]ip pool v2
[sw1-ip-pool-v2]network 172.16.1.128 mask 25
[sw1-ip-pool-v2]gateway-list 172.16.1.254
[sw1-ip-pool-v2]dns-list 114.114.114.114
[sw1]interface vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global
ip pool v1
gateway-list 172.16.1.126
network 172.16.1.0 mask 255.255.255.128
dns-list 114.114.114.114
ip pool v2
gateway-list 172.16.1.254
network 172.16.1.128 mask 255.255.255.128
dns-list 114.114.114.114
SW2和SW1配置一样,作为地址池的备份
7.配置R1 R2 SW1上行链路的ip
由于华为模拟器的交换机开启路由功能后仍无法配置ip,因此启用SVI模拟
SW1:
[sw1]vlan 99
[sw1]int vlan 99
[sw1-Vlanif99]ip add 172.16.0.2 30
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 99
SW2:
[sw2]vlan 99
[sw2]int vlan 99
[sw2-Vlanif99]ip add 172.16.0.6 30
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]port link-type access
[sw2-GigabitEthernet0/0/2]port default vlan 99
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.0.1 30
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/2]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 172.16.0.5 30
ISP:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2]int LoopBack 0
[R2-LoopBack0]ip add 2.2.2.2 24
8.配置路由OSPF
方法一:R1写一条路由去往下面vlan,汇聚层交换机写两条缺省,在R1接口做NAT
方法二:在汇聚层和核心层跑OSPF---由于OSPF 不支持接口汇总,所以需要两个区域
sw1:
#
ospf 1 router-id 11.11.11.11
area 0.0.0.0
network 172.16.0.2 0.0.0.0
area 0.0.0.1
network 172.16.1.1 0.0.0.0
network 172.16.1.129 0.0.0.0
SW2;
#
ospf 1 router-id 12.12.12.12
area 0.0.0.0
network 172.16.0.6 0.0.0.0
area 0.0.0.1
network 172.16.1.2 0.0.0.0
network 172.16.1.130 0.0.0.0
R1:
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 12.1.1.1 0.0.0.0
network 172.16.0.1 0.0.0.0
network 172.16.0.5 0.0.0.0
9.配置沉默接口
由于svi接口会每隔10s给每个trunk干道发hello包建邻,如果svi数量过多,会影响干道,因此需要沉默接口
SW1:
#
ospf 1 router-id 11.11.11.11
silent-interface all ----当接口数量多时可沉默所有再开
undo silent-interface GigabitEthernet0/0/2
undo silent-interface Eth-Trunk0
undo silent-interface Vlanif1
undo silent-interface Vlanif99
SW2:
#
ospf 1 router-id 12.12.12.12
silent-interface GigabitEthernet0/0/1
silent-interface GigabitEthernet0/0/5
silent-interface Vlanif2
10.汇总
查看R1路由表,发现下面的路由都传上来了,需要汇总一下
SW1:
[sw1]ospf 1
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
SW2:
[sw1]ospf 1
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
再次查看,发现R1路由表已经负载均衡了
11.R1缺省、NAT
R1:
[R1]ip route-static 0.0.0.0 0 12.1.1.2 ----缺省指向运营商
[R1]ospf 1
[R1-ospf-1]default-route-advertise ---将ospf宣告给下面的汇聚层交换机
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R1-acl-basic-2000]int g0/0/2
[R1-GigabitEthernet0/0/2]nat outbound 2000
12.SW1、SW2空接口防环---优化
SW1:
[sw1]ip route-static 172.16.1.0 24 NULL 0
SW2:
[sw2]ip route-static 172.16.1.0 24 NULL 0
13.实验验证--全网可通
当SW1故障时,我们测试PC能否正常上网
标签:SW2,架构,vlan,sw1,实验,172.16,SW1,三层,port 来源: https://blog.csdn.net/qq_48345422/article/details/123023857