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

DHCP relay agent

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

Share

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

Summary: in large networks, there may be multiple subnets. The DHCP client gets the IP address after getting the response of the DHCP server through the webcast message. But broadcast messages cannot cross subnets. So, if the DHCP client and server are in different subnets, can the client still request an IP address from the server? This requires the use of DHCP relay agents. DHCP relay agent is actually a software technology. The computer with DHCP relay agent installed is called DHCP relay agent server, which undertakes the communication task between DHCP client and server between different subnets.

A relay agent is a Mini Program that transfers DHCP/BOOTP messages between clients and servers on different subnets. According to the consultation document (RFC), the DHCP/BOOTP relay agent is part of the DHCP and BOOTP standards and functions.

Experimental purpose: to help PC automatically obtain IP (can specify IP range)

Experimental environment: complete the environment construction in the Linux system

Specific experimental steps:

1: create a partition vlan and act as a turnaround in a layer 2 switch (sw2)

The code set on the layer 2 switch (sw2): (sw2)

Conf t

No ip routing

Vlan 10,20100

Ex

Int f1/1

Sw mo acc

Sw acc vlan 10

Ex

Int f1/2

Sw mo acc

Sw acc vlan 20

Ex

Int f1/3

Sw mo acc

Sw acc vlan 100

Do show vlan-sw b

Int f1/0

Sw mo t

Sw t en dot

2: set up turn port on layer 3 switch, configure gateway and designated server

Layer 3 switching Code (sw1)

(sw1)

Conf t

Int f1/0

Sw mo t

Sw t en dot

Ex

Vlan 10,20100

Int vlan10

Ip add 192.168.10.1 255.255.255.0

No shut

Ex

Int vlan20

Ip add 192.168.20.1 255.255.255.0

No shut

Ex

Int vlan100

Ip add 192.168.100.1 255.255.255.0

No shut

Ex

Int vlan10

Ip helper-address 192.168.100.222

Ex

Int vlan20

Ip helper-address 192.168.100.222

Ex

3: go to the Linux editor to install the package and configure the dhcp settings

Linux edit code:

(Linux)

Umount / dev/sr0

Mount / dev/sr0 / mnt

Rpm-ivh / mnt/Packages/dhcp-4.1.1-38.P1.el6.x86_64.rpm

Cd / etc/dhcp

Cp/ usr/share/doc/dhcp-4.1.1//dhcpd.conf.sample / etc/dhcp/dhcpd.conf

Vim dhcpd.conf

The 4:vim dhcpd.conf command goes to the dhcp Settings page to configure related settings.

Edit content code: # insert in DHCP service to understand the network topology

Subnet 192.168.100.0 netmask 255.255.255.0 {

Range 192.168.100.150 192.168.100.160

Option routers 192.168.100.1

}

Subnet 192.168.10.0 netmask 255.255.255.0 {

Range 192.168.10.150 192.168.10.160

Option routers 192.168.10.1

}

Subnet 192.168.20.0 netmask 255.255.255.0 {

Range 192.168.20.150 192.168.20.160

Option routers 192.168.20.1

}

5: start dhcp and turn off the firewall

Code:

Service dhcpd start # launch DHCP

Service iptables stop # turn off the firewall

Setenforce 0 # turn off selinux Firewall

6: open vpc to verify the experimental results:

Conclusion: the IP obtained by PC is the IP within the range of IP that we set to obtain automatically, and it can be interconnected.

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