三层架构综合实验(2.7)

Posted 未知百分百

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了三层架构综合实验(2.7)相关的知识,希望对你有一定的参考价值。

目标:

 一、首先需要对172.16.0.0 26这个地址基于该图进行合理的划分;

172.16.0.0 16 

172.16.1.0 25(vlan1)

172.16.2.128 25(vlan2)

172.16.3.0 24(r1-r2)

LSW1:

SVI1:172.16.1.10 25 vlan1
SVI2:172.16.1.210 25 vlan2

LSW2:

SVI1:172.16.1.20 25 vlan1
SVI2:172.16.1.220 25 vlan2

二、现在进行交换机部分的配置

配置顺序:CHNNEL VLAN TRUNK STP SVI VRRP DHCP

(1)首先在sw1与sw2之间进行chnnel的创建逻辑的将两条线捆绑为一条线

[sw1]int Eth-Trunk 0
[sw1]int gi 0/0/4
[sw1-GigabitEthernet0/0/4]eth-trunk 0
[sw1-GigabitEthernet0/0/3]eth-trunk 0

[sw2]int Eth-Trunk 0
[sw2-Eth-Trunk0]int gi 0/0/4
[sw2-GigabitEthernet0/0/4]eth-trunk 0
[sw2-GigabitEthernet0/0/3]eth-trunk 0

(2)在sw3和sw4上创建vlan2并且将其划分到对应的接口,并且创建trunk干道

[sw1]vlan 2    
[sw1]port-group group-member GigabitEthernet 0/0/2 gi 0/0/5 Eth-Trunk 0
[sw1-GigabitEthernet0/0/2]port link-type trunk 
[sw1-GigabitEthernet0/0/5]port link-type trunk 
[sw1-Eth-Trunk0]port link-type trunk 
[sw1-port-group]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/5]port trunk allow-pass vlan 2
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2

[sw2]vlan 2
[sw2]port-group group-member gi 0/0/2 gi 0/0/5 Eth-Trunk 0
[sw2-GigabitEthernet0/0/2]port link-type trunk 
[sw2-GigabitEthernet0/0/5]port link-type trunk 
[sw2-Eth-Trunk0]port link-type trunk 
[sw2-port-group]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/5]port trunk allow-pass vlan 2
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2

[sw3]vlan 2
[sw3]int e 0/0/3
[sw3-Ethernet0/0/3]port link-type access 
[sw3-Ethernet0/0/3]port default vlan 2
[sw3]port-group group-member e 0/0/2 e 0/0/5
[sw3-port-group]port link-type tr    
[sw3-port-group]port link-type trunk 
[sw3-Ethernet0/0/2]port link-type trunk 
[sw3-Ethernet0/0/5]port link-type trunk 
[sw3-port-group]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/2]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/5]port trunk allow-pass vlan 2

[sw4]vlan 2
[sw4]int e 0/0/3
[sw4-Ethernet0/0/3]port link-type access 
[sw4-Ethernet0/0/3]port default vlan 2
[sw4]port-group group-member e 0/0/5 e 0/0/2
[sw4-port-group]port link-type trunk 
[sw4-Ethernet0/0/5]port link-type trunk 
[sw4-Ethernet0/0/2]port link-type trunk 
[sw4-port-group]port trunk allow-pass vlan    
[sw4-port-group]port trunk allow-pass vlan 2
[sw4-Ethernet0/0/5]port trunk allow-pass vlan 2
[sw4-Ethernet0/0/2]port trunk allow-pass vlan 2

(3)现在需要进行STP生成树的配置

要求:sw1与sw2之间要进行备份

配置方案:SW1为组1的根(vlan2的备份根) SW2为组2的根(vlan1的备份根)

具体配置:

[sw1]stp enable 
[sw1]stp region-configuration 
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration 
[sw1]stp instance 1 root primary 
[sw1]stp instance 2 root secondary

[sw2]stp enable 
[sw2]stp region-configuration
[sw2-mst-region] region-name a
[sw2-mst-region] instance 1 vlan 1
[sw2-mst-region] instance 2 vlan 2
[sw2-mst-region] active region-configuration
[sw2]stp instance 1 root secondary 
[sw2]stp instance 2 root primary 

