Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Realization of VLAN interworking by layer 3 switching

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Layer 3 switching technology: layer 2 switching technology + layer 3 forwarding technology. It solves the situation that the subnet in the network segment must be managed by the router after the division of the network segment in the local area network, and solves the network bottleneck problem caused by the low speed and complexity of the traditional router.

Lab requirements:

C1 and C4 belong to VLAN10,C2, C3 belong to VLAN20

Realization of interworking between PC by layer 3 switching

R2 configures static routes to achieve network interworking

The steps of the experiment:

Used in the experiment: Cisco GNS3

1.SW1 configuration

SW1#confi t / / enters global configuration mode

Enter configuration commands, one per line. End with CNTL/Z.

SW1 (config) # vlan 10pm 20 / / add VLAN in batch

SW1 (config-vlan) # exit

SW1 (config) # int f1amp 1 / / enter the physical interface fa1/1

SW1 (config-if) # switchport access vlan 10 / / add VLAN10

SW1 (config-if) # no shut / / activate the port

SW1 (config) # int f1amp 2 / / enter interface fa1/2

SW1 (config-if) # switchport access vlan 20 / / add VLAN20

SW1 (config-if) # no shut / / activate the port

SW1 (config) # int f1amp 5 / / enter interface fa1/5

SW1 (config-if) # switchport mode trunk / / Relay trunk port

SW1 (config-if) #

* Mar 1 00 Port Fa1/5 has become dot1q trunk 35 Port Fa1/5 has become dot1q trunk 23. 195:% DTP-5-TRUNKPORTON:

SW1 (config) # int f1amp 0 / / enter interface fa1/0

SW1 (config-if) # switchport mode trunk / / Relay trunk port

SW1 (config-if) #

* Mar 1 00 Port Fa1/0 has become dot1q trunk 39 Port Fa1/0 has become dot1q trunk 33. 223:% DTP-5-TRUNKPORTON:

2.SW2 configuration

SW2#confi t / / global configuration mode

Enter configuration commands, one per line. End with CNTL/Z.

SW2 (config) # vlan 10pm 20 / / add VLAN in batch

SW2 (config-vlan) # exit

SW2 (config) # int f1amp 3 / / enter interface fa1/3

SW2 (config-if) # switchport access vlan 20 / / add VLAN20

SW2 (config-if) # no shut / / activate the port

SW2 (config) # int f1amp 5 / / into the fa1/5 port

SW2 (config-if) # switchport mode trunk / / configure trunk port

SW2 (config-if) #

* Mar 1 00 virtual 36 20. 659:% DTP-5-TRUNKPORTON: Port Fa1/5 has become dot1q trunk

3.M1 configuration

M1#confi t / / global configuration mode

Enter configuration commands, one per line. End with CNTL/Z.

M1 (config) # int f1amp 0 / / enter interface fa1/0

M1 (config-if) # switchport mode trunk / / configure trunk TRUNK

M1 (config-if) #

* Mar 1 00 Port Fa1/0 has become dot1q trunk 41 Port Fa1/0 has become dot1q trunk 48. 443:% DTP-5-TRUNKPORTON:

M1 (config-if) # exit

M1 (config) # vlan 10pm 20 / / batch add VLAN

M1 (config-vlan) # exit

M1 (config) # int f1amp 4 / / in interface fa1/4

M1 (config-if) # switchport access vlan 10 / / add VLAN10

M1 (config) # int vlan10 / / enter the VLAN10 virtual interface

* Mar 1 00 changed state to up 44 changed state to up 50.479:% LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10

M1 (config-if) # ip addr 192.168.1.1 255.255.255.0 / / configure gateway IP address

M1 (config-if) # int vlan20 / / enter the VLAN20 virtual interface

* Mar 1 00 Line protocol on Interface Vlan20 45 14. 131:% LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

M1 (config-if) # ip addr 192.168.2.1 255.255.255.0 / / configure gateway IP address

M1 (config) # int f1amp 10 / / enter interface fa1/10

M1 (config-if) # no switchport / / layer 2 port to layer 3 port

M1 (config-if) # ip add 10.0.0.1 255.255.255.0 / / configure the IP address

M1 (config-if) #

* Mar 1 00 changed state to up 54 19. 367:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/10, changed state to up

M1 (config-if) # no shut / / Port Activation

M1 (config) # ip route 0.0.0.0 0.0.0.0 10.0.0.2 / / configure a default static route

4.PC configuration

VPCS [1] > ip 192.168.1.10 192.168.1.1 / / configure C1 IP address and gateway

Checking for duplicate address...

PC1: 192.168.1.10 255.255.255.0 gateway 192.168.1.1

VPCS [1] > 2

VPCS [2] > ip 192.168.2.20 192.168.2.1 / / configure C2 IP address and gateway

Checking for duplicate address...

PC2: 192.168.2.20 255.255.255.0 gateway 192.168.2.1

VPCS [2] > 3

VPCS [3] > ip 192.168.2.30 192.168.2.1 / / configure C3 IP address and gateway

