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

How to configure layer 3 switch in server

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to configure the layer 3 switch in the server. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Lab Topology:

Purpose: interworking between pc1, pc2, pc3, pc4 and server-pt

Lab requirements:

Pc1: ip address: 192.168.10.1

Subnet mask: 255.255.255.0

Gateway: 192.168.10.254

Pc2: ip address: 192.168.20.1

Subnet mask: 255.255.255.0

Gateway: 192.168.20.254

Pc3: ip address: 192.168.30.1

Subnet mask: 255.255.255.0

Gateway: 192.168.30.254

Pc4: ip address: 192.168.40.1

Subnet mask: 255.255.255.0

Gateway: 192.168.40.254

Server-PT: ip address: 192.168.60.1

Subnet mask: 255.255.255.0

Gateway: 192.168.60.254

The steps of the experiment:

1. Configure PC

Pc1

Pc2

Pc3

Pc4

Serve-pt

two。 Configure layer 2 switch

Operation content:

A, sw1 and sw2 create vlan10, vlan20 and vlan30, vlan40 respectively, and add the ports to their respective vlan, the ports connected to the PC set access mode and allow their respective vlan to pass, and the other ports create trunk mode and allow all vlan to pass through

B, sw3 and sw4 respectively create vlan10, vlan20, vlan30, vlan40, create trunk links for all ports and allow all vlan to pass through

Sw1:

Switch > enable

Switch#configure terminal

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

Switch (config) # hostname sw1

Sw1 (config) # vlan 10

Sw1 (config-vlan) # vlan 20

Sw1 (config-vlan) # exit

Sw1 (config) # interface fa0/1

Sw1 (config-if) # switchport mode access

Sw1 (config-if) # switchport access vlan 10

Sw1 (config-if) # exit

Sw1 (config) # interface fa0/2

Sw1 (config-if) # switchport mode access

Sw1 (config-if) # switchport access vlan 20

Sw1 (config-if) # exit

Sw1 (config) # interface fa0/3

Sw1 (config-if) # switchport mode trunk

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed

Sw1 (config-if) # switchport trunk allowed vlan all

Sw1 (config-if) # exit

Sw1 (config) # interface fa0/4

Sw1 (config-if) # switchport mode trunk

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

Sw1 (config-if) # switchport trunk allowed vlan all

Sw1 (config-if) # exit

Sw1 (config) # interface fa0/5

Sw1 (config-if) # switchport mode trunk

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

Sw1 (config-if) # switchport trunk allowed vlan all

Sw1 (config-if) # exit

Sw1 (config) # exit

Sw1#write

Sw2:

Switch > enable

Switch#configure terminal

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

Switch (config) # hostname sw2

Sw2 (config) # vlan 30

Sw2 (config-vlan) # vlan 40

Sw2 (config-vlan) # exit

Sw2 (config) # interface fa0/1

Sw2 (config-if) # switchport mode access

Sw2 (config-if) # switchport access vlan 30

Sw2 (config-if) # exit

Sw2 (config) # interface fa0/2

Sw2 (config-if) # switchport mode access

Sw2 (config-if) # switchport access vlan 40

Sw2 (config-if) # exit

Sw2 (config) # interface fa0/3

Sw2 (config-if) # switchport mode trunk

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed

Sw2 (config-if) # switchport trunk allowed vlan all

Sw2 (config-if) # exit

Sw2 (config) # interface fa0/4

Sw2 (config-if) # switchport mode trunk

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

Sw2 (config-if) # switchport trunk allowed vlan all

Sw2 (config-if) # exit

Sw2 (config) # interface fa0/5

Sw2 (config-if) # switchport mode trunk

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

Sw2 (config-if) # switchport trunk allowed vlan all

Sw2 (config-if) # exit

Sw2 (config) # exit

Sw2#write

Sw3:

Switch > enable

Switch#configure terminal

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

Switch (config) # hostname sw3

Switch > enable

Switch#configure

Configuring from terminal, memory, or network [terminal]?

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

Sw3 (config) # vlan 10

Sw3 (config-vlan) # vlan 20

Sw3 (config-vlan) # vlan 30

Sw3 (config-vlan) # vlan 40

Sw3 (config-vlan) # exit

Sw3 (config) # interface fa0/1

Sw3 (config-if) # switchport mode trunk

Sw3 (config-if) # switchport trunk allowed vlan all

Sw3 (config-if) # exit

Sw3 (config) # int fa0/2

Sw3 (config-if) # switchport mode trunk

Sw3 (config-if) # switchport trunk allowed vlan all

Sw3 (config-if) # exit

Sw3 (config) # interface fa0/3

Sw3 (config-if) # switchport mode trunk

Sw3 (config-if) #

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed

Sw3 (config-if) # switchport trunk allowed vlan all

Sw3 (config-if) # exit

Sw3#write

Sw4:

Switch > enable

Switch#configure terminal

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

Switch (config) # hostname sw4

Sw4 (config) # vlan 10

Sw4 (config-vlan) # vlan 20

Sw4 (config-vlan) # vlan 30

Sw4 (config-vlan) # vlan 40

Sw4 (config-vlan) # exit

Sw4 (config) # interface fa0/1

Sw4 (config-if) # switchport mode trunk

Sw4 (config-if) # switchport trunk allowed vlan all

Sw4 (config-if) # exit

Sw4 (config) # int fa0/2

Sw4 (config-if) # switchport mode trunk

Sw4 (config-if) # switchport trunk allowed vlan all

Sw4 (config-if) # exit

Sw4 (config) # interface fa0/3

Sw4 (config-if) # switchport mode trunk

Sw4 (config-if) #

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed

Sw4 (config-if) # switchport trunk allowed vlan all

Sw4 (config-if) # exit

Sw4#write

3. Configure layer 3 switch

Operation content:

Create vlan10, vlan20, vlan30, vlan40, create virtual port and set gateway, fa0/3 set ip address and subnet mask, enable routing function, configure next hop to 192.168.60.0 network segment

Switch > en

Switch#configure

Configuring from terminal, memory, or network [terminal]?

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

Switch (config) # ip routing

Switch (config) # vlan 10

Switch (config-vlan) # vlan 20

Switch (config-vlan) # vlan 30

Switch (config-vlan) # vlan 40

Switch (config-vlan) # exit

Switch (config) # int vlan 10

Switch (config-if) #

% LINK-5-CHANGED: Interface Vlan10, changed state to up

% LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

Switch (config-if) # no shutdown

Switch (config-if) # ip address 192.168.10.254 255.255.255.0

Switch (config-if) # exit

Switch (config) # int vlan 20

% LINK-5-CHANGED: Interface Vlan20, changed state to up

% LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

Switch (config-if) # no shutdown

Switch (config-if) # ip address 192.168.20.254 255.255.255.0

Switch (config-if) # exit

Switch (config) # int vlan 30

Switch (config-if) #

% LINK-5-CHANGED: Interface Vlan30, changed state to up

% LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up

Switch (config-if) # no shutdown

Switch (config-if) # ip address 192.168.30.254 255.255.255.0

Switch (config-if) # exit

Switch (config) # int vlan 40

% LINK-5-CHANGED: Interface Vlan40, changed state to up

% LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to up

Switch (config-if) # no shutdown

Switch (config-if) # ip address 192.168.40.254 255.255.255.0

Switch (config-if) # exit

Switch (config) # interface fa0/3

Switch (config-if) # no switchport

Switch (config-if) # no shutdown

Switch (config-if) # ip address 192.168.50.1 255.255.255.0

Switch (config-if) # exit

Switch (config) # ip route 192.168.60.0 255.255.255.0 192.168.50.2

Switch (config) # exit

Switch#

% SYS-5-CONFIG_I: Configured from console by console

Switch#write

4. Configure the router

Operation: configure the IP and subnet mask of the port, and configure the default route

Router > en

Router#configure

Configuring from terminal, memory, or network [terminal]?

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

Router (config) # interface fastEthernet 0amp 1

% Invalid interface type and number

Router (config) # interface gigabitEthernet 0Universe 0

Router (config-if) # no shutdown

% LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

% LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

Router (config-if) # ip address 192.168.50.2 255.255.255.0

Router (config) # interface gigabitEthernet 0amp 1

Router (config-if) # no shutdown

% LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up

% LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up

Router (config-if) # ip address 192.168.60.254 255.255.255.0

Router (config-if) # exit

Router (config) # ip route 0.0.0.0 0.0.0.0 192.168.50.1

Router (config) # exit

% SYS-5-CONFIG_I: Configured from console by console

Router#write

Verification and testing:

This is the end of the article on "how to configure layer 3 switches in the server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Servers

Wechat

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

12
Report