HCIP 三层架构实验

在这里插入图片描述

拓扑和思路

拓扑

在这里插入图片描述

思路

首先划分网段,然后LSW1和LSW2和R1可以用ospf宣告就行,然后R1写条缺省指向R2

然后可以将LSW1和LSW2三合一,给交换机配置换分组,将对应VLAN划分到对应的组,将LSW1作为VLAN1的主设备,作为VLAN1的备用设备。将LSW2作为VLAN2的主设备,作为VLAN1的备用设备。

然后将pc1和pc2分别划分到VLAN1和VLAN2,其他接口可以设置Trunk干道

dhcp可以在LSW1和LSW2上创建地址池,配置跟路由器一样

假设LSW1和LSW2有断连的风险,可以将pc的网关设置成虚拟网关,因为路由器本质其实是通过ip获取的mac地址,这样我们只需要知道mac地址就行了,LSW1和LSW1之间有hello,如果LSW1断了LSW2就然pc获取自己的mac,但是这个只限于接口不变,这样就起到了备份的作用,记住冗余的时候要改优先级,主设备大优

最后外网写条acl就行了

LSW配置

LSW1


LSW1
[LSW1]interface Eth-Trunk 0              将E 0/0/1和E 0/0/2两条链路聚合, 增加带宽 ,提高可靠性
[LSW1]int e0/0/1
[LSW1-Ethernet0/0/1]eth-trunk 0
[LSW1-Ethernet0/0/1]int e0/0/2
[LSW1-Ethernet0/0/2]eth-trunk 0
[LSW1-Ethernet0/0/2]q



[LSW1]port-group group-member Ethernet 0/0/3 Ethernet 0/0/4    设置trunk干道就行了
[LSW1-port-group]port link-type trunk 
[LSW1-Ethernet0/0/3]port link-type trunk 
[LSW1-Ethernet0/0/4]port link-type trunk 
[LSW1-port-group]port trunk allow-pass vlan 2
[LSW1-Ethernet0/0/3]port trunk allow-pass vlan 2
[LSW1-Ethernet0/0/4]port trunk allow-pass vlan 2



[LSW1]int Eth-Trunk 0
[LSW1-Eth-Trunk0]port link-type trunk 
[LSW1-Eth-Trunk0]port trunk allow-pass vlan 2



生成树



[LSW1]stp region-configuration 
[LSW1-mst-region]region-name 1   取名
[LSW1-mst-region]instance 1 vlan 1  将vlan1划入组1
[LSW1-mst-region]instance 2 vlan 2
[LSW1-mst-region]active region-configuration  激活配置





子接口SVI
[LSW1]interface Vlanif 1   这里创建虚拟
[LSW1-Vlanif1]ip address 172.16.1.1 24  设置ip
[LSW1]interface Vlanif 2
[LSW1-Vlanif2]ip address 172.16.2.1 24




[LSW1]stp in
[LSW1]stp instance 1 root primary  当组1的主根    
[LSW1]stp instance 2 root secondary    当组2的备份根


在这里插入图片描述



LSW2

LSW2

[LSW2]interface Eth-Trunk 0            将E 0/0/1和E 0/0/2两条链路聚合, 增加带宽 ,提高可靠性
[LSW2-Eth-Trunk0]int e0/0/1
[LSW2-Ethernet0/0/1]eth-trunk 0
[LSW2-Ethernet0/0/1]int e0/0/2
[LSW2-Ethernet0/0/2]eth-trunk 0
[LSW2-Ethernet0/0/2]q







[LSW2]port-group group-member Ethernet 0/0/4 Ethernet 0/0/3     设置trunk干道
[LSW2-port-group]port link-type trunk   
[LSW2-Ethernet0/0/4]port link-type trunk 
[LSW2-Ethernet0/0/3]port link-type trunk 
[LSW2-port-group]port trunk allow-pass vlan 2
[LSW2-Ethernet0/0/4]port trunk allow-pass vlan 2
[LSW2-Ethernet0/0/3]port trunk allow-pass vlan 2




[LSW2]int Eth-Trunk 0
[LSW2-Eth-Trunk0]port link-type trunk 
[LSW2-Eth-Trunk0]port trunk allow-pass vlan 2