Checking for duplicate address...

PC3: 192.168.2.30 255.255.255.0 gateway 192.168.2.1

VPCS [3] > 4

VPCS [4] > ip 192.168.1.40 192.168.1.1 / / configure C4 IP address and gateway

Checking for duplicate address...

PC4: 192.168.1.40 255.255.255.0 gateway 192.168.1.1

5. Test inter-PC communication

VPCS [4] > ping 192.168.1.10 / / Test C1 and C4 connectivity

192.168.1.10 icmp_seq=1 ttl=64 time=2.002 ms

192.168.1.10 icmp_seq=2 ttl=64 time=2.967 ms

192.168.1.10 icmp_seq=3 ttl=64 time=2.003 ms

192.168.1.10 icmp_seq=4 ttl=64 time=3.008 ms

192.168.1.10 icmp_seq=5 ttl=64 time=2.003 ms

VPCS [4] > 3

VPCS [3] > ping 192.168.2.20 / Test C3, C2 connectivity

192.168.2.20 icmp_seq=1 ttl=64 time=3.004 ms

192.168.2.20 icmp_seq=2 ttl=64 time=2.069 ms

VPCS [3] > ping 192.168.1.10 / / Test C3, C1 connectivity

192.168.1.10 icmp_seq=1 timeout

192.168.1.10 icmp_seq=2 ttl=63 time=17.949 ms

192.168.1.10 icmp_seq=3 ttl=63 time=17.967 ms

192.168.1.10 icmp_seq=4 ttl=63 time=55.063 ms

192.168.1.10 icmp_seq=5 ttl=63 time=28.966 ms

VPCS [3] >

VPCS [3] > 4

VPCS [4] > ping 192.168.2.20 / Test C4 and C2 connectivity

192.168.2.20 icmp_seq=1 timeout

192.168.2.20 icmp_seq=2 ttl=63 time=47.050 ms

192.168.2.20 icmp_seq=3 ttl=63 time=23.026 ms

6.R1 configuration

R1#confi t / / global configuration mode

Enter configuration commands, one per line. End with CNTL/Z.

R1 (config) # int f0bin1 / / into the fa0/1 interface

R1 (config-if) # ip add 10.0.0.2 255.255.255.0 / / configure IP address and subnet mask

R1 (config-if) # no shut / / activate the port

R1 (config-if) #

* Mar 1 00 Interface FastEthernet0/1 55 Interface FastEthernet0/1 56.307:% Interface FastEthernet0/1, changed state to up

* Mar 1 00 Line protocol on Interface FastEthernet0/1 55 Line protocol on Interface FastEthernet0/1 57.307:% Line protocol on Interface FastEthernet0/1, changed state to up

R1 (config) # int f0ram 0 / / enter interface FA0/0

R1 (config-if) # ip add 12.0.0.2 255.255.255.0 / / configure IP address, subnet mask

R1 (config-if) # no shut / / activate the port

R1 (config-if) #

* Mar 1 00 changed state to up 58 Mar 54. 163:% LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

* Mar 1 00 Mar 58 changed state to up 55.163:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,

R1 (config) # ip route 192.168.1.0 255.255.255.0 10.0.0.1 / / configure a default static route

R1 (config) # ip route 192.168.2.0 255.255.255.0 10.0.0.1

7.R2 configuration

R2#confi t / / global configuration mode

Enter configuration commands, one per line. End with CNTL/Z.

R2 (config) # int f0swap 0 / / enter the f0Lex0 interface

R2 (config-if) # ip add 12.0.0.3 255.255.255.0 / / configure IP address and subnet mask

R2 (config-if) # no shut / / activate the port

R2 (config-if) #

* Mar 1 01 Interface FastEthernet0/0 0015 11.707:% LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

* Mar 1 01 Line protocol on Interface FastEthernet0/0 0012. 707:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R2 (config) # ip route 0.0.0.0 0.0.0.0 12.0.0.2 / / configure static rout

8. Test interworking

VPCS [3] > ping 12.0.0.3 / / Test C3 and R2 connectivity

12.0.0.3 icmp_seq=1 ttl=253 time=137.756 ms

12.0.0.3 icmp_seq=2 ttl=253 time=93.753 ms

12.0.0.3 icmp_seq=3 ttl=253 time=109.381 ms

12.0.0.3 icmp_seq=4 ttl=253 time=140.631 ms

12.0.0.3 icmp_seq=5 ttl=253 time=140.633 ms

VPCS [3] > 1

VPCS [1] > ping 12.0.0.2 / / Test C1 and R1 connectivity

12.0.0.2 icmp_seq=1 ttl=254 time=62.501 ms

12.0.0.2 icmp_seq=2 ttl=254 time=93.764 ms

12.0.0.2 icmp_seq=3 ttl=254 time=78.126 ms

12.0.0.2 icmp_seq=4 ttl=254 time=78.126 ms

12.0.0.2 icmp_seq=5 ttl=254 time=93.756 ms

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report