当前位置:网站首页>Three layer switching experiment

Three layer switching experiment

2022-06-24 18:13:00 Kenneth~ Xiao Xiao

 

step 1: analysis

1、 For the exchange part, you need to put lsw1 and lsw2 The two links of use eth-trunk Combine a link , Then create VLAN—— Divide VLAN——trunk main rd ——STP——SVI——VRRP——DHCP

2、 The connection part between the router and the switch uses ospf Protocol runthrough

3、 The public network is located in r1 Do on nat Address translation access public network

step 2: Divide ip

The intranet address is based on 172.16.0.0/16 Distribute , therefore

172.16.0.0/24 Used for switch and router network segment

172.16.0.0/30 r1 And lsw1 Connected network segment

172.16.0.4/30 r1 And lsw2 Connected network segment

172.16.1.0/24 Used to switch routing network segments

172.16.1.0/25 SVR1 The network segment

172.16.1.128/25 SVR2 The network segment

step 3: Simulation experiment diagram

step 4: Exchange part

1、 establish Eth-Trunk

lsw1:

[lsw1]interface Eth-Trunk 0

[lsw1-Eth-Trunk0]int g0/0/24

[lsw1-GigabitEthernet0/0/24]eth-trunk 0

[lsw1-GigabitEthernet0/0/24]int g0/0/23

[lsw1-GigabitEthernet0/0/23]eth-trunk 0

lsw2:

[lsw2]interface Eth-Trunk 0

[lsw2-Eth-Trunk0]int g0/0/24

[lsw2-GigabitEthernet0/0/24]eth-trunk 0

[lsw2-GigabitEthernet0/0/24]int g0/0/23

[lsw2-GigabitEthernet0/0/23]eth-trunk 0

2、 Create and divide VLAN

lsw1:

[Huawei]sysname lsw1

[lsw1]vlan 2

lsw2:

[Huawei]sysname lsw2

[lsw2]vlan 2

lsw3:

[Huawei]sysname lsw3

[lsw3]vlan 2

[lsw3-vlan2]q

[lsw3]int e0/0/4

[lsw3-Ethernet0/0/4]port link-type access

[lsw3-Ethernet0/0/4]port default vlan 2

[lsw3-Ethernet0/0/4]int e0/0/3

[lsw3-Ethernet0/0/3]port link-type access

[lsw3-Ethernet0/0/3]port default vlan 1

lsw4:

[Huawei]sysname lsw4

[lsw4]vlan 2

[lsw4-vlan2]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

3、 establish trunk main rd

lsw1:

[lsw1]int g0/0/1

[lsw1-GigabitEthernet0/0/1]port link-type trunk

