三层架构实验

文章详细描述了一个网络实验,涉及内网IP的分配、VRRP和STP/VLAN/Trunk配置、OSPF路由、MSTP区域划分、VRRP备份、链路聚合以及NAT设置,实验中PC通过DHCP获取IP,最后进行生成树和VRRP聚合的检查以及PC上网测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实验要求

1、内网IP地址172.16.0.0/16 合理分配
2、SW1/2之间互为备份
3、VRRP/STP/VLAN/TRUNK均使用
4、所有pc通过dhcp获取ip

实验拓扑图

 

实验流程

IP配置

isp

R1

lsw1

lsw2


ospf配置

r1
ospf 1 router-id 1.1.1.1
 default-route-advertise                         
 area 0.0.0.1 
  network 172.16.20.0 0.0.0.3 
  network 172.16.30.0 0.0.0.3 

ip route-static 0.0.0.0 0.0.0.0 10.1.12.2


lsw1
 ospf 1 router-id 2.2.2.2              
 silent-interface GigabitEthernet0/0/4           
 silent-interface GigabitEthernet0/0/5
 silent-interface vlan 1
 silent-interface vlan 2 
  area 0.0.0.0
  network 172.16.1.0 0.0.0.255
  network 172.16.2.0 0.0.0.255
  network 172.16.12.0 0.0.0.3
  area 0.0.0.1
  network 172.16.20.0 0.0.0.3

ip pool a
 gateway-list 172.16.1.254
 network 172.16.1.0 mask 255.255.255.0       #创建地址池
#
ip pool b
 gateway-list 172.16.2.254
 network 172.16.2.0 mask 255.255.255.0

lsw2
 ospf 1 router-id 3.3.3.3
 silent-interface GigabitEthernet0/0/4
 silent-interface GigabitEthernet0/0/5
 silent-interface vlan 1
 silent-interface vlan 2
 area 0.0.0.0
  network 172.16.2.0 0.0.0.255
  network 172.16.1.0 0.0.0.255
  network 172.16.12.0 0.0.0.3
 area 0.0.0.1
  network 172.16.30.0 0.0.0.3

ip pool a
 gateway-list 172.16.1.254
 network 172.16.1.0 mask 255.255.255.0
ip pool b
 gateway-list 172.16.2.254
 network 172.16.2.0 mask 255.255.255.0

stp配置

lsw1
stp instance 1 root primary                  设置该交换机为实例1的生成树主根
stp instance 2 root secondary                设置该交换机为实例2的生成树备根
stp bpdu-protection                             设置BPDU保护,防止网络动荡
stp region-configuration                    进入MSTP区域
 region-name 1                              给该区域取名
 revision-level 1                           更改修订级
 instance 1 vlan 1                          说明vlan1走实例1,实例2是vlan1的备根
 instance 2 vlan 2
 active region-configuration 

lsw2
stp instance 1 root secondary
stp instance 2 root primary
stp bpdu-protection                 
stp region-configuration
 region-name 1
 revision-level 1
 instance 1 vlan 1
 instance 2 vlan 2
 active region-configuration

lsw3

stp bpdu-protection                 
stp region-configuration
 region-name 1
 revision-level 1
 instance 1 vlan 1
 instance 2 vlan 2
 active region-configuration

lsw4

stp bpdu-protection                 
stp region-configuration
 region-name 1
 revision-level 1
 instance 1 vlan 1
 instance 2 vlan 2
 active region-configuration

配置VRRP

lsw1

interface Vlanif1                              配置vlan的地址
 ip address 172.16.1.1 255.255.255.0
 vrrp vrid 1 virtual-ip 172.16.1.254           设置vrrp的虚拟地址
 vrrp vrid 1 priority 120                            设置vrrp的优先级,使该交换机成为vlan1的master
 vrrp vrid 1 preempt-mode timer delay 10        Master出现问题后,backup的抢占时间
 vrrp vrid 1 track interface GigabitEthernet0/0/3 reduced 30    

                                                                                           上游设备出现问题,master 变为backup

interface Vlanif2
 ip address 172.16.2.1 255.255.255.0
 vrrp vrid 1 virtual-ip 172.16.2.254
 vrrp vrid 1 priority 120
 vrrp vrid 1 preempt-mode timer delay 10
 vrrp vrid 1 track interface GigabitEthernet0/0/3 reduced 30

链路聚合

lsw1

interface Eth-Trunk1                           #进入链路聚合
 port link-type trunk                            
 port trunk allow-pass vlan 2 12
 mode lacp-static                              #设置为自动聚合
进接口配置
interface GigabitEthernet0/0/1
 eth-trunk 1
interface GigabitEthernet0/0/2
 eth-trunk 1

lsw2

interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 2 12
 mode lacp-static
进接口配置
interface GigabitEthernet0/0/1
 eth-trunk 1
interface GigabitEthernet0/0/2
 eth-trunk 1

nat配置

acl number 2000  
 rule 5 permit source 172.16.0.0 0.0.255.255 

每个接口起trunk

lsw1

lsw2

lsw3

lsw4

测试

pc1

pc2

pc3

pc4

 查看生成树

lsw1

lsw2

 查看vrrp聚合

R1

lsw1

pc上网

 

安装Docker安装插件,可以按照以下步骤进行操作: 1. 首先,安装Docker。可以按照官方文档提供的步骤进行安装,或者使用适合您操作系统的包管理器进行安装。 2. 安装Docker Compose插件。可以使用以下方法安装: 2.1 下载指定版本的docker-compose文件: curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose 2.2 赋予docker-compose文件执行权限: chmod +x /usr/local/bin/docker-compose 2.3 验证安装是否成功: docker-compose --version 3. 在安装插件之前,可以测试端口是否已被占用,以避免编排过程中出错。可以使用以下命令安装netstat并查看端口号是否被占用: yum -y install net-tools netstat -npl | grep 3306 现在,您已经安装Docker安装Docker Compose插件,可以继续进行其他操作,例如上传docker-compose.yml文件到服务器,并在服务器上安装MySQL容器。可以参考Docker的官方文档或其他资源来了解如何使用DockerDocker Compose进行容器的安装和配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Docker安装docker-compose插件](https://blog.youkuaiyun.com/qq_50661854/article/details/124453329)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [Docker安装MySQL docker安装mysql 完整详细教程](https://blog.youkuaiyun.com/qq_40739917/article/details/130891879)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值