[sw3]stp enable 
[sw3]stp region-configuration
[sw3-mst-region] region-name a
[sw3-mst-region] instance 1 vlan 1
[sw3-mst-region] instance 2 vlan 2
[sw3-mst-region] active region-configuration
[sw3]port-group group-member e0/0/1 e 0/0/3
[sw3-port-group]stp edged-port enable 
[sw3-Ethernet0/0/1]stp edged-port enable 边缘接口
[sw3-Ethernet0/0/3]stp edged-port enable 边缘接口

[sw4]stp enable 
[sw4]stp region-configuration
[sw4-mst-region] region-name a
[sw4-mst-region] instance 1 vlan 1
[sw4-mst-region] instance 2 vlan 2
[sw4-mst-region] active region-configuration
[sw4]port-group group-member e 0/0/1 e 0/0/3
[sw4-port-group]stp edged-port enable 
[sw4-Ethernet0/0/1]stp edged-port enable 边缘接口
[sw4-Ethernet0/0/3]stp edged-port enable 边缘接口


查看后发现STP已经做到了vlan1和vlan2都有备份的要求

(4)进行SVI的创建和配置和进行VRRP的配置,即进行网关备份配置

首先在SW1和SW2上创建SVI1和SVI2并且配置ip:

[sw1]int vlan1
[sw1-Vlanif1]ip add 172.16.1.10 25
[sw1-Vlanif1]int vlan2
[sw1-Vlanif2]ip add 172.16.1.210 25

[sw2]int vlan 1
[sw2-Vlanif1]ip add 172.16.1.20 25
[sw2-Vlanif1]int vlan 2
[sw2-Vlanif2]ip add 172.16.1.220 25

下来进行VRRP的配置:

[sw1]int vlan1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.30 配置
[sw1-Vlanif1]vrrp vrid 1 priority 105 修改优先级
[sw1-Vlanif1]vrrp vrid 1 track interface gi 0/0/1 上行链路追踪

[sw1]int vlan 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.230

[sw2]int vlan1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.30
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.230
[sw2-Vlanif2]vrrp vrid  1 priority 105
[sw2-Vlanif2]vrrp vrid 1 track interface gi 0/0/1

查看:

(5)最后在SW1和SW2上创建DHCP

SW1:

[sw1]dhcp enable  
[sw1]ip pool a
[sw1-ip-pool-a]network 172.16.1.0 mask 25
[sw1-ip-pool-a]gateway-list 172.16.1.30
[sw1-ip-pool-a]dns-list 14.14.14.14
[sw1]ip pool b
Info:It's successful to create an IP address pool.
[sw1-ip-pool-b]network 172.16.1.128 mask 25
[sw1-ip-pool-b]gateway-list 172.16.1.230
[sw1-ip-pool-b]dns-list 14.14.14.14

[sw1]int Vlanif 1
[sw1-Vlanif1]dhcp select global 
[sw1-Vlanif2]dhcp select global 

SW2:

[sw2]dhcp enable 
[sw2]ip pool a
[sw2-ip-pool-a]network 172.16.1.0 mask 25
[sw2-ip-pool-a]gateway-list  172.16.1.30
[sw2-ip-pool-a]dns-list 14.14.14.14
[sw2-ip-pool-b]network 172.16.1.128 mask 25
[sw2-ip-pool-b]gateway-list 172.16.1.230
[sw2-ip-pool-b]dns-list 14.14.14.14
[sw2-ip-pool-b]q
[sw2]int Vlanif 1
[sw2-Vlanif1]dhcp select global 
[sw2]int vlan2
[sw2-Vlanif2]dhcp select global

现在在下面的pc上开启DHCP自动获取ip

pc1:

 pc2:

 三、现在交换机部分已经配置完成了,下来配置路由器部分

首先配置公网:

[ISP]int gi 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 172.16.3.1 24
[ISP-GigabitEthernet0/0/0]int lo0
[ISP-LoopBack0]ip add 1.1.1.1 24