[lsw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2

[lsw1-GigabitEthernet0/0/1]int g0/0/2

[lsw1-GigabitEthernet0/0/2]port link-type trunk

[lsw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2

[lsw1-GigabitEthernet0/0/2]q

[lsw1]interface Eth-Trunk 0

[lsw1-Eth-Trunk0]port link-type trunk

[lsw1-Eth-Trunk0]port trunk allow-pass vlan 2

lsw2:

[lsw2]interface Eth-Trunk 0

[lsw2-Eth-Trunk0]port link-type trunk

[lsw2-Eth-Trunk0]port trunk allow-pass vlan 2

[lsw2-Eth-Trunk0]int g0/0/1

[lsw2-GigabitEthernet0/0/1]port link-type trunk

[lsw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2

[lsw2-GigabitEthernet0/0/1]int g0/0/2

[lsw2-GigabitEthernet0/0/2]port link-type trunk

[lsw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2

lsw3:

[lsw3]int e0/0/1

[lsw3-Ethernet0/0/1]port link-type trunk

[lsw3-Ethernet0/0/1]port trunk allow-pass vlan 2

[lsw3-Ethernet0/0/1]int e0/0/2

[lsw3-Ethernet0/0/2]port link-type trunk

[lsw3-Ethernet0/0/2]port trunk allow-pass vlan 2

lsw4:

[lsw4]int e0/0/1

[lsw4-Ethernet0/0/1]port link-type trunk

[lsw4-Ethernet0/0/1]port trunk allow-pass vlan 2

[lsw4-Ethernet0/0/1]int e0/0/2

[lsw4-Ethernet0/0/2]port link-type trunk

[lsw4-Ethernet0/0/2]port trunk allow-pass vlan 2

4、 To configure STP Of mstp Spanning tree protocol

lsw1:

[lsw1]stp mode mstp

[lsw1]stp enable

[lsw1]stp region-configuration

[lsw1-mst-region]region-name a

[lsw1-mst-region]instance 1 vlan 1

[lsw1-mst-region]instance 2 vlan 2

[lsw1-mst-region]active region-configuration

[lsw1-mst-region]q

[lsw1]stp instance 1 root primary

[lsw1]stp instance 2 root secondary

lsw2:

[lsw2]stp mode mstp

[lsw2]stp enable

[lsw2]stp region-configuration

[lsw2-mst-region]region-name a

[lsw2-mst-region] instance 1 vlan 1

[lsw2-mst-region] instance 2 vlan 2

[lsw2-mst-region] active region-configuration

[lsw2-mst-region]q

[lsw2]stp instance 1 root secondary

[lsw2]stp instance 2 root primary

lsw3:

[lsw3]stp mode mstp

[lsw3]stp enable

[lsw3]stp region-configuration

[lsw3-mst-region]region-name a

[lsw3-mst-region] instance 1 vlan 1

[lsw3-mst-region] instance 2 vlan 2

[lsw3-mst-region] active region-configuration

[lsw3-mst-region]q

[lsw3]int e0/0/3

[lsw3-Ethernet0/0/3]stp edged-port enable

[lsw3-Ethernet0/0/3]int e0/0/4

[lsw3-Ethernet0/0/4]stp edged-port enable

lsw4:

[lsw4]stp mode mstp

[lsw4]stp enable

[lsw4]stp region-configuration

[lsw4-mst-region]region-name a

[lsw4-mst-region] instance 1 vlan 1

[lsw4-mst-region] instance 2 vlan 2

[lsw4-mst-region] active region-configuration

[lsw4-mst-region]q

[lsw4]int Eth0/0/3

[lsw4-Ethernet0/0/3]stp edged-port enable

[lsw4-Ethernet0/0/3]int e0/0/4

[lsw4-Ethernet0/0/4]stp edged-port enable

5、 To configure SVI

lsw1:

[lsw1]interface Vlanif 1

[lsw1-Vlanif1]ip address 172.16.1.1 25

[lsw1-Vlanif1]q

[lsw1]interface Vlanif 2

[lsw1-Vlanif2]ip address 172.16.1.129 25

lsw2:

[lsw2]interface Vlanif 1

[lsw2-Vlanif1]ip address 172.16.1.2 25

[lsw2-Vlanif1]q

[lsw2]interface Vlanif 2

[lsw2-Vlanif2]ip address 172.16.1.130 25

6、 To configure vrrp

lsw1:

[lsw1]interface Vlanif 1

[lsw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126

[lsw1-Vlanif1]vrrp vrid 1 priority 110

[lsw1-Vlanif1]vrrp vrid 1 track interface g0/0/3 reduced 11

[lsw1-Vlanif1]q

[lsw1]interface Vlanif 2

[lsw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254

lsw2:

[lsw2]interface Vlanif 1

[lsw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126

[lsw2-Vlanif1]q

[lsw2]interface Vlanif 2

[lsw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254

[lsw2-Vlanif2]vrrp vrid 1 priority 110

[lsw2-Vlanif2]vrrp vrid 1 track interface g0/0/3 reduced 11

7、 To configure DHCP

lsw1:

[lsw1]dhcp enable

[lsw1]ip pool v1

[lsw1-ip-pool-v1]network 172.16.1.0 mask 25

[lsw1-ip-pool-v1]gateway-list 172.16.1.126

[lsw1-ip-pool-v1]dns-list 114.114.114.114

[lsw1-ip-pool-v1]q

[lsw1]ip pool v2

[lsw1-ip-pool-v2]network 172.16.1.128 mask 25

[lsw1-ip-pool-v2]gateway-list 172.16.1.254

[lsw1-ip-pool-v2]dns-list 114.114.114.114

[lsw1-ip-pool-v2]q

[lsw1]interface Vlanif 1

[lsw1-Vlanif1]dhcp select global

[lsw1-Vlanif1]q

[lsw1]interface Vlanif 2

[lsw1-Vlanif2]dhcp select global

lsw2:

[lsw2]dhcp enable

[lsw2]ip pool v1

[lsw2-ip-pool-v1] gateway-list 172.16.1.126

[lsw2-ip-pool-v1] network 172.16.1.0 mask 255.255.255.128

[lsw2-ip-pool-v1] dns-list 114.114.114.114

[lsw2-ip-pool-v1]ip pool v2

[lsw2-ip-pool-v2] gateway-list 172.16.1.254

[lsw2-ip-pool-v2] network 172.16.1.128 mask 255.255.255.128

[lsw2-ip-pool-v2] dns-list 114.114.114.114

[lsw2-ip-pool-v2]q

[lsw2]interface Vlanif 1

[lsw2-Vlanif1]dhcp select global

[lsw2-Vlanif1]q

[lsw2]interface Vlanif 2

[lsw2-Vlanif2]dhcp select global

pc1:

pc2:

pc3:

pc4:

step 5:ospf The partial

1、 To configure ospf Part of the ip Address

r1:

[r1]int g0/0/0

[r1-GigabitEthernet0/0/0]ip address 172.16.0.1 30

[r1-GigabitEthernet0/0/0]int g0/0/1

[r1-GigabitEthernet0/0/1]ip address 172.16.0.5 30

lsw1:

[lsw1]vlan 99

[lsw1-vlan99]q

[lsw1]interface Vlanif 99

[lsw1-Vlanif99]ip address 172.16.0.2 30

[lsw1-Vlanif99]q

[lsw1]int g0/0/3

[lsw1-GigabitEthernet0/0/3]port link-type access

[lsw1-GigabitEthernet0/0/3]port default vlan 99

lsw2:

[lsw2]vlan 99

[lsw2-vlan99]q

[lsw2]interface Vlanif 99

[lsw2-Vlanif99]ip address 172.16.0.6 30

[lsw2-Vlanif99]q

[lsw2]interface g0/0/3

[lsw2-GigabitEthernet0/0/3]port link-type access

[lsw2-GigabitEthernet0/0/3]port default vlan 99

2、 To configure ospf agreement :

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

lsw1:

[lsw1]ospf 1 router-id 2.2.2.2

[lsw1-ospf-1]area 0

[lsw1-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0

[lsw1-ospf-1-area-0.0.0.0]area 1

[lsw1-ospf-1-area-0.0.0.1]network 172.16.1.1 0.0.0.0

[lsw1-ospf-1-area-0.0.0.1]network 172.16.1.129 0.0.0.0

[lsw1-ospf-1-area-0.0.0.1]q

[lsw1-ospf-1]silent-interface g0/0/1

[lsw1-ospf-1]silent-interface g0/0/2

[lsw1-ospf-1]silent-interface Vlanif 2

lsw2:

[lsw2]ospf 1 router-id 3.3.3.3

[lsw2-ospf-1]area 0

[lsw2-ospf-1-area-0.0.0.0]network 172.16.0.6 0.0.0.0

[lsw2-ospf-1-area-0.0.0.0]area 1

[lsw2-ospf-1-area-0.0.0.1]network 172.16.1.2 0.0.0.0

[lsw2-ospf-1-area-0.0.0.1]network 172.16.1.130 0.0.0.0

[lsw2-ospf-1-area-0.0.0.1]q

[lsw2-ospf-1]silent-interface g0/0/1

[lsw2-ospf-1]silent-interface g0/0/2

[lsw2-ospf-1]silent-interface Vlanif 2

3、 Issue default and summary optimization

r1:

[r1]ip route-static 0.0.0.0 0 12.1.1.2

[r1]ospf 1

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

lsw1:

[lsw1-ospf-1]area 1

[lsw1-ospf-1-area-0.0.0.1]asbr-summary 172.16.1.0 255.255.255.0

lsw2:

[lsw2-ospf-1]area 1

[lsw2-ospf-1-area-0.0.0.1]asbr-summary 172.16.1.0 255.255.255.0

step 6: Public network part

1、 Configure the address of the public network

r2 The public network part of the router is configured :

system-view

[r2]int g0/0/0

[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24

[r2-GigabitEthernet0/0/0]int lo0

[r2-LoopBack0]ip address 2.2.2.2 24

[r2-LoopBack0]int lo1

[r2-LoopBack1]ip address 2.1.1.1 24

r1 The public network part of the router is configured :

system-view

[r1]int g0/0/2

[r1-GigabitEthernet0/0/2]ip address 12.1.1.1 24

2、 Yes r1 Visit the address of the public network to do nat address translation

[r1]acl 2000

[r1-acl-basic-2000]rule permit source any

[r1-acl-basic-2000]q

[r1]int g0/0/2

[r1-GigabitEthernet0/0/2]nat outbound 2000

3、 test

step 7: test

pc1:

pc2:

pc3:

pc4:

原网站

版权声明
本文为[Kenneth~ Xiao Xiao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211407276805.html