【网络】企业网三层架构实验

题目

一、实验拓扑

二、实验需求

1、内网IP地址172.16.0.0/16 合理分配

2、SW1/2之间互为备份

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

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

三、实验思路

1.创建eth-trunk

2.管理vlan,trunk

3.STP

4.SVI

5.VRRP

6.DHCP

7.所有节点拥有合法IP地址

8.路由(OSPF)

9.策略

四、实验步骤

1.创建eth-trunk

[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]q
[sw1]interface GigabitEthernet 0/0/22	
[sw1-GigabitEthernet0/0/22]eth-trunk 0
[sw1-GigabitEthernet0/0/22]q
[sw1]int g 0/0/23
[sw1-GigabitEthernet0/0/23]eth-trunk 0
	
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]q	
[sw2]int g 0/0/22	
[sw2-GigabitEthernet0/0/22]eth-trunk 0	
[sw2-GigabitEthernet0/0/22]q
[sw2]int g 0/0/23	
[sw2-GigabitEthernet0/0/23]eth-trunk 0

2.管理vlan,trunk

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

[sw2]vlan 2
[sw2-vlan2]q
[sw2]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2 Eth-
Trunk 0
[sw2-port-group]port link-type trunk 
[sw2-GigabitEthernet0/0/1]port link-type trunk 
[sw2-GigabitEthernet0/0/2]port link-type trunk 
[sw2-Eth-Trunk0]port link-type trunk 
[sw2-port-group]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2

[sw3]vlan 2
[sw3-vlan2]q 	
[sw3]interface e 0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]q	
[sw3]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2	
[sw3-port-group]port link-type trunk 
[sw3-GigabitEthernet0/0/1]port link-type trunk 
[sw3-GigabitEthernet0/0/2]port link-type trunk 
[sw3-port-group]port trunk allow-pass vlan 2
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 2

[sw4]vlan 2
[sw4-vlan2]q
[sw4]int e 0/0/2
[sw4-Ethernet0/0/2]p l a
[sw4-Ethernet0/0/2]port d vlan 2
[sw4-Ethernet0/0/2]q
[sw4]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2	
[sw4-port-group]port link-type trunk 
[sw4-GigabitEthernet0/0/1]port link-type trunk 
[sw4-GigabitEthernet0/0/2]port link-type trunk 	
[sw4-port-group]port trunk allow-pass vlan 2
[sw4-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan 2

3.STP

[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 
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-mst-region]q
[sw1]display stp region-configuration 
 Oper configuration
   Format selector    :0             
   Region name        :a             
   Revision level     :0

   Instance   VLANs Mapped
      0       3 to 4094
      1       1
      2       2

[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

[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

[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

[sw1]stp instance 1 root primary 
[sw1]stp instance 2 root secondary 

[sw2]stp instance 1 root secondary 
[sw2]stp instance 2 root primary 

[sw1]stp instance 0 root primary 
[sw2]stp instance 0 root secondary 


//stp边缘接口优化
[sw3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/22	
[sw3-port-group]stp edged-port enable 

[sw4]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/22
[sw4-port-group]stp edged-port enable 


//假设三号口是AP接口,改优先级
[sw3]int e 0/0/3
[sw3-Ethernet0/0/3]stp instance 0 port  priority 16

[sw4]int e 0/0/3
[sw4-Ethernet0/0/3]stp instance 0 port  priority 16

4.SVI

[sw1]interface vlan 1
[sw1-Vlanif1]ip address 172.16.1.1 25
[sw1-Vlanif1]q
[sw1]int vlan 2
[sw1-Vlanif2]ip add 172.16.1.129 25
	
[sw2]interface vlan 1
[sw2-Vlanif1]ip add 172.16.1.2 25
[sw2-Vlanif1]q
[sw2]int vlan 2
[sw2-Vlanif2]ip add 172.16.1.130 25

5.VRRP

[sw1]int vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 110
[sw1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/24 reduced 20

[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
[sw2-Vlanif2]vrrp vrid 1 priority 110	
[sw2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/24 reduced 20
	
[sw1]interface vlan 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254

6.DHCP

[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 8.8.8.8
[sw1-ip-pool-v1]q
[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 8.8.8.8
[sw1]interface vlan 1	
[sw1-Vlanif1]dhcp select global 
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global 

[sw2]ip pool v1
[sw2-ip-pool-v1] gateway-list 172.16.1.126
[sw2-ip-pool-v1] network 172.16.1.0 mask 255.255.255.128
[sw2-ip-pool-v1] dns-list 114.114.114.114 8.8.8.8
[sw2-ip-pool-v1]ip pool v2
[sw2-ip-pool-v2] gateway-list 172.16.1.254
[sw2-ip-pool-v2] network 172.16.1.128 mask 255.255.255.128
[sw2-ip-pool-v2] dns-list 114.114.114.114 8.8.8.8
[sw2]dhcp enable 
[sw2]int vlan 1
[sw2-Vlanif1]dhcp select global
[sw2-Vlanif1]int vlan 2	
[sw2-Vlanif2]dhcp select global 

7.所有节点拥有合法IP地址

[isp]int g 0/0/1	
[isp-GigabitEthernet0/0/1]ip address 12.1.1.1 24 
[isp-GigabitEthernet0/0/1]int lo 0	
[isp-LoopBack0]ip address 1.1.1.1 24

[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip address  12.1.1.2 24
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 172.16.0.1 30
[r2-GigabitEthernet0/0/1]int g 0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.0.5 30

[sw1]vlan 99
[sw1-vlan99]int g 0/0/24
[sw1-GigabitEthernet0/0/24]p l a
[sw1-GigabitEthernet0/0/24]p d vlan 99
[sw1-GigabitEthernet0/0/24]int vlan 99
[sw1-Vlanif99]ip add 172.16.0.2 30

[sw2]vlan 99
[sw2-vlan99]int g 0/0/24
[sw2-GigabitEthernet0/0/24]p l a
[sw2-GigabitEthernet0/0/24]p d vlan 99	
[sw2-GigabitEthernet0/0/24]int vlan 99
[sw2-Vlanif99]ip address 172.16.0.6 30

8.路由(OSPF)

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]q

[sw1]ospf 1 router-id 3.3.3.3
[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-0.0.0.0]q
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255

[sw2]ospf 1 router-id 4.4.4.4
[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-0.0.0.0]area 1
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255

[r2]ip route-static 0.0.0.0 0.0.0.0 12.1.1.1
[r2]ospf 1
[r2-ospf-1]default-route-advertise

[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]ospf 1
[sw2-ospf-1]area 1	
[sw2-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0

[sw1]ip route-static 172.16.1.0 24 NULL 0

[sw2]ip route-static 172.16.1.0 24 NULL 0


//沉默接口
[sw1]ospf 1	
[sw1-ospf-1]silent-interface all
[sw1-ospf-1]undo silent-interface GigabitEthernet 0/0/24
[sw1-ospf-1]undo silent-interface Vlanif 99	
[sw1-ospf-1]undo silent-interface Eth-Trunk 0	
[sw1-ospf-1]undo silent-interface Vlanif 1

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

9.策略

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

五、测试

关闭SW1进行测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值