r1和下面的两个三层交换机

[r1]int gi 0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.3.2 24
[r1-GigabitEthernet0/0/0]int gi 0/0/1
[r1-GigabitEthernet0/0/1]ip add 172.16.0.1 30
[r1-GigabitEthernet0/0/1]int gi 0/0/2
[r1-GigabitEthernet0/0/2]ip add 172.16.0.5 30

下面配置SW1和SW2在与交换机(核心层)连接的线路的ip

这里注意:由于模拟器的缘故无法直接在接口上配置ip修改为创建一个专属的AVI接口在这条线路上

[sw1]vlan 99
[sw1]int gi 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type  access 
[sw1-GigabitEthernet0/0/1]port default vlan 99
[sw1]int Vlanif 99
[sw1-Vlanif99]ip add 172.16.0.2 30

[sw2]vlan 99
[sw2-GigabitEthernet0/0/1]port link-type access  
[sw2-GigabitEthernet0/0/1]port default vlan 99
[sw2]int vlan 99
[sw2-Vlanif99]ip add 172.16.0.6 30

测试:

 下面进行路由:

方法:使用OSPF并且分为两个区域area 0 和 area 1

r1:

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0

SW1:

[sw1]ospf 1 router-id 2.2.2.2
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network  172.16.0.2 0.0.0.0
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.10 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.210 0.0.0.0

SW2:

[sw2]ospf 1 router-id 3.3.3.3
[sw2-ospf-1]area 0 
[sw2-ospf-1-area-0.0.0.0]network  172.16.0.6 0.0.0.0
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.20 0.0.0.0

[sw2-ospf-1-area-0.0.0.1]network 172.16.1.220 0.0.0.0

查看邻居的建立:

 对sw1与sw2之间的两个邻居进行汇总让r1只会学习一条到这里的路由