[LSW2]int Vlanif 1
[LSW2-Vlanif1]ip ad
[LSW2-Vlanif1]ip address 172.16.1.2 24
[LSW2-Vlanif1]q
[LSW2]int Vlanif 2
[LSW2-Vlanif2]ip ad
[LSW2-Vlanif2]ip address 172.16.2.2 24






生成树
[LSW2]stp region-configuration     
[LSW2-mst-region] region-name 1     
[LSW2-mst-region] instance 1 vlan 1   将vlan2划分到组1
[LSW2-mst-region] instance 2 vlan 2     将vlan2划分到组2
[LSW2-mst-region] active region-configuration   激活配置




[LSW2]stp instance 1 root secondary   这里选举主从, 显示1是从,2是主
[LSW2]stp instance 2 
[LSW2]stp instance 2 root primary 
[LSW2]

在这里插入图片描述



LSW3

LSW3

[LSW3]port-group group-member Ethernet 0/0/1 Ethernet 0/0/2   设置trunk干道
[LSW3-port-group]port link-type trunk 
[LSW3-Ethernet0/0/1]port link-type trunk 
[LSW3-Ethernet0/0/2]port link-type trunk 
[LSW3-port-group]port trunk allow-pass vlan 2
[LSW3-Ethernet0/0/1]port trunk allow-pass vlan 2
[LSW3-Ethernet0/0/2]port trunk allow-pass vlan 2
[LSW3-port-group]



[LSW3]int e0/0/3
[LSW3-Ethernet0/0/3]port link-type access 
[LSW3-Ethernet0/0/3]port default vlan 1
[LSW3-Ethernet0/0/3]int e0/0/4
[LSW3-Ethernet0/0/4]port link-type access 
[LSW3-Ethernet0/0/4]port default vlan 2
[LSW3-Ethernet0/0/4]

生成树
[LSW3]stp region-configuration
[LSW3-mst-region] region-name 1
[LSW3-mst-region] instance 1 vlan 1
[LSW3-mst-region] instance 2 vlan 2
[LSW3-mst-region] active region-configuration 

### LSW4 LSW4
[LSW4]port-group group-member Ethernet 0/0/1 Ethernet 0/0/2
[LSW4-port-group]port link-type trunk 
[LSW4-Ethernet0/0/1]port link-type trunk 
[LSW4-Ethernet0/0/2]port link-type trunk 
[LSW4-port-group]port trunk allow-pass vlan 2
[LSW4-Ethernet0/0/1]port trunk allow-pass vlan 2
[LSW4-Ethernet0/0/2]port trunk allow-pass vlan 2




[LSW4]int e0/0/3
[LSW4-Ethernet0/0/3]port link-type access 
[LSW4-Ethernet0/0/3]port default vlan 1   
[LSW4-Ethernet0/0/3]int e0/0/4
[LSW4-Ethernet0/0/4]port link-type access    
[LSW4-Ethernet0/0/4]port default vlan 2


生成树

[LSW4]stp region-configuration
[LSW4-mst-region] region-name 1
[LSW4-mst-region] instance 1 vlan 1    将vlan1划分到组1
[LSW4-mst-region] instance 2 vlan 2    将vlan2划分到组2
[LSW4-mst-region] active region-configuration



DHCP

LSW2

interface Vlanif2
 ip address 172.16.2.2 255.255.255.0
 dhcp select global
#

创建的池塘

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

LSW1

#
interface Vlanif1
 ip address 172.16.1.1 255.255.255.0
 dhcp select global
#


创建的池塘
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

ACL外网

在R1和LSW1和LSW2上开启ospf协议然后宣告就行了,可以直接宣告172.16.0.0网段

R2


[R1]ip route-static 0.0.0.0 0 12.1.1.2  先写一条到外网的缺省
[R1]acl n	
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R1-acl-basic-2000]rule permit source 1.1.1.1 0.0.0.0
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]nat outbound 2000

测试
在这里插入图片描述

冗余


[LSW1]int v
[LSW1]int Vlanif 1
[LSW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.250  虚拟网关
[LSW1-Vlanif1]vrrp vrid 1 priority 110   改优先级,大优

[LSW2]int Vlanif 1
[LSW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.250  可以不改优先级,比主低就行

这里显示R1是主
在这里插入图片描述

改下网关试试
在这里插入图片描述

测试
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值