三层架构综合实验(2.7)

目标:

三层架构综合实验(2.7)_第1张图片

 一、首先需要对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 边缘接口

三层架构综合实验(2.7)_第2张图片三层架构综合实验(2.7)_第3张图片
查看后发现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

查看:

三层架构综合实验(2.7)_第4张图片三层架构综合实验(2.7)_第5张图片

(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:

三层架构综合实验(2.7)_第6张图片

 pc2:

三层架构综合实验(2.7)_第7张图片

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

首先配置公网:

[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

测试:

三层架构综合实验(2.7)_第8张图片

 下面进行路由:

方法:使用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

查看邻居的建立:

三层架构综合实验(2.7)_第9张图片

三层架构综合实验(2.7)_第10张图片

 对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

三层架构综合实验(2.7)_第11张图片

 为了让内网中的用户可以访问到公网需要在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公网:

三层架构综合实验(2.7)_第12张图片

 pc2ping公网

三层架构综合实验(2.7)_第13张图片

三层架构综合实验(2.7)_第14张图片

你可能感兴趣的:(交换机,路由器,网络,网络,安全,运维,网络安全)