[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0

[sw2-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0

 为了让内网中的用户可以访问到公网需要在r1上做一条缺省指向公网

[r1]ip route-static 0.0.0.0 0.0.0.0 172.16.3.1

[r1]ospf 1
[r1-ospf-1]default-route-advertise

这里可以对SW1和SW2上进行优化制作沉默接口

[sw1-ospf-1]silent-interface all
[sw1-ospf-1]undo silent-interface Eth-Trunk 0
[sw1-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw1-ospf-1]undo silent-interface Vlanif 1

[sw1-ospf-1]undo silent-interface Vlanif 99

[sw2-ospf-1]silent-interface all
[sw2-ospf-1]undo silent-interface Eth-Trunk 0
[sw2-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw2-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw2-ospf-1]undo silent-interface Vlanif 1

[sw2-ospf-1]undo silent-interface Vlanif 99

四、最后进行ANT配置

[r1]acl 2000
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r1]int gi 0/0/0
[r1-GigabitEthernet0/0/0]nat outbound 2000

五、测试

pc1ping公网:

 pc2ping公网

三层架构综合实验

一、实验内容

1、内网IP地址172.16.0.0/16

2、sw1/2之间互为备份

3、VRRP/STP/VLAN/Trunk均使用

4、所有PC通过DHCP获取IP地址

二、拓扑设计

IP地址规划

172.16.0.0/16 总网

172.16.0.0/24        点到点骨干链路
172.16.0.0/30——172.16.0.252/30

172.16.1.0/24        MA骨干链路
172.16.1.0/29——192.16.1.248/29

172.16.2.0/24——172.16.255.0/24        PC网段

三、实施

1、汇聚层

(1)创建VLAN

(2)配置Eth-trunk

[sw3]int Eth-Trunk 0
[sw3-Eth-Trunk0]q 
[sw3]int GigabitEthernet 0/0/3 
[sw3-GigabitEthernet0/0/3]eth-trunk 0
[sw3-GigabitEthernet0/0/3]int g0/0/4
[sw3-GigabitEthernet0/0/4]eth-trunk 0

[sw4]int Eth-Trunk 0
[sw4-Eth-Trunk0]q
[sw4]int g0/0/3
[sw4-GigabitEthernet0/0/3]eth-trunk 0
[sw4-GigabitEthernet0/0/3]int g 0/0/4
[sw4-GigabitEthernet0/0/4]eth-trunk 0

(3)配置trunk干道

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

[sw3]port-group group-member GigabitEthernet 0/0/2 GigabitEthernet 0/0/5
[sw3-port-group]port link-type trunk 
[sw3-GigabitEthernet0/0/2]port link-type trunk 
[sw3-GigabitEthernet0/0/5]port link-type trunk 
[sw3-port-group]port trunk allow-pass vlan 1 to 2
[sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 to 2
[sw3-GigabitEthernet0/0/5]port trunk allow-pass vlan 1 to 2

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

[sw4]int g 0/0/2
[sw4-GigabitEthernet0/0/2]port link-type trunk 
[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 to 2
[sw4-GigabitEthernet0/0/2]int g 0/0/5
[sw4-GigabitEthernet0/0/5]port link-type trunk   
[sw4-GigabitEthernet0/0/5]port trunk allow-pass vlan 1 to 2

[sw1]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2
[sw1-port-group]port link-type trunk 
[sw1-GigabitEthernet0/0/1]port link-type trunk 
[sw1-GigabitEthernet0/0/2]port link-type trunk 
[sw1-port-group]port trunk allow-pass vlan 1 to 2
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 to 2
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 to 2

[sw2]interface GigabitEthernet0/0/1
[sw2-GigabitEthernet0/0/1] port link-type trunk
[sw2-GigabitEthernet0/0/1] port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2
[sw2-GigabitEthernet0/0/2] port link-type trunk
[sw2-GigabitEthernet0/0/2] port trunk allow-pass vlan 2

(4)配置STP(生成树)

[sw3]stp mode mstp 
[sw3]stp enable 
[sw3]stp region-configuration 
[sw3-mst-region]region-name a
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration 
[sw3-mst-region]q   
[sw3]stp instance 1 root primary 
[sw3]stp instance 2 root secondary 

[sw4]stp mode mstp 
[sw4]stp enable 
[sw4]stp region-configuration 
[sw4-mst-region]region-name b
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration 
[sw4-mst-region]q
[sw4]stp instance 1 root secondary 
[sw4]stp instance 2 root primary 

[sw1]stp enable 
[sw1]stp region-configuration  
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration 

[sw2]stp enable 
[sw2]stp region-configuration 
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration

(5)配置svi

[sw3]int vlan 1
[sw3-Vlanif1]ip address 172.16.2.1 24
[sw3-Vlanif1]int vlan 2
[sw3-Vlanif2]ip address 172.16.3.2 24

[sw4]int vlan 1
[sw4-Vlanif1]ip address 172.16.2.2 24
[sw4-Vlanif1]int vlan 2
[sw4-Vlanif2]ip address 172.16.3.1 24

(6)VRRP

[sw3]int vlanif 1
[sw3-Vlanif1]vrrp vrid 1 virtual-ip 172.16.2.254
[sw3-Vlanif1]vrrp vrid 1 priority 101
[sw3-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 5
[sw3-Vlanif1]int vlanif 2
[sw3-Vlanif2]vrrp vrid 1 virtual-ip 172.16.3.254

[sw4]int Vlanif 1
[sw4-Vlanif1]vrrp vrid 1 virtual-ip 172.16.2.254
[sw4-Vlanif1]int vlanif 2 
[sw4-Vlanif2]vrrp vrid 1 virtual-ip 172.16.3.254  
[sw4-Vlanif2]vrrp vrid 1 priority 101
[sw4-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 5

(7)DHCP

[sw3]dhcp enable 
[sw3]ip pool a 
[sw3-ip-pool-a]network 172.16.2.0 mask 24
[sw3-ip-pool-a]gateway-list 172.16.2.254
[sw3-ip-pool-a]dns-list 114.114.114.114
[sw3-ip-pool-a]q
[sw3]ip pool b
[sw3-ip-pool-b]network 172.16.3.0 mask 24
[sw3-ip-pool-b]gateway-list 172.16.3.254 
[sw3-ip-pool-b]dns-list 114.114.114.114
[sw3-ip-pool-b]q
[sw3]int vlan 1
[sw3-Vlanif1]dhcp select global 
[sw3-Vlanif1]int vlanif 2
[sw3-Vlanif2]dhcp select global 

[sw4]dhcp enable 
[sw4]ip pool a 
[sw4-ip-pool-a]network 172.16.2.0 mask 24
[sw4-ip-pool-a]gateway-list 172.16.2.254
[sw4-ip-pool-a]dns-list 114.114.114.114
[sw4-ip-pool-a]q
[sw4]ip pool b
[sw4-ip-pool-b]network 172.16.3.0 mask 24
[sw4-ip-pool-b]gateway-list 172.16.3.254
[sw4-ip-pool-b]dns-list 114.114.114.114
[sw4-ip-pool-b]q
[sw4]interface vlanif 1
[sw4-Vlanif1]dhcp select global 
[sw4-Vlanif1]int vlanif 2
[sw4-Vlanif2]dhcp select global 

2、接入层

(1)创建VLAN并划分VLAN

[sw1-Ethernet0/0/1]port link-type access 
[sw1-Ethernet0/0/1]port default vlan 1
[sw1-Ethernet0/0/1]stp edged-port enable 
[sw1-Ethernet0/0/1]int eth0/0/2
[sw1-Ethernet0/0/2]port link-type access 
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]stp edged-port enable 

[sw2]int Eth0/0/1
[sw2-Ethernet0/0/1]port link-type access 
[sw2-Ethernet0/0/1]port default vlan 1
[sw2-Ethernet0/0/1]stp edged-port enable 
[sw2-Ethernet0/0/1]int eth0/0/2
[sw2-Ethernet0/0/2]port link-type access     
[sw2-Ethernet0/0/2]port default vlan 2
[sw2-Ethernet0/0/2]stp edged-port enable 

(2)PC端启动DHCP

3、核心层

(1)配置公网

测试:

(2)路由器和三层交换机的连通

[sw3]vlan 10
[sw3-vlan10]int vlan 10
[sw3-Vlanif10]ip address 172.16.0.1 30
[sw3-Vlanif10]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access 
[sw3-GigabitEthernet0/0/1]port default vlan 10
[sw3]ip route-static 0.0.0.0 0 172.16.0.2

[sw4]vlan 20
[sw4-vlan20]int vlanif 20
[sw4-Vlanif20]ip add 172.16.0.6 30
[sw4-Vlanif20]int g0/0/1
[sw4-GigabitEthernet0/0/1]port link-type access 
[sw4-GigabitEthernet0/0/1]port default vlan 20
[sw4]ip route-static 0.0.0.0 0 172.16.0.5 

[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 172.16.0.2 30
[r2-GigabitEthernet0/0/1]int g 0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.0.5 30
[r2]ip route-static 172.16.2.0 24 172.16.0.1
[r2]ip route-static 172.16.2.0 24 172.16.0.6
[r2]ip route-static 172.16.3.0 24 172.16.0.6
[r2]ip route-static 172.16.3.0 24 172.16.0.1

(3)DNS

[r2-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r2-acl-basic-2000]q
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]nat o    
[r2-GigabitEthernet0/0/0]nat outbound 2000

四、测试

(1)测试PC端是否可以通过DHCP获取到正确的IP地址

(2)在所有设备正常运行下,测试PC端能否正常通信

(3)关闭sw3,测试PC端是否能够正常通信

(4)关闭sw4,打开sw3,测试PC端是否能够正常通信

 

以上是关于三层架构综合实验(2.7)的主要内容,如果未能解决你的问题,请参考以下文章

关于nspm品类产品在行业用户网络架构中的研究分析(建议安全自动化运维工具开发者,了解)

基于防火墙双击热备三层网络规划_ensp综合实验

基于防火墙双击热备三层网络规划_ensp综合实验

你有一份2019运维技能风向标,请查收

高级网络应用复习——三层和生成树实验 加 命令

初级网络运维工程师比赛题目