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 build DHCP Relay Service

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

Share

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

This article mainly explains "how to set up DHCP relay service". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "how to set up DHCP relay service" together!

Experiment content: GNS3 simulation to achieve DHCP relay services

Experimental environment: a Linux server as DHCP server, install dhcp software package, network card for host-only mode, bound vmnet1

Two win10 clients with host-only network cards. Bind vmnet2 and vmnet8 separately

GNS3 Virtual Network Software

Experimental process:

1) Open Linux for configuration. First install DHCPF service on Linux system under vmnet8 in nat network mode, then switch to custom mode binding vmnet1. Configure static IP, configure DHCP server.

1. Download and install DHCP package with yum repository

[root@localhost ~]# yum install dhcp -y Install DHCP packages

2. Switch to custom mode binding vmnet1

3. Configure static IP and restart network service

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 Change configuration static IP

4. Configure the DHCP server. At this time, the DHCP service file is empty. You need to find the template and copy it to the DHCP configuration file, and then configure it. After the configuration is completed, start the DHCP service.

[root@localhost ~]# rpm -qc dhcp View dhcp master profile path

[root@localhost ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf Overwrites dhcp master configuration file templates into your dhcp file directory

[root@localhost ~]# vim /etc/dhcp/dhcpd.conf Configure dhcp services

[root@localhost ~]# systemctl start dhcpd Start dhcpd service

(2) Switch win10-1 and win10-2 to custom and bind vmnet2 and vmnet8 respectively

1, wein10-1 bind vmnet2

2. Turn off the networking function and dhcp function of vmnet8.

3. Change win10-2 to custom mode, bind vmnet8

(III) Build a service architecture in GNS3 and configure the equipment therein.

1. Open the GNS3 configuration topology diagram and arrange two win10 hosts, one dhcp server (Linux), one layer 2 switch, and one layer 3 switch.

2. Connect the equipment to each other as follows:

vmnet2 of win1 connected to f1/2 of sw2

vmnet8 of win2 connected to f1/3 of sw2

dhcp vmnet1 connects to sw2 f1/1

f1/0 of sw2 connected to f1/0 of sw3

Settings complete and all turned on, and port number displayed

3. Double-click to open sw2. Perform vlan partition for layer 2 switching.

win10-1:vlan10 192.168.10.1/24

win10-2:vlan20 192.168.20.1/24

dhcp:vlan100 192.168.100.1/24

Double-click to open sw2 to configure vlan

f1/1:vlan100

f1/2:vlan10

f1/3:vlan20

sw2#configure terminal Enter global mode

sw2(config)#vlan 10,20,100 Create three vlans

sw2(config-vlan)#ex exit vlan

sw2(config)#do show vlan-switch brief View information about the created vlan

sw2(config)#interface f1/1 Enter interface mode for f1/1

sw2(config-if)#switch mod access Set access mode

sw2(config-if)#switch access vlan 100 Assign ports to vlan100

sw2(config-if)#ex sw2(config)#interface f1/2 Set the interface mode for f1/2

sw2(config-if)#switch mod access

sw2(config-if)#switch access vlan 10

sw2(config-if)#ex sw2(config)#interface f1/3 Set interface mode for f1/3

sw2(config-if)#switch mod access

sw2(config-if)#switch access vlan 20

sw2(config-if)#ex sw2(config)#do show vlan-sw b View partition information for vlan

sw2(config)#interface f1/0 Enter f1/0 interface

sw2(config-if)#switch mod trunk Set trunk link mode

sw2(config-if)#switch trunk encapsulation dot1q Select encapsulation type as dot1q

sw2(config-if)#ex

sw2(config)#no ip routing Turn off routing

sw2(config)#do show int f1/0 switchport View interface information for interface f1/0

4. Double-click to open SW3 Layer 3 switch for configuration

Create three vlans 10, 20, 100

Set f1/0 interface to trunk link

Set gateway subnet mask for vlan10 192.168.10.1 255.255.255.0

Set gateway subnet mask for vlan20 192.168.20.1 255.255.255.0

Set gateway subnet mask for vlan100 192.168.100.1 255.255.255.0

sw3#configure terminal Enter global mode

sw3(config)#vlan 10,20,100 Create three vlans

sw3(config-vlan)#ex exit vlan

sw3(config)#do show vlan-switch brief View information about the created vlan

sw3(config)#interface f1/0 Enter f1/0 interface

sw3(config-if)#switch mod trunk Set trunk link mode

sw3(config-if)#switch trunk encapsulation dot1q Select encapsulation type as dot1q

sw3(config-if)#ex

sw3(config)#do show int f1/0 switchport View interface information for interface f1/0

w3(config)#int vlan 10 into vlan10

sw3(config-if)#ip add 192.168.10.1 255.255.255.0 Set gateway and subnet mask for vlan10

sw3(config-if)#no shut open vlan10

sw3(config-if)#ex

sw3(config)#int vlan 20 Set vlan20

sw3(config-if)#ip add 192.168.20.1 255.255.255.0

sw3(config-if)#no shut

sw3(config-if)#ex

sw3(config)#int vlan 100 Set vlan100

sw3(config-if)#ip add 192.168.100.1 255.255.255.0

sw3(config-if)#no shut

sw3(config-if)#end Exit global mode

sw3#show ip interface brief View vlan settings

(4) Configure DHCP relay in gateway

w3#conf tEnter global mode

sw3(config)#int vlan 10 Set DHCP relay in gateway

sw3(config-if)#ip helper-address 192.168.100.100

sw3(config-if)#no shut

sw3(config-if)#ex

sw3(config)#int vlan 20

sw3(config-if)#ip helper-address 192.168.100.100

sw3(config-if)#no shut

sw3(config-if)#ex

sw3(config)#int vlan 100

sw3(config-if)#ip helper-address 192.168.100.100

sw3(config-if)#no shut

(V) Open two hosts to see if you can automatically obtain the IP address of the 10/20 network segment

1. Open win10-1 and enter cmd command and ipconfig to view IP address.

2. Open win10-2 and enter cmd command ipconfig to view IP address.

DHCP relay service setup experiment completed.

Thank you for reading, the above is "how to build DHCP relay service" content, after the study of this article, I believe we have a deeper understanding of how to build DHCP relay service this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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