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

Configure DHCP between different vlan to realize interworking

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Experiment name: automatically acquire DHCP between different switches and different VLAN to realize interworking.

Experimental purpose: DHCP automatically obtains IP address

Lab Topology:

2. Experimental steps:

(1) the IP address of the four PC is DHCP.

(2) configure switch 1 with VLAN10 VLAN20, port 1 with VLAN10, and port 2 with VLAN20.

Switch (config) # vlan 10

Switch (config) # vlan 20

Switch (config) # interface fas0/1

Switch (config-if) # sw

Switch (config-if) # switchport mode access

Switch (config-if) # switchport ac

Switch (config-if) # switchport access vlan 10

Switch (config-if) # no shutdown

Switch (config-if) # interface fas0/2

Switch (config-if) # switchport mode access

Switch (config-if) # switchport access vlan 20

Switch (config-if) # no shutdown

Switch 2 configures VLAN30 VLAN40, port 1 joins VLA30, port 2 joins VLAN40

Switch (config) # vlan 30

Switch (config-vlan) # exit

Switch (config) # vlan 40

Switch (config-vlan) # e

Switch (config) # interface fas 0amp 1

Switch (config-if) # switchport mode access

Switch (config-if) # switchport access vlan 30

Switch (config-if) # no shutdown

Switch (config-if) # interface fas 0amp 2

Switch (config-if) # switchport mode access

Switch (config-if) # switchport access vlan 40

Switch (config-if) # no shutdown

(3) except for VLAN port, all interfaces of the switch are trunk

Switch (config-if) # switchport mode trunk

(4) configure layer 3 switch

Create VLAN 10 VLAN 20 VLAN 30 VLAN40

Vlan 10:192.168.10.254 255.255.255.0

Vlan 20:192.168.20.254 255.255.255.0

Vlan 30:192.168.30.254 255.255.255.0

Vlan 40:192.168.40.254 255.255.255.0

Each VLAN operation Switch (config-if) # ip helper-address 192.168.10.0

Switch (config) # ip routing

Enter the interface 3:Switch (config-if) # no switchport

Configure the IP address 192.168.1.1 255.55.255.0

(5) configure router gateway: Port 1: 192.168.1.254 255.255.255.0

Port 2VR 192.168.2.254 255.255.255.0

(6) next hop of layer 3 switch: Switch (config) # ip route 192.168.2.0 255.255.255.0 192.168.1.254

Router next hop: Router (config) # ip route 0.0.0.0 0.0.0.0 192.168.1.1

(7) configure server DHCP:

Create vlan, add the interface to the appropriate vlan, and configure trunk mode between the switch and the switch

Sw1:

Switch#configure terminal

Switch (config) # hostname sw1

Sw1 (config) # vlan 10

Sw1 (config-vlan) # vlan 20

Sw1 (config-vlan) # vlan 30

Sw1 (config-vlan) # vlan 40

Sw1 (config-vlan) # exit

Sw1 (config) # interface fastEthernet 0amp 1

Sw1 (config-if) # switchport mode access

Sw1 (config-if) # switchport access vlan 10

Sw1 (config-if) # exit

Sw1 (config) # interface fastEthernet 0amp 2

Sw1 (config-if) # switchport mode access

Sw1 (config-if) # switchport access vlan 20

Sw1 (config-if) # exit

Sw1 (config) # interface fastEthernet 0amp 3

Sw1 (config-if) # switchport mode trunk

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

Sw1 (config-if) # exit

Sw1 (config) # interface fastEthernet 0amp 4

Sw1 (config-if) # switchport mode trunk

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

Sw1 (config-if) # exit

Sw1 (config) # interface fastEthernet 0amp 5

Sw1 (config-if) # switchport mode trunk

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

Sw1 (config-if) # exit

Sw2:

Switch#configure terminal

Switch (config) # hostname sw2

Sw2 (config) # vlan 10

Sw2 (config-vlan) # vlan 20

Sw2 (config-vlan) # vlan 30

Sw2 (config-vlan) # vlan 40

Sw2 (config-vlan) # exit

Sw2 (config) # interface fastEthernet 0amp 1

Sw2 (config-if) # switchport mode access

Sw2 (config-if) # switchport access vlan 30

Sw2 (config-if) # exit

Sw2 (config) # interface fastEthernet 0amp 2

Sw2 (config-if) # switchport mode access

Sw2 (config-if) # switchport access vlan 40

Sw2 (config-if) # exit

Sw2 (config) # interface fastEthernet 0amp 3

Sw2 (config-if) # switchport mode trunk

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

Sw2 (config-if) # exit

Sw2 (config) # interface fastEthernet 0amp 4

Sw2 (config-if) # switchport mode trunk

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

Sw2 (config-if) # exit

Sw2 (config) # interface fastEthernet 0amp 5

Sw2 (config-if) # switchport mode trunk

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

Sw2 (config-if) # exit

Sw3:

Switch#configure terminal monitor

Switch (config) # hostname sw3

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 fastEthernet 0amp 1

Sw3 (config-if) # switchport mode trunk

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

Sw3 (config-if) # exit

