Method and device for acquiring network configuration parameters based on service types
By introducing a service type matching mechanism in DHCP, the client selects the appropriate server according to business needs in a multi-server environment, solving the problem that the network configuration parameters cannot be flexibly selected in the existing technology and improving the business experience.
Patent Information
- Application Number
- CN202411284942.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-03
AI Technical Summary
In the prior art, clients cannot flexibly select appropriate network configuration parameters according to their needs when multiple servers select IP addresses, resulting in poor service experience.
The client sends messages containing service types to the server through the client, and the server returns a response message of the matching degree. The client selects the server with the highest matching degree based on the preset requirements to obtain network configuration parameters.
Support clients to flexibly select appropriate server and network configuration parameters according to business needs in multiple server scenarios to improve business experience.
Smart Images

Figure CN119254618A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field, and in particular to a method and device for acquiring network configuration parameters based on service type. Background Art
[0002] Dynamic Host Configuration Protocol DHCP (Dynamic Host Configuration Protocol) is used to dynamically allocate network configuration parameters such as IP addresses to network devices. DHCP adopts the client / server communication mode. For example, the client submits an application to the server for the allocation of an IP address, and the server returns the IP address allocated to the client to realize the dynamic configuration of the IP address.
[0003] In the prior art, there are situations where multiple servers provide IP addresses. In this case, the client selects the IP address of the server to which the first received message belongs based on the minimum response time. In this way, the client cannot flexibly select appropriate network configuration parameters according to needs. Therefore, a method is urgently needed to support the client to flexibly select appropriate network configuration parameters according to needs. Summary of the invention
[0004] Based on the above problems, the present application provides a method and device for obtaining network configuration parameters based on service type, so as to support the client to flexibly select appropriate network configuration parameters according to needs.
[0005] The present application discloses a method for acquiring network configuration parameters based on service type, the method comprising:
[0006] Sending a message including the client service type, requesting the server to allocate network configuration parameters;
[0007] Receiving a response message from the server; the response message includes a matching degree between the service that can be processed by the gateway configured by the server and the service type of the client;
[0008] Select the server corresponding to the response message whose matching degree meets the preset requirement as the target server;
[0009] The network configuration parameters are obtained from the target server.
[0010] Optionally, before receiving a response message from the server, the method further includes:
[0011] The server receives a message from the client;
[0012] The server matches the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree;
[0013] The server sends the response message including the matching degree to the client.
[0014] Optionally, the matching degree is a numerical value, and the server matches the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree, including:
[0015] When the client service type is the same as the service that can be processed by the gateway configured by the server, setting the matching degree to a first value;
[0016] When the client service type is different from the service that can be processed by the gateway configured by the server, the matching degree is set to a second value; the second value is smaller than the first value.
[0017] Optionally, there are multiple servers, and selecting the server corresponding to the response message whose matching degree meets the preset requirement includes:
[0018] The client receives response messages from multiple servers;
[0019] The client selects a server corresponding to a response message having the highest matching degree value among multiple response messages.
[0020] Optionally, there are multiple servers, and obtaining the network configuration parameters from the target server includes:
[0021] The client sends a request message including the target server identifier;
[0022] The target server receives the request message and interacts with the client so that the client obtains the network configuration parameters;
[0023] The servers other than the target server receive the request message and stop interacting with the client.
[0024] Based on the above-mentioned method for acquiring network configuration parameters based on service type, the present application also discloses a device for acquiring network configuration parameters based on service type, including: a request unit, a receiving unit, a selection unit and an acquisition unit;
[0025] The request unit is used to send a message including a client service type to request the server to allocate network configuration parameters;
[0026] The receiving unit is used to receive a response message from the server; the response message includes the matching degree between the service that can be processed by the gateway configured by the server and the service type of the client;
[0027] The selection unit is used to select the server corresponding to the response message whose matching degree meets the preset requirement as the target server;
[0028] The acquiring unit is used to acquire the network configuration parameters from the target server.
[0029] Optionally, the device further comprises:
[0030] A message receiving unit, used for the server to receive a message from the client;
[0031] A degree acquisition unit, configured for the server to match the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree;
[0032] A degree feedback unit is used for the server to send the response message including the matching degree to the client.
[0033] Optionally, the matching degree is a numerical value, and the degree acquisition unit includes:
[0034] A first subunit, configured to set the matching degree to a first value when the service type of the client is the same as the service that can be processed by the gateway configured by the server;
[0035] The second subunit is used to set the matching degree to a second value when the client service type is different from the service that can be processed by the gateway configured by the server; the second value is smaller than the first value.
[0036] Optionally, there are multiple servers, and the selection unit includes:
[0037] A response receiving subunit, used for the client to receive response messages from multiple servers;
[0038] The numerical comparison subunit is used for the client to select, from among multiple response messages, a server corresponding to a response message having the highest numerical value of the matching degree.
[0039] Optionally, there are multiple servers, and the acquiring unit includes:
[0040] A broadcast subunit, configured for the client to send a request message including the target server identifier;
[0041] A target subunit, configured for the target server to receive the request message and interact with the client so that the client can obtain the network configuration parameters;
[0042] The non-target sub-unit is used for the server other than the target server to receive the request message and stop interacting with the client.
[0043] The present application discloses a method and device for obtaining network configuration parameters based on business types. The client sends a message including its own business type and requests the server to allocate network configuration parameters. The server can judge the degree of business adaptation between the server and the gateway configured by itself through the business type. The client receives a response message from the server, which includes the degree of matching between the business that the gateway configured by the server can handle and the client's business type. The client selects a server whose matching degree meets the preset requirements and obtains network configuration parameters from the server. The method described in the present application can be applied to multi-server scenarios, supporting the client to flexibly select appropriate servers and network configuration parameters according to business needs, thereby improving the business experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0045] Figure 1a A flowchart of a method for acquiring network configuration parameters based on service type disclosed in an embodiment of the present application;
[0046] Figure 1b A schematic diagram of the format of a DHCP message disclosed in an embodiment of the present application;
[0047] Figure 1c A timing diagram of data transmission between a client and a server disclosed in an embodiment of the present application;
[0048] Figure 2 A flowchart of another method for acquiring network configuration parameters based on service type disclosed in an embodiment of the present application;
[0049] Figure 3 A schematic diagram of the structure of a device for acquiring network configuration parameters based on service type disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0051] Embodiment 1: This application discloses a method for acquiring network configuration parameters based on service type.
[0052] For details, please refer to Figure 1a , a method for obtaining network configuration parameters based on service type disclosed in this embodiment includes the following steps:
[0053] Step 101: Send a message including the client service type to request the server to allocate network configuration parameters.
[0054] In the method described in this embodiment, when the client starts up, it will send a message (DHCP-DISCOVERY message) in the form of broadcast to request the server to assign it Dynamic Host Configuration Protocol DHCP (Dynamic Host Configuration Protocol) information such as IP address and gateway.
[0055] As an optional method, the format of the DHCP message is as follows: Figure 1b As shown, op represents the operation type of the message, which can be divided into request messages (messages in which the client requests the allocation of network configuration parameters, such as DHCP-DISCOVERY messages) and response messages (messages in which the server provides network configuration parameters, such as the response messages in this application). This field can be specifically divided into request messages and response messages according to the value. For example, if the field is set to 1, it means a request message, and if the field is set to 2, it means a response message. htype and hl en respectively represent the hardware address type and length of the client. hops represents the number of DHCP relays (i.e., gateways) that the DHCP message passes through. Specifically, the value of the hops field will increase by 1 for each DHCP relay that the DHCP request message passes through.
[0056] xi d indicates the random number selected when the client initiates a request, which is used to identify an address request process. secs indicates the time after the client starts to request the allocation of network configuration parameters, which can be increased by default from 0. The first bit of flags is the broadcast response flag, which is used to identify whether the server responds to the message in unicast or broadcast mode. Specifically, this field can be set to 0 to indicate unicast mode, and set to 1 to indicate broadcast mode. c iaddr indicates the IP address of the client. Specifically, if the client has a legal and available IP address, it is added to this field, otherwise the field is set to 0. It should be noted that this field is not used by the client to apply for a specific IP address. yi addr indicates the IP address assigned by the server to the client. si addr indicates the server IP address from which the client obtains the startup configuration information. gi addr indicates the IP address of the first DHCP relay that the client passes through after sending the request message, that is, the gateway address. chaddr indicates the hardware address of the client. sname indicates the server name from which the client obtains the startup configuration information. file indicates the startup configuration file name and path information specified by the server for the client.
[0057] Options is an option field, which contains configuration information such as the service type and valid lease of the message. According to the definition of the options field in standards such as RFC2132, the 0-255 of this field represents different options, among which 224-254 can be modified and used by the user. In the method described in this embodiment, as an example, option 224 can be used to carry the service type, and its format includes: Option, Length, ServiceType and priority. Among them, Option occupies 1 byte and has a value of 224. Length is the length field, which occupies 1 byte and has a value of 2.
[0058] Among them, ServiceType represents the service type, which occupies 1 byte. Specifically, the value of this field can be set to distinguish different service types, for example, 0 is the default service, 1 is the voice service, 2 is the video service, etc., and a total of 256 service types can be set. Priority is the priority, which occupies 1 byte and represents the degree of matching between the service that the gateway configured by the server can handle and the service type. Specifically, the value of this field can be set to 255 to represent the highest matching degree, a value of 1 represents the lowest matching degree, and a value of 0 represents reservation, etc. In the method described in this embodiment, there is no specific limitation on the content of the field, which can be a value or a letter, for example, the letter H represents the highest matching degree, and the letter V represents the video service, etc. It can represent the field and implement the method described in this embodiment.
[0059] Step 102: Receive a response message from the server.
[0060] In the method described in this embodiment, the server receives a message from the client, parses it to obtain the ServiceType field, i.e., the client service type. It matches it with the services that the gateway configured by the server itself can handle, obtains the degree of match, writes it into a response message (DHCP-OFFER message), and sends it to the client. In the method described in this embodiment, the format of the DHCP-OFFER message refers to Figure 1b The format is where the degree of matching is the content of the priority field described above.
[0061] As an optional method, the matching degree is a numerical value. When the client service type is the same as the service that the gateway configured by the server can handle, the matching degree is set to a first numerical value. When the client service type is different from the service that the gateway configured by the server can handle, the matching degree is set to a second numerical value that is less than the first numerical value. For example, the client service type is a voice service, and when the service that the gateway configured by the server can handle is a voice service, the two are the same, and the matching degree can be set to 250. When the service that the gateway configured by the server can handle is a video service, the two are different, and the matching degree can be set to a value lower than 250, such as 10. When the service that the gateway configured by the server can handle is a general service, the two are different. However, in actual work, the gateway that handles general services also has the ability to handle voice services, but its adaptability to voice services is lower than that of the gateway that handles voice services. At this time, the matching degree can be set to a value lower than 250 but higher than 10, such as 100.
[0062] Step 103: Select the server corresponding to the response message whose matching degree meets the preset requirement as the target server.
[0063] In the method described in this embodiment, there may be multiple servers, and the client will receive response messages from multiple servers. The client parses these response messages, obtains multiple matching degrees, and selects the server corresponding to the response message with the highest matching degree value. For example, the client receives three DHCP-OFFER messages, compares the priority field in option 224 in the three DHCP-OFFER messages, selects the DHCP-OFFER message with the largest field value, and uses the server corresponding to it as the target server.
[0064] Step 104: Acquire the network configuration parameters from the target server.
[0065] In the method described in this embodiment, after the client selects the target server, it sends a request message (DHCP-REQUEST message) including the target server identifier in the form of a broadcast. Upon receiving the request message, the target server interacts with the client so that the client can obtain network configuration parameters, and all subsequent messages sent by the client are directly sent to the target server. When other servers except the target server receive the request message, they stop interacting with the client. As an optional method, the target server identifier in the DHCP-REQUEST message can be the IP address, gateway and other network configuration parameters provided by the target server, or it can be the IP address of the target server. Its content can serve to indicate that the target server has been selected, and the specific content of the target server identifier is not limited here.
[0066] In the method described in this embodiment, Figure 1c This is a timing diagram of data transmission between the client and the server disclosed in the embodiment of this application. As an optional method, Figure 1c As shown in the figure, the client first sends a DHCP-DISCOVERY message containing a ServiceType field with a value. After receiving it, the server processes it, fills in the value of the priority field, and sends a DHCP-OFFER message containing the priority field to the client. After receiving it, the client compares the values and sends a DHCP-REQUEST message containing the target server identifier. After receiving the DHCP-REQUEST message, the server determines whether the target server is itself.
[0067] In the method described in this embodiment, the server knows the types of services that its configured gateway can handle, and the processing adaptability of the gateway to each service is usually preset during network planning and deployment. For example, a router connected to the Internet via a mobile network has limited bandwidth but low latency, which is suitable for processing language services. The network bandwidth of broadband connection to the Internet is large, but the latency cannot be guaranteed, which is suitable for big data services such as video. The server and gateway in the method described in this embodiment can be deployed together or separately. This application does not make specific limitations on this, and it is sufficient to be able to implement the method described in this application.
[0068] The method described in this embodiment supports the client to carry its own service type in the message through the content of the custom field, so that the server can judge the degree of service adaptation between the client and the configured gateway through the service type. The server is supported to return a message carrying the degree of adaptation, so that the client can flexibly select a server according to service requirements in a multi-server scenario and obtain network configuration parameters from the server. In this way, the services of the client and the server gateway are highly adapted to each other and the service experience is improved.
[0069] Embodiment 2: This application discloses another method for obtaining network configuration parameters based on service type, please refer to Figure 2 , the method described in this embodiment introduces the whole process of obtaining network configuration parameters.
[0070] Step 201: A client whose service type is voice service sends a message including the service type in a broadcast form to request to obtain network configuration parameters.
[0071] Step 202: Server A configured with a gateway that is good at processing video services, server B configured with a gateway that is good at processing general services, and server C configured with a gateway that is good at processing voice services all receive the message.
[0072] Step 203: Server A parses the message, obtains the matching degree between the voice service and the video service, writes the matching degree into a response message in the form of a value of 5, and sends it to the client.
[0073] Step 204: Server B parses the message, obtains the matching degree between the voice service and the general service, writes the matching degree into a response message in the form of a value of 150, and sends it to the client.
[0074] Step 205: Server C parses the message, obtains the matching degree between the voice service and the voice service, writes the matching degree into a response message in the form of a value of 250, and sends it to the client.
[0075] Step 206: The client parses the three response messages, compares the values of the matching degrees therein, and obtains the server C corresponding to the matching degree with the largest value.
[0076] Step 207: The client writes the identifier of server C into the request message and sends it in the form of broadcast.
[0077] Step 208: Server A and server B receive the request message and stop interacting with the client.
[0078] Step 209: Server C receives the request message, interacts with the client, and receives all subsequent messages from the client.
[0079] Based on the method for obtaining network configuration parameters based on service type disclosed in the above embodiment, this embodiment correspondingly discloses a device for obtaining network configuration parameters based on service type. Figure 3 , the device for acquiring network configuration parameters based on service type includes: a request unit 301, a receiving unit 302, a selection unit 303 and an acquisition unit 304;
[0080] The request unit 301 is used to send a message including a client service type to request the server to allocate network configuration parameters;
[0081] The receiving unit 302 is used to receive a response message from the server; the response message includes the matching degree between the service that the gateway configured by the server can process and the service type of the client;
[0082] The selection unit 303 is used to select the server corresponding to the response message whose matching degree meets the preset requirement as the target server;
[0083] The acquiring unit 304 is configured to acquire the network configuration parameters from the target server.
[0084] Optionally, the device further comprises:
[0085] A message receiving unit, used for the server to receive a message from the client;
[0086] A degree acquisition unit, configured for the server to match the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree;
[0087] A degree feedback unit is used for the server to send the response message including the matching degree to the client.
[0088] Optionally, the matching degree is a numerical value, and the degree acquisition unit includes:
[0089] A first subunit, configured to set the matching degree to a first value when the service type of the client is the same as the service that can be processed by the gateway configured by the server;
[0090] The second subunit is used to set the matching degree to a second value when the client service type is different from the service that can be processed by the gateway configured by the server; the second value is smaller than the first value.
[0091] Optionally, there are multiple servers, and the selection unit 303 includes:
[0092] A response receiving subunit, used for the client to receive response messages from multiple servers;
[0093] The numerical comparison subunit is used for the client to select, from among multiple response messages, a server corresponding to a response message having the highest numerical value of the matching degree.
[0094] Optionally, there are multiple servers, and the obtaining unit 304 includes:
[0095] A broadcast subunit, configured for the client to send a request message including the target server identifier;
[0096] A target subunit, configured for the target server to receive the request message and interact with the client so that the client can obtain the network configuration parameters;
[0097] The non-target sub-unit is used for the server other than the target server to receive the request message and stop interacting with the client.
[0098] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0099] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0100] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0101] The features described in the embodiments of this specification can be replaced or combined with each other, so that professional and technical personnel in this field can implement or use the present application.
[0102] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for obtaining network configuration parameters based on service type, characterized in that: include: Sending a message including the client service type, requesting the server to allocate network configuration parameters; Receiving a response message from the server; The response message includes the matching degree between the service that can be processed by the gateway configured by the server and the service type of the client; Select the server corresponding to the response message whose matching degree meets the preset requirement as the target server; The network configuration parameters are obtained from the target server.
2. The method according to claim 1, characterized in that: Before receiving the response message from the server, the method further includes: The server receives a message from the client; The server matches the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree; The server sends the response message including the matching degree to the client.
3. The method according to claim 2, characterized in that The matching degree is a numerical value, and the server matches the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree, including: When the client service type is the same as the service that can be processed by the gateway configured by the server, setting the matching degree to a first value; When the client service type is different from the service that can be processed by the gateway configured by the server, the matching degree is set to a second value; the second value is smaller than the first value.
4. The method according to claim 3, characterized in that There are multiple servers, and selecting the server corresponding to the response message whose matching degree meets the preset requirement includes: The client receives response messages from multiple servers; The client selects a server corresponding to a response message having the highest matching degree value among multiple response messages.
5. The method according to claim 1, characterized in that There are multiple servers, and obtaining the network configuration parameters from the target server includes: The client sends a request message including the target server identifier; The target server receives the request message and interacts with the client so that the client obtains the network configuration parameters; The servers other than the target server receive the request message and stop interacting with the client.
6. A device for acquiring network configuration parameters based on service type, characterized in that: include: Request unit, receive unit, select unit and obtain unit; The request unit is used to send a message including a client service type to request the server to allocate network configuration parameters; The receiving unit is used to receive a response message from the server; the response message includes the matching degree between the service that can be processed by the gateway configured by the server and the service type of the client; The selection unit is used to select the server corresponding to the response message whose matching degree meets the preset requirement as the target server; The acquiring unit is used to acquire the network configuration parameters from the target server.
7. The device according to claim 6, characterized in that The device also includes: A message receiving unit, used for the server to receive a message from the client; A degree acquisition unit, configured for the server to match the client service type with the service that can be processed by the gateway configured by the server to obtain the matching degree; A degree feedback unit is used for the server to send the response message including the matching degree to the client.
8. The device according to claim 7, characterized in that The matching degree is a numerical value, and the degree acquisition unit includes: A first subunit, configured to set the matching degree to a first value when the service type of the client is the same as the service that can be processed by the gateway configured by the server; The second subunit is used to set the matching degree to a second value when the client service type is different from the service that can be processed by the gateway configured by the server; the second value is smaller than the first value.
9. The device according to claim 8, characterized in that There are multiple servers, and the selection unit includes: A response receiving subunit, used for the client to receive response messages from multiple servers; The numerical comparison subunit is used for the client to select, from among multiple response messages, a server corresponding to a response message having the highest numerical value of the matching degree.
10. The device according to claim 6, characterized in that There are multiple servers, and the acquisition unit includes: A broadcast subunit, configured for the client to send a request message including the target server identifier; A target subunit, configured for the target server to receive the request message and interact with the client so that the client can obtain the network configuration parameters; The non-target sub-unit is used for the server other than the target server to receive the request message and stop interacting with the client.
