DHCP (Dynamic Host Configuration Protocol) address acquisition method taking 5GC core network as Relay Agent
By adding or deleting the Option82 sub-item in the DHCP message in the 5GC core network, the IP address acquisition problem when the 5GC core network is used as a DHCP Relay Agent is solved, ensuring that the DHCP client can successfully apply for the IP address.
Patent Information
- Application Number
- CN202411073368.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-10
AI Technical Summary
When the 5GC core network is a DHCP Relay Agent, it cannot complete the insertion and deletion of Option82 in the DHCP message, resulting in the DHCP client being unable to apply for an IP address.
Implement the addition or deletion of Option82 in the 5GC core network, hang up the DHCP client under the CPE device, and connect to the Ethernet session. After the registration is successful, add or delete the Option82 sub-item to the DHCP request and Respond to the message and modify the relevant message header information to ensure correct transmission.
It realizes that the DHCP client can apply for an IP address through DHCP request, ensuring the correct processing of Option82 in the DHCP packet, and solving the problem of failure to obtain the IP address of the DHCP client.
Smart Images

Figure CN119109906A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of communication technology, and in particular relates to a method for obtaining a DHCP address when a 5GC core network acts as a relay agent. Background Art
[0002] There are up to 255 Option options in a DHCP message. Option 82 is the option for relay agent information in the DHCP message. The Option 82 option is located before option 255 and after other options. There are up to 255 Option 82 sub-options. Sub-option sub-option 1 is the proxy circuit, that is, the CircuitId sub-item. This sub-item is usually configured on the DHCP relay device and defines the vlan-id and layer 2 port number of the switch port to which the DHCP client is connected that need to be carried when transmitting the message. Sub-option sub-option 2 is the proxy remote ID, that is, the RemoteId sub-item. This sub-item is usually configured on the DHCP relay device and defines the MAC address information of the relay device that needs to be carried when transmitting the message.
[0003] Currently, when the 5GC core network acts as a DHCP Relay Agent, it is unable to insert and delete Option 82 in the DHCP message, which will cause the DHCP client to be unable to apply for an IP address through a DHCP request.
[0004] Based on the above technical problems existing in the prior art, the present invention proposes a method for obtaining a DHCP address using a 5GC core network as a Relay Agent. Summary of the invention
[0005] The purpose of the present invention is to address the deficiencies in the prior art and provide a method for obtaining a DHCP address using a 5GC core network as a Relay Agent, thereby implementing the addition or deletion of Option 82 in the 5GC core network and allocating a DHCP client address to a CPE.
[0006] The present invention adopts the following technical solution:
[0007] A method for obtaining a DHCP address when a 5GC core network acts as a relay agent includes:
[0008] Step 1: Connect a DHCP client to the CPE device.
[0009] Step 2: The 5GC core network accesses the CPE device to initiate an Ethernet session, and the registration is successful;
[0010] Step 3: The DHCP client under the CPE initiates a DHCP request message, which is used to request an IP address from the DHCP server.
[0011] Step 4, the 5GC core network configures the CircuitId and RemoteId data according to the user's Option82, and adds the Option82 sub-item to the DHCP request message;
[0012] Step 5: The 5GC core network forwards the request message with the Option 82 sub-item added to the DHCP server to request an IP address.
[0013] Furthermore, in step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user.
[0014] Furthermore, in step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including:
[0015] The 5GC core network determines whether the Option 82 enable switch is turned on. If it is turned on, the 5GC core network determines whether the message is a Discovery, Request, Release, or Inform message to the DHCP server. If so, the 5GC core network determines whether the source port number in the message is 67; if so, the 5GC core network determines that the giaddr in the DHCP request message is not 0 and is not the address of the 5GC core network N6 port, and transparently transmits the message to the DHCP server.
[0016] Furthermore, in step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including:
[0017] The 5GC core network determines that the giaddr in the DHCP request message is not 0 and is the address of the 5GC core network N6 port, and the 5GC core network discards the DHCP request message.
[0018] Furthermore, in step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including:
[0019] The 5GC core network determines that the giaddr in the DHCP request message is 0 and there is no option82 sub-item in the DHCP request message, and then generates the Option82 option according to the Option82 parameters configured by the user;
[0020] The 5GC core network determines that the giaddr in the DHCP request message is 0 and there is an option 82 option in the DHCP request message, then determines whether the sub-items of the Option 82 option in the DHCP request message include CircuitId and RemoteId. If not, the 5GC core network inserts the corresponding CircuitId and RemoteId sub-items in the DHCP request message.
[0021] Furthermore, in step 4, the generated Option 82 option is added to the request message, and:
[0022] Modify the Relay agent IP address in the request message to the service address of port N6;
[0023] In the request message, change the Ethernet layer source MAC address to the MAC address of port N6;
[0024] In the request message, change the source IP address of the IP layer to the IP address of port N6;
[0025] In the request message, modify the destination IP address of the IP layer to the IP address of the DHCP server;
[0026] In the request message, change the source port of the UDP layer to 67;
[0027] In the request message, modify the hops field value to increase by 1.
[0028] Furthermore, in step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including:
[0029] The 5GC core network receives the response message sent by the DHCP server. The DHCP response message includes the IP address of the DHCP client.
[0030] The 5GC core network determines whether the response message receives the Offer, ACK, or NAK message from the DHCP client. If so, the 5GC core network determines whether the source port number in the response message is 68. If so, the 5GC core network determines whether the Option 82 enable switch is turned on. If it is turned on, the 5GC core network determines that the destination MAC in the DHCP request message is the MAC of the 5GC core network N6 port and the destination IP address in the DHCP request message is the IP address of the 5GC core network N6 port.
[0031] Furthermore, in step 4, the 5GC core network determines whether there is an Option 82 option in the DHCP request message. If not, the 5GC core network directly forwards the DHCP response message. If so, the 5GC core network determines whether the sub-item CircuitId in the Option 82 selection in the DHCP request message is consistent with the CircuitId in the Option 82 configured by the user; if they are consistent, the 5GC core network deletes the sub-item RemoteId of the Option 82 option of the DHCP response message.
[0032] Furthermore, in step 4, the 5GC core network determines whether the Option 82 option in the DHCP request message contains other sub-items except CircuitId and RemoteId. If not, the 5GC core network deletes the Option 82 sub-item in the DHCP request message.
[0033] Furthermore, in step 4, after deleting the Option82 sub-item, and:
[0034] In the response message, modify the Ethernet layer destination MAC address to the ClientMac address in the message;
[0035] In the response message, the Ethernet layer source MAC address is changed to the MAC address of the N6 port;
[0036] In the response message, modify the destination IP address of the IP layer to the YourClientIp address in the request message;
[0037] In the response message, change the destination port of the UDP layer to 68.
[0038] The beneficial effects of the present invention are:
[0039] The DHCP address acquisition method of the 5GC core network as a Relay Agent of the present invention implements the action of inserting and deleting Option 82 in the DHCP message when the 5GC core network acts as a DHCP RelayAgent, thereby ensuring that the DHCP client can apply for an IP address through a DHCP request. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a networking diagram of a method for obtaining a DHCP address using a 5GC core network as a Relay Agent in an embodiment of the present invention;
[0041] Figure 2 This is a logic diagram of uplink message processing of the DHCP address acquisition method of the 5GC core network as a Relay Agent in an embodiment of the present invention;
[0042] Figure 3This is a logic diagram of downlink message processing of the DHCP address acquisition method of the 5GC core network as a Relay Agent in an embodiment of the present invention;
[0043] Figure 4 This is a flow chart of uplink message processing of the DHCP address acquisition method of the 5GC core network as a Relay Agent in an embodiment of the present invention;
[0044] Figure 5 The present invention is a flowchart of downlink message processing of the DHCP address acquisition method of the 5GC core network as a Relay Agent in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to more clearly understand the above-mentioned purposes, features and advantages of the present invention, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0046] Example
[0047] The DHCP address acquisition method of the 5GC core network as a RelayAgent includes: receiving a DHCP client under a CPE device; the 5GC core network accesses the CPE device to initiate an Ethernet session, and the registration is successful; the DHCP client under the CPE initiates a DHCP request message, and the request message is used to request an IP address from a DHCP server; the 5GC core network configures CircuitId and RemoteId data according to Option82 of the user, and adds Option82 sub-items to the DHCP request message; the 5GC core network forwards the request message with the Option82 sub-item added to the DHCP server to request an IP address;
[0048] In the above embodiment, Option 82 is added or deleted in the 5GC core network to realize the allocation of the DHCP client address under the CPE. Specifically, Figure 1 As shown in the figure, when networking, the PC is connected to the CPE device, and the CPE device is connected to the 5GC core network through the N3 port. At the same time, the DHCP Server is connected to the N6 port of the 5GC core network. Multiple PCs are connected to the CPE device, and the PCs obtain Internet access addresses through automatic DHCP.
[0049] Specifically, Figure 2-3 As shown, the method includes:
[0050] S10. The 5GC core network access CPE device initiates Ethernet type PDU session registration successfully, including Option82 configuration CircuitId and RemoteId data used for contract signing. The PC under the CPE initiates DHCP to automatically request an IP address. At this time, the DHCP request message reaches the 5GC core network through the user plane.
[0051] S20, 5GC core network configures CircuitId and RemoteId data according to the user's Option82, and adds Option82 sub-items to the DHCP request message;
[0052] S30, modifying other information in the DHCP request message, the other information including the source and destination IP addresses;
[0053] S40 and 5GC core networks forward the DHCP request message with Option 82 added to the DHCP server to request an IP address.
[0054] S50, the 5GC core network receives a response message sent by the DHCP server, where the DHCP response message includes the IP address information requested by the DHCP client;
[0055] S60 and 5GC core networks configure CircuitId and RemoteId data according to the user's Option82, and delete the Option82 sub-item information in the message;
[0056] S70, modifying other information in the DHCP response message, the other information including the destination IP address and the source destination MAC address;
[0057] S80 and 5GC core network forward the processed DHCP response message to the DHCP client through the N3 port.
[0058] As a specific implementation method, Figure 4 As shown in the figure, the processing of Option 82 sub-items in the DHCP uplink message includes:
[0059] The 5GC core network determines whether the Option 82 enable switch is turned on;
[0060] If the Option 82 enable switch is turned on, the 5GC core network determines whether the message receives the Discovery, Request, Release, and Inform messages from the DHCP server, and whether the source port number is 67;
[0061] If the source port number is 67, the 5GC core network determines that the giaddr in the DHCP request message is not 0 and is not the 5GC core network N6 port address, and then transparently transmits the message to the DHCP server;
[0062] The 5GC core network determines that the giaddr in the DHCP request message is not 0 and is the address of the 5GC core network N6 port, and then discards the message;
[0063] The 5GC core network determines that the giaddr in the DHCP request message is 0 and there is no option 82 sub-item in the DHCP request message, and then generates the Option 82 option according to the Option 82 parameters configured by the user;
[0064] The 5GC core network determines that the giaddr in the DHCP request message is 0 and the DHCP request message contains option 82, then determines whether the sub-items of the Option 82 option in the DHCP request message contain CircuitId and RemoteId, and if not, inserts the corresponding sub-items;
[0065] The generated Option 82 is added to the request message, followed by:
[0066] In the request message, change the Relay agent IP address to the service address of port N6;
[0067] In the request message, change the Ethernet layer source MAC address to the MAC address of port N6;
[0068] In the request message, change the source IP address of the IP layer to the IP address of port N6;
[0069] In the request message, modify the destination IP address of the IP layer to the IP address of the DHCP server;
[0070] In the request message, change the source port of the UDP layer to 67;
[0071] In the request message, modify the hops field value to increase by 1.
[0072] As a specific implementation method, Figure 5 As shown in the figure, the processing of Option 82 sub-items in the downstream DHCP message includes:
[0073] The 5GC core network determines whether the message has received the Offer, ACK, or NAK message from the DHCP server, and whether the source port number is 68;
[0074] If the source port number is 68, the 5GC core network determines whether the Option 82 enable switch is turned on;
[0075] If the Option 82 enable switch is turned on, the 5GC core network determines that the destination MAC in the DHCP request message is the MAC of the 5GC core network N6 port and the destination IP address in the DHCP request message is the IP address of the 5GC core network N6 port;
[0076] The 5GC core network determines whether there is Option 82 in the DHCP request message;
[0077] If not, the 5GC core network directly forwards the DHCP response message;
[0078] If yes, the 5GC core network determines whether the sub-item CircuitId selected in Option82 in the DHCP request message is consistent with the CircuitId in Option82 configured by the user;
[0079] If they are consistent, the 5GC core network deletes the CircuitId sub-item of Option 82 in the DHCP response message;
[0080] The 5GC core network determines whether there is an Option 82 option in the DHCP request message;
[0081] If yes, the 5GC core network determines whether the sub-item RemoteId selected in Option82 in the DHCP request message is consistent with the RemoteId in Option82 configured by the user;
[0082] If they are consistent, the 5GC core network deletes the RemoteId sub-item of Option 82 in the DHCP response message;
[0083] After Option 82 is deleted from the DHCP response message:
[0084] In the response message, modify the Ethernet layer destination MAC address to the ClientMac address in the message;
[0085] In the response message, the Ethernet layer source MAC address is changed to the MAC address of the N6 port;
[0086] In the response message, modify the destination IP address of the IP layer to the YourClientIp address in the message;
[0087] In the response message, change the destination port of the UDP layer to 68.
[0088] The present invention is not limited by the above embodiments. The above embodiments and descriptions are only for explaining the principle of the present invention. Without departing from the spirit and scope of the present invention, the present invention may be subject to various changes and improvements, which are within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the appended claims.
Claims
1. A method for obtaining a DHCP address using a 5GC core network as a RelayAgent. It is characterized in that include: Step 1: Connect a DHCP client to the CPE device. Step 2: The 5GC core network accesses the CPE device to initiate an Ethernet session, and the registration is successful; Step 3: The DHCP client under the CPE initiates a DHCP request message, which is used to request an IP address from the DHCP server. Step 4, the 5GC core network configures the CircuitId and RemoteId data according to the user's Option82, and adds the Option82 sub-item to the DHCP request message; Step 5: The 5GC core network forwards the request message with the Option 82 sub-item added to the DHCP server to request an IP address.
2. According to the DHCP address acquisition method of the 5GC core network as a RelayAgent according to claim 1, It is characterized in that In step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user.
3. According to claim 2, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including: The 5GC core network determines whether the Option 82 enable switch is turned on. If it is turned on, the 5GC core network determines whether the message receives the Discovery, Request, Release, and Inform messages from the DHCP server. If so, the 5GC core network determines whether the source port number in the message is 67; if so, the 5GC core network determines that the giaddr in the DHCP request message is not 0 and is not the 5GC core network N6 port address, and transparently transmits the message to the DHCP server.
4. According to claim 2, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including: The 5GC core network determines that the giaddr in the DHCP request message is not 0 and is the address of the 5GC core network N6 port, and the 5GC core network discards the DHCP request message.
5. According to claim 2, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including: The 5GC core network determines that the giaddr in the DHCP request message is 0 and there is no option82 sub-item in the DHCP request message, and then generates the Option82 option according to the Option82 parameters configured by the user; The 5GC core network determines that the giaddr in the DHCP request message is 0 and there is option 82 in the DHCP request message, then determines whether the sub-items of Option 82 in the DHCP request message include CircuitId and RemoteId. If not, the 5GC core network inserts the corresponding CircuitId and RemoteId sub-items in the DHCP request message.
6. According to claim 2, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, add the generated Option 82 to the request message and: Modify the Relay agent IP address in the request message to the service address of port N6; In the request message, change the Ethernet layer source MAC address to the MAC address of port N6; In the request message, change the source IP address of the IP layer to the IP address of port N6; In the request message, modify the destination IP address of the IP layer to the IP address of the DHCP server; In the request message, change the source port of the UDP layer to 67; In the request message, modify the hops field value to increase by 1.
7. According to claim 2, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, the 5GC core network modifies the DHCP message according to the Option 82 parameters configured by the user, including: The 5GC core network receives the response message sent by the DHCP server. The DHCP response message includes the IP address of the DHCP client. The 5GC core network determines whether the response message receives the Offer, ACK, or NAK message from the DHCP client. If so, the 5GC core network determines whether the source port number in the response message is 68. If so, the 5GC core network determines whether the Option 82 enable switch is turned on. If it is turned on, the 5GC core network determines that the destination MAC in the DHCP request message is the MAC of the 5GC core network N6 port and the destination IP address in the DHCP request message is the IP address of the 5GC core network N6 port.
8. According to claim 7, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, the 5GC core network determines whether there is an Option 82 option in the DHCP request message. If not, the 5GC core network directly forwards the DHCP response message. If so, the 5GC core network determines whether the sub-item CircuitId in the Option 82 selection in the DHCP request message is consistent with the CircuitId in the Option 82 configured by the user; If they are consistent, the 5GC core network deletes the RemoteId sub-item of Option 82 of the DHCP response message.
9. According to claim 8, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, the 5GC core network determines whether the Option 82 option in the DHCP request message contains other sub-items except CircuitId and RemoteId. If not, the 5GC core network deletes the Option 82 sub-item in the DHCP request message.
10. According to claim 9, the DHCP address acquisition method of the 5GC core network as a RelayAgent, It is characterized in that In step 4, after deleting the Option82 subkey, and: In the response message, modify the Ethernet layer destination MAC address to the ClientMac address in the message; In the response message, the Ethernet layer source MAC address is changed to the MAC address of the N6 port; In the response message, modify the destination IP address of the IP layer to the YourClientIp address in the request message; In the response message, change the destination port of the UDP layer to 68.