Sw3 (config) # interface fastEthernet 0amp 2

Sw3 (config-if) # switchport mode trunk

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

Sw3 (config-if) # exit

Sw3 (config) # interface fastEthernet 0amp 3

Sw3 (config-if) # switchport mode trunk

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

Sw3 (config-if) # exit

Sw4:

Switch#config terminal monitor

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 fastEthernet 0amp 1

Sw4 (config-if) # switchport mode trunk

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

Sw4 (config-if) # exit

Sw4 (config) # interface fastEthernet 0amp 2

Sw4 (config-if) # switchport mode trunk

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

Sw4 (config-if) # exit

Sw4 (config) # interface fastEthernet 0amp 3

Sw4 (config-if) # switchport mode trunk

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

Sw4 (config-if) # exit

Sw4 (config) #

3. Configure layer 3 switch

1) the interconnection link between the configuration and the switch is in Trunk mode

Switch > enable

Switch#config terminal monitor

Switch (config) # hostname gateway

Gateway (config) # vlan 10

Gateway (config-vlan) # vlan 20

Gateway (config-vlan) # vlan 30

Gateway (config-vlan) # vlan 40

Gateway (config-vlan) # exit

Gateway (config) # interface fastEthernet 0amp 1

Gateway (config-if) # switchport trunk encapsulation dot1q

Gateway (config-if) # switchport mode trunk

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

Gateway (config-if) # exit

Gateway (config) # interface fastEthernet 0amp 2

Gateway (config-if) # switchport trunk encapsulation

Gateway (config-if) # switchport trunk encapsulation dot1q

Gateway (config-if) # switchport mode trunk

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

Gateway (config-if) # exit

2) configure the gateway for each vlan

Gateway (config) # ip routing enables routing to configure the SVI corresponding to each VLAN

Gateway (config) # interface vlan 10

Gateway (config-if) # no shutdown

Gateway (config-if) # ip address 192.168.10.254 255.255.255.0

Gateway (config-if) # exit

Gateway (config) # interface vlan 20

Gateway (config-if) # no shutdown

Gateway (config-if) # ip address 192.168.20.254 255.255.255.0

Gateway (config-if) # exit

Gateway (config) # interface vlan 30

Gateway (config-if) # no shutdown

Gateway (config-if) # ip address 192.168.30.254 255.255.255.0

Gateway (config-if) # exit

Gateway (config) # interface vlan 40

Gateway (config-if) # no shutdown

Gateway (config-if) # ip address 192.168.40.254 255.255.255.0

Gateway (config-if) # exit

Configure the Internet segment of Router as a layer 3 port

Gateway (config) # interface fastEthernet 0amp 3

Configure the IP address of the interconnection port of Router-192.168.88.0A24

Gateway (config-if) # no switchport

Gateway (config-if) # no shutdown

Gateway (config-if) # ip address 192.168.50.1 255.255.255.0

Gateway (config-if) # exit

Configure a route to the DHCP server network segment

Gateway (config) # ip route 192.168.60.0 255.255.255.0 192.168.50.2

Configure DHCP trunking

Gateway (config) # interface vlan 10

Gateway (config-if) # ip helper-address 192.168.60.1

Gateway (config-if) # exit

Gateway (config) # interface vlan 20

Gateway (config-if) # ip help

Gateway (config-if) # ip helper-address 192.168.60.1

Gateway (config-if) # exit

Gateway (config) # interface vlan 30

Gateway (config-if) # ip helper-address 192.168.60.1

Gateway (config-if) # exit

Gateway (config) # interface vlan 40

Gateway (config-if) # ip helper-address 192.168.60.1

Gateway (config-if) # exit

4. Configure the router router

Router#configure terminal

Router (config) # interface gigabitEthernet 0Universe 0

Router (config-if) # no shutdown

Router (config-if) # ip address 192.168.50.2 255.255.255.0

Router (config-if) # exit

Router (config) # interface gigabitEthernet 0amp 1

Router (config-if) # no shutdown

Router (config-if) # ip address 192.168.60.254 255.255.255.0

Router (config-if) # exit

Configure a route to the DHCP client network segment

Router (config) # ip route 0.0.0.0 0.0.0.0 192.168.50.1

Router (config) #

5. Configure the DHCP server

3. Verification and testing

Configuration ideas:

1.PC: IP address is set to DHCP

two。 Switch configuration creates VLAN, and adds interfaces to VLAN, trunk all except the ports that join vln

3. Configure layer 3 switch: create VLAN 10, VLAN 2010 VLAN30, VLAN40 and configure static gateway and access server address

4. Verification and testing (automatically assigning IP addresses, ping commands)

5 Experimental conclusion: setting DHCP between different VLAN can automatically assign IP address to realize interworking.

To realize the DHCP function and interworking, the four layer 2 switches must have the same VLAN, the layer 3 switch must configure the gateway and the address to be requested in the corresponding VLAN, the routing function of the layer 3 switch must be configured with IP to configure the next hop, the router must also be configured with IP to configure the next hop, the DHCP server must first configure itself with the address and gateway, and configure the address pool of 4 VLAN.

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