Network address configuration method and vehicle

CN122845557APending Publication Date: 2026-09-29GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610951917.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-29
Publication Date
2026-09-29

AI Technical Summary

Technical Problem

此时,车机同时持有两个属于同一网段的网络地址,导致在数据包转发过程中,路由表无法有效 区分这两个地址各自对应的网络接口及其路由路径,极易产生路由解析错误和IP地址冲突,导致网络连接中断或数据通信异常

Benefits of technology

本申请提供的一种逆变器的角度校验方法中,通过在以第二网络模式与外部网络建立连接时获取第二网段信息,判断第二网段信息与第一网段信息是否属于相同网段,并在检测到网段重叠时动态确定并切换至与第二网段信息不同网段的替代网段,从根源上避免了因网段重叠导致的路由分配错误和IP冲突,保障了通信设备在双模式下的网络连接稳定性和数据传输正常进行。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122845557A_ABST
    Figure CN122845557A_ABST
Patent Text Reader

Abstract

The application discloses a network address configuration method and a vehicle, and is applied to the field of intelligent networking. The network address configuration method is applied to a communication device and includes the following steps: acquiring first network segment information configured in a first network mode; acquiring second network segment information associated with an external network when a connection with the external network is established in a second network mode; judging whether the second network segment information and the first network segment information belong to the same network segment; if yes, determining a replacement network segment that is different from the second network segment information, and configuring the network segment of the first network mode as the replacement network segment; and if not, maintaining the first network segment information configured in the first network mode unchanged, and connecting with the external network through the second network mode. By dynamically detecting network segment overlap and switching to a non-overlapping replacement network segment, IP conflict caused by network segment overlap in the double-network mode of the communication device is avoided, and the stability of network connection and the normal transmission of data are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent connected vehicles, and in particular to a network address configuration method and a vehicle. Background Technology

[0002] With the rapid development of vehicle-to-everything (V2X) technology, V2X systems are generally equipped with wireless modules and can usually support hotspot modes, such as Access Point (AP) mode and Station (STA) mode, to provide network sharing and access to external networks for other devices.

[0003] In practical engineering, to ensure the uniformity and compatibility of multi-device interconnection, the AP mode is usually configured to use a fixed private Internet Protocol Address (IP) network segment. However, when the vehicle's infotainment system operates in both AP and STA modes simultaneously, if the external hotspot connected to the STA mode, such as another vehicle's hotspot, also uses the same fixed network segment as the AP mode, the vehicle's infotainment system will obtain an IP address from the external hotspot that is in the same network segment as the AP mode. In this case, the vehicle's infotainment system simultaneously holds two network addresses belonging to the same network segment. During packet forwarding, the routing table cannot effectively distinguish the network interface and routing path corresponding to these two addresses, easily leading to routing resolution errors and IP address conflicts, resulting in network connection interruptions or abnormal data communication.

[0004] Therefore, how to avoid communication failures caused by network segment overlap when the vehicle's infotainment system operates in dual modes has become an urgent problem to be solved. Summary of the Invention

[0005] In view of this, this application aims to provide a network address configuration method and a vehicle to solve the above-mentioned technical problems.

[0006] In a first aspect, this application provides the following: obtaining first network segment information configured in a first network mode; obtaining second network segment information associated with the external network when establishing a connection with an external network in a second network mode; determining whether the second network segment information and the first network segment information belong to the same network segment, wherein the same network segment means that the network segment range corresponding to the second network segment information and the network segment range corresponding to the first network segment information at least partially overlap, and the network segment range is determined by the Internet Protocol IP address and subnet mask in an IPv4 network, and by the prefix and prefix length in an IPv6 network; if yes, then determining an alternative network segment that belongs to a different network segment than the second network segment information, and configuring the network segment of the first network mode as the alternative network segment; if no, then maintaining the first network segment information configured in the first network mode unchanged, and connecting to the external network through the second network mode.

[0007] In the embodiments of the first aspect of this application, the first network mode is a wireless access point mode, in which the communication device provides network services to external devices through the wireless access point mode, and the second network mode is a wireless client mode, in which the communication device accesses an external hotspot network through the wireless client mode.

[0008] In an embodiment of the first aspect of this application, the alternative network segment is one of the pre-stored backup network segments. The backup network segment does not overlap with the network segment corresponding to the first network segment information. The step of determining the alternative network segment that belongs to a different network segment from the second network segment information includes: detecting the Internet Protocol address occupancy status in each backup network segment; and selecting an unoccupied backup network segment from the backup network segments as the alternative network segment based on the detected occupancy status.

[0009] In an embodiment of the first aspect of this application, the network address configuration method further includes: configuring the network segment of the first network mode as a substitute network segment, then obtaining the IP address allocated by the external network obtained by the second network mode; determining whether the network segment of the IP address and the substitute network segment belong to the same network segment; if so, rejecting the IP address allocation and controlling the communication device to re-initiate an IP address request to the external network; if not, establishing a connection with the external network using the second network mode.

[0010] In an embodiment of the first aspect of this application, the network address configuration method further includes: when an IP address that does not overlap with the network segment cannot be obtained after multiple IP address requests, closing the first network mode or outputting an IP conflict prompt through the user interface.

[0011] In an embodiment of the first aspect of this application, the network address configuration method further includes: presetting a routing priority rule in the routing table of the communication device, wherein the priority of the routing entry corresponding to the second network mode is higher than that of the first network mode; when forwarding a data packet, checking whether there is a routing entry that conforms to the second network mode; if so, matching the routing entry corresponding to the second network mode; if not, matching the routing entry corresponding to the first network mode.

[0012] In an embodiment of the first aspect of this application, the network address configuration method further includes: updating the routing entries in the routing table corresponding to the first network mode and the second network mode in real time when the first network segment information of the first network mode is reconfigured, the IP address of the second network mode is changed, or the network mode of the communication device is switched.

[0013] In an embodiment of the first aspect of this application, the step of determining an alternative network segment that belongs to a different network segment from the second network segment information includes: allocating a subnet that is not occupied by the first network mode, the second network mode, or other network interfaces of the device from the dynamic address resource pool built into the communication device as an alternative network segment; and reclaiming the first network segment information configured in the first network mode to the dynamic address resource pool.

[0014] In the embodiments of the first aspect of this application, the network address configuration method further includes the steps prior to establishing a connection with an external network in the second network mode: scanning accessible external networks around the communication device and obtaining candidate network segment information corresponding to each external network; determining a pre-selected network segment that does not overlap with each candidate network segment information based on each candidate network segment information and the first network segment information; and configuring the network segment of the first network mode as the pre-selected network segment.

[0015] Secondly, this application provides a vehicle that includes a vehicle body and a vehicle-mounted unit. The vehicle-mounted unit is disposed within the vehicle body and includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, it implements the aforementioned network address configuration method.

[0016] The above-mentioned technical solution adopted in this application can achieve the following beneficial effects: The angle verification method for an inverter provided in this application obtains the second network segment information when establishing a connection with an external network in the second network mode, determines whether the second network segment information and the first network segment information belong to the same network segment, and dynamically determines and switches to an alternative network segment that is different from the second network segment information when network segment overlap is detected. This avoids routing allocation errors and IP conflicts caused by network segment overlap from the root, and ensures the stability of network connection and normal data transmission of communication equipment in dual mode. Attached Figure Description

[0017] The accompanying drawings, which are provided to further illustrate this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application.

[0018] Figure 1 This is a flowchart illustrating a network address configuration method provided in an embodiment of this application.

[0019] Figure 2 This is a flowchart illustrating a network segment overlap verification method provided in an embodiment of this application.

[0020] Figure 3 This is a flowchart illustrating a routing and forwarding method provided in an embodiment of this application.

[0021] Figure 4This is a schematic diagram of a network address configuration device provided in an embodiment of this application.

[0022] Figure 5 A corresponding to this application Figure 1 A schematic diagram of the structure of an electronic device. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0025] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0026] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0027] In vehicle-to-everything (V2X) applications, the in-vehicle infotainment system typically needs to act not only as a hotspot for mobile phones, tablets, or other in-vehicle devices to connect and enable in-vehicle entertainment and navigation data sharing, but also as a client to access external networks, such as connecting to a home router, public Wi-Fi, or the hotspot of another in-vehicle device to obtain internet services. To simplify the identification and configuration process between devices, related technologies often fix the Internet Protocol (IP) address range of the in-vehicle wireless access point (AP) mode to a specific private address range, such as 192.168.143.xxx, to ensure that devices in the same environment can quickly discover and establish connections.

[0028] However, this fixed network segment design is prone to IP address overlap when dealing with multi-vehicle interconnection or the coexistence of in-vehicle infotainment systems and external hotspots, as the external hotspots also use the same network segment. Specifically, when vehicle infotainment system A connects to vehicle infotainment system B's hotspot in Stationmode (STA), vehicle infotainment system B assigns vehicle infotainment system A an IP address within the 192.168.143.xxx network segment, such as 192.168.143.66. Vehicle infotainment system A's own fixed IP address in AP mode is also located in this network segment, such as 192.168.143.1. At this time, vehicle infotainment system A's wireless module simultaneously possesses two IP addresses in the same network segment. When data packets need to be sent, the routing table cannot clearly distinguish the paths corresponding to these two IP addresses. That is, data packets that should be transmitted to the external network via the STA interface may be incorrectly redirected to the AP interface, and vice versa. This routing ambiguity directly leads to IP conflicts, which may cause frequent network connection drops, data transmission failures, or even complete failure of the vehicle interconnection function, affecting the user's actual experience.

[0029] Furthermore, in complex in-vehicle environments, vehicle-mounted systems may need to switch between multiple modes or connect to multiple external hotspots simultaneously within a short period, increasing the probability of network segment conflicts. Therefore, eliminating the risk of network segment overlap under dual-mode operation, while ensuring the accuracy of routing resolution and the stability of network communication, without altering the product requirement of a fixed network segment in the vehicle-mounted system's AP mode, has become a critical technical bottleneck that urgently needs to be overcome in this field.

[0030] Based on this, this application provides a network address configuration method to solve the network conflict problem that may occur when a communication device operates simultaneously in a first network mode, such as AP mode, and a second network mode, such as STA mode, due to the overlap of network segments used by the two modes. Figure 1 As shown, the network address configuration method specifically includes the following steps S101~S104.

[0031] S101: Obtain the first network segment information configured in the first network mode.

[0032] In one or more embodiments of this application, the specific device executing the network address configuration method is not limited. It can be executed by an in-vehicle processor, such as the main processor of the vehicle's infotainment system, a dedicated controller or coprocessor configured with a WIFI control module, network segment detection module, etc., or an external computing device connected to the vehicle's infotainment system via network communication, such as a cloud server or mobile terminal. However, in typical in-vehicle engineering implementations, to ensure real-time control, reduce system complexity, and avoid additional communication overhead, this method is generally executed by the main processor within the vehicle's infotainment system. Therefore, for ease of description and understanding, this application specification will subsequently use the processor within the vehicle's infotainment system as an example to elaborate on this method in detail. The processor can be any type of device, such as a microcontroller unit (MCU), digital signal processor (DSP), field-programmable gate array (FPGA), etc., and this application does not impose any limitations on this.

[0033] In communication devices, such as the Wi-Fi module in an in-vehicle infotainment system, the first network mode, such as the AP mode, is typically responsible for providing local network access services to other devices, such as mobile phones and tablets. To ensure that these access devices can quickly and stably obtain IP addresses and communicate, this first network mode usually uses a preset, fixed private network segment, namely the first network segment information of this application. Therefore, in order to accurately determine whether the network segments of the two network modes conflict and decide whether to perform a network segment switch, the processor can first obtain the first network segment information configured in the first network mode.

[0034] Specifically, the network segment information of the first network mode is usually set at the factory or configured by the user and stored in the device's non-volatile memory, such as flash memory or firmware. The processor can obtain the first network segment information by accessing the non-volatile memory. Generally, the first network segment information refers to the set of parameters used to determine the current network segment range of the first network mode. For example, in an Internet Protocol version 4 (IPv4) network, this information is usually an IP address (such as 192.168.143.1) and a subnet mask (such as 255.255.255.0), which limits the network segment range to 192.168.143.0 / 24. This range is the IP address pool that the first network mode can serve.

[0035] Additionally, it should be noted that the first network mode is typically configured to use a fixed private network segment. For example, in automotive scenarios, to simplify the discovery and interconnection process between devices, vehicle manufacturers may uniformly set the default network segment for AP mode to 192.168.143.0 / 24. In this case, step S100 specifically involves the processor directly reading the preset fixed network segment parameter from non-volatile memory. However, in some scenarios, the network segment of the first network mode may be manually configured by the user or dynamically allocated by the system according to a certain algorithm. Regardless of whether the source of the first network segment information is preset, user-inputted, or dynamically generated, the processor can first obtain its current actual configuration value. For a communication device that supports multiple network interfaces, such as AP, STA, Ethernet, cellular network, etc., each interface may have a different network segment. In this step S101, the first network segment information configured for the first network mode specifically refers to the network segment information bound to the interface of the first network mode, such as AP mode.

[0036] This step S101 provides accurate and reliable baseline data for subsequent network segment conflict detection, thus preventing IP conflicts at their source.

[0037] S102: When establishing a connection with an external network in the second network mode, obtain the second network segment information associated with the external network.

[0038] In practical engineering, IP conflict risks arise because two network modes of communication devices may use the same network segment. Therefore, after obtaining the first network segment information of the first network mode, in order to avoid such conflicts, it is necessary to obtain the network segment information used by the external network during the connection establishment process, or even before officially obtaining the IP address, so as to compare it with the first network segment information, thereby determining whether there is an overlap risk and deciding whether adjustments need to be made in advance.

[0039] Specifically, when the communication device initiates a connection request to an external network in a second network mode, for example, when the Wi-Fi module is working in STA mode, scans for an accessible Wi-Fi hotspot in the vicinity, such as Car-Hotspo, and prepares to initiate a connection to it, the processor obtains the second network segment information associated with the external network during the connection establishment process.

[0040] It should be noted that, in one or more embodiments of this application, the processor is not limited to specifically verifying and obtaining the second network segment information. It can be obtained through Dynamic Host Configuration Protocol (DHCP) messages, that is, by the DHCP server carrying the allocated IP address, subnet mask, and other information in the Offer or ACK message during the DHCP interaction process. For example, if the allocated IP address is resolved to 192.168.1.105 and the subnet mask is 255.255.255.0, then it can be known that the network segment of the external network is 192.168.1.0 / 24.

[0041] In addition, information can also be obtained through beacon frames or probe response frames. For example, in the 802.11 protocol, wireless access points periodically broadcast beacon frames, which may contain information such as the Service Set Identifier (SSID) and supported speeds for the network. Although the beacon frame itself usually does not directly contain the network segment address, the device can indirectly obtain the network segment configuration information by sending a probe request and receiving a probe response, combined with the subsequent association process. Alternatively, it can be obtained through pre-configured information. For example, in some implementation scenarios, the network segment information of the external network may be provided to the communication device in advance by upper-layer applications or protocols. For instance, under a specific protocol for vehicle-to-everything (V2X) connectivity, when two V2X systems exchange connection information, they may directly include their respective IP network segment definitions.

[0042] Since there are many methods to obtain information about the second network segment, this application will not list them all, and you can set them according to actual needs.

[0043] Additionally, in some cases, network issues, such as a non-responsive DHCP server or a weak signal, may prevent the acquisition of information from the second network segment within the specified time. In such situations, communication devices can employ various handling strategies, such as: abandoning the connection after a certain number of retries, directly assuming no conflict and continuing the connection, or combining subsequent verification steps for fault tolerance or prompting the user of a connection error. There are many options available, and this application does not impose any restrictions; the configuration can be tailored to actual needs.

[0044] Knowing the IP address segment information of the external network in advance provides necessary data input for subsequent decisions, such as whether to switch network segments.

[0045] S103: Determine whether the second network segment information and the first network segment information belong to the same network segment. The same network segment means that the network segment range corresponding to the second network segment information at least partially overlaps with the network segment range corresponding to the first network segment information. The network segment range is determined by the Internet Protocol (IP) address and subnet mask in IPv4 networks, and by the prefix and prefix length in IPv6 networks. If yes, proceed to step S104; otherwise, proceed to step S105.

[0046] After obtaining the first network segment information and the second network segment information, in order to accurately determine whether subsequent network segment adjustment operations are needed and to avoid the routing table being unable to effectively distinguish the network interface and forwarding path corresponding to these two addresses, thereby causing IP address conflicts, network connection interruptions, packet loss, or communication abnormalities, the processor can also compare the two network segment information before the second network mode officially completes the connection and obtains the IP address to determine whether there is an overlap between them. If there is an overlap, step S104 is executed; if there is no overlap, step S105 is executed.

[0047] Specifically, the processor uses an appropriate calculation method based on the network type to determine whether two network segments belong to the same network segment. For example, in an IPv4 network, the processor performs a logical AND operation between the IP address in the second network segment information and the subnet mask in the second network segment information to obtain the network address to which that address belongs. Similarly, it performs a logical AND operation between the network address in the first network segment information and the subnet mask in the first network segment information to obtain the network address of the first network mode. Then, it compares the results of these two operations. If the results are the same, it means that the two IP addresses or network addresses belong to the same network prefix, that is, they belong to the same network segment. If they are not the same, it means that the two IP addresses or network addresses belong to different network prefixes, that is, they belong to different network segments. In an IPv6 network, the processor compares the prefix and prefix length in the two network segment information. If the prefix portions of the two addresses, that is, the high-order bits of the address truncated according to the prefix length, are exactly the same, then they belong to the same network segment.

[0048] If the second network segment information and the first network segment information belong to the same network segment, it indicates that there is an IP conflict risk, and step S104 is executed. If the second network segment information and the first network segment information do not belong to the same network segment, it indicates that there is no network segment conflict risk, and step S105 is executed.

[0049] Additionally, it should be noted that the network segment of the vehicle's AP mode may not only be a fixed network segment, but also a large network segment, such as 10.0.0.0 / 8. Its STA mode connection to the external Wi-Fi network uses the network segment 10.1.2.0 / 24. Since 10.1.2.0 / 24 is entirely within the range of 10.0.0.0 / 8, there is overlap, and the processor can also determine that they are the same network segment, triggering a network segment switch. For certain special subnet masks, such as / 31 subnet and / 32 subnet, the determination method described in this application can also be used. This application specification will not elaborate further.

[0050] By comparing the information of the first network segment and the second network segment, the risk of network segment overlap between the two network modes can be accurately and quantitatively determined. This ensures that the complex network segment switching mechanism is only triggered when there is a real risk of conflict, thereby ensuring communication stability while avoiding unnecessary consumption of system resources.

[0051] S104: Determine an alternative network segment that belongs to a different network segment than the second network segment information, and configure the network segment of the first network mode as the alternative network segment.

[0052] When the first network segment information and the second network segment information belong to the same network segment, the communication device will simultaneously hold two IP addresses belonging to the same network segment, which will inevitably lead to routing ambiguity and IP conflicts. Therefore, the processor can take proactive measures to eliminate this conflict. Since the external network connected to the second network mode is actively initiated by the user, its network segment is determined by the external network and cannot be changed by the communication device. Therefore, the processor can adjust the network segment of the first network mode, switching it to a new network segment that does not overlap with the second network segment.

[0053] Specifically, the processor initiates an alternative network segment selection mechanism to search for a network segment from available network segment resources that does not overlap with the second network segment information; this alternative network segment refers to the new network segment used to replace the current network segment of the first network mode after detecting that the first and second network segment information belong to the same network segment. This network segment must not overlap with the network segment corresponding to the second network segment information to ensure that the IP addresses of the two network modes are in different subnets. For example, if the first network segment is 192.168.143.0 / 24 and the second network segment is also 192.168.143.0 / 24, then a valid alternative network segment might be 192.168.144.0 / 24.

[0054] Then, modify the IP address and subnet mask of the network interface in the first network mode to match the values ​​of the replacement network segment. For example, change the IP address of the AP interface from 192.168.143.1 to 192.168.144.1, while keeping the subnet mask unchanged at 255.255.255.0. Simultaneously, the system needs to update all network configurations related to this interface, including but not limited to the DHCP server address pool (used to assign IP addresses to devices connected to the AP in the new network segment) and routing entries in the routing table.

[0055] By actively selecting and switching network segments, the risk of IP conflicts caused by overlapping network segments is eliminated, ensuring the stable coexistence of dual-mode networks.

[0056] S105: The first network segment information remains unchanged while maintaining the configuration of the first network mode.

[0057] When it is determined that the first network segment information and the second network segment information do not belong to the same network segment, it can be determined that there is no risk of conflict at this moment. The processor can maintain the existing configuration of the first network mode and allow the second network mode to complete the connection with the external network according to the normal process.

[0058] Specifically, the processor allows the second network mode to interact with the external network according to the normal connection process, including completing the full DHCP process to obtain an IP address and initiating normal data transmission. At this point, since the two network segments have been confirmed to be non-overlapping, no IP conflict issues will occur. In conflict-free scenarios, unnecessary network segment changes are avoided, ensuring the system operates lightweight, stable, and efficiently.

[0059] By adaptively making optimal responses to different scenarios, communication devices significantly improve their adaptability in complex network environments and enhance user experience.

[0060] based on Figure 1 The network address configuration method shown here obtains the second network segment information when establishing a connection with an external network in the second network mode, determines whether the second network segment information and the first network segment information belong to the same network segment, and dynamically determines and switches to an alternative network segment that is different from the second network segment information when network segment overlap is detected. This fundamentally avoids routing allocation errors and IP conflicts caused by network segment overlap, and ensures the stability of network connection and normal data transmission of communication equipment in dual modes.

[0061] In addition, it should be noted that the AP and STA dual-mode coexistence scenario is only a typical scenario that is prone to network segment conflicts provided by this application. In addition, it can also be applied to other dual-mode coexistence scenarios, such as dual STA mode, P2P and AP mode, etc. This application does not list them one by one, nor does it impose any restrictions on them.

[0062] In addition, when determining the alternative network segment, in order to ensure the reliability of the network segment switching and avoid jumping from one conflict to another, the processor can pre-store a set of backup network segments that do not overlap with the first network segment in the device. Before the actual switching, it checks the IP address occupancy status of each backup network segment one by one, and finally selects a backup network segment that is not currently occupied by any device as the alternative network segment. In this way, it ensures that the network segment after the switch is idle and available, thereby avoiding the risk of secondary conflicts.

[0063] Specifically, the processor pre-stores a list of backup network segments. This list contains at least one network segment that does not overlap with the network segment corresponding to the first network segment information, serving as a candidate resource pool for network segment switching. For example, if the first network segment is 192.168.143.0 / 24, the list of backup network segments may include 192.168.144.0 / 24, 192.168.145.0 / 24, 10.0.0.0 / 24, etc.

[0064] Then, when determining the alternative network segment, the processor first verifies whether any IP addresses in the candidate resource pool are already occupied. Of course, in one or more embodiments of this application, the processor is not limited in how it detects the IP address occupancy status within the backup network segment. This can be done via the Address Resolution Protocol (ARP), for example, by sending ARP requests to one or more critical IP addresses within the backup network segment. If an ARP response is received, it indicates that the IP address is occupied; if no response is received within a predetermined time, it indicates that the address is free. When the detection results show that none of the IP addresses in the current candidate backup network segment are occupied, or at least the critical addresses are not occupied, the processor determines that backup network segment as the final alternative network segment. If the detection results show that any IP addresses in the current candidate backup network segment are already occupied, the processor abandons that backup network segment and selects the next candidate network segment from the backup network segment list until a completely free backup network segment is found.

[0065] In addition, the processor can also reclaim the information of the first network segment after determining the alternative network segment and use it as a backup network segment again.

[0066] By checking the IP address occupancy status of each backup network segment one by one, a backup network segment that is not currently occupied by any device is finally selected as the replacement network segment. Based on the real-time perception of the current network environment usage, secondary IP conflicts caused by switching to an already occupied network segment are avoided, thus improving the reliability and robustness of the network segment switching process.

[0067] Since the communication equipment has completed the switch from the first network mode's network segment to an alternative network segment, theoretically, the IP conflict should be eliminated because the alternative network segment has been confirmed not to overlap with the second network segment. However, the risk of IP conflict still exists. For example, although the external network's overall network segment is different from the alternative network segment, its DHCP server may have misconfigurations or vulnerabilities, causing the STA mode to be assigned an IP address that happens to fall within the alternative network segment. Alternatively, during the STA mode connection process, the external network's own network segment may change due to administrator operations or automatic configuration, causing the IP address network segment ultimately obtained by the STA to be inconsistent with the previously obtained second network segment information, thus overlapping with the switched alternative network segment. Furthermore, although a backup network segment occupancy check was performed, within a very short time after the switch is completed, new IP address occupancy may occur within the alternative network segment due to the access of other devices. Therefore, to completely eliminate all possible residual overlap risks, the processor can perform a final network segment overlap check after the IP address is actually obtained in the second network mode.

[0068] Specifically, such as Figure 2 As shown, Figure 2 This is a schematic diagram of the flow of a network segment overlap verification method provided in an embodiment of this application. It includes steps S201 to S204.

[0069] S201: After configuring the network segment of the first network mode as the alternative network segment, obtain the IP address allocated by the external network obtained by the second network mode.

[0070] S202: Determine whether the network segment of the IP address and the alternative network segment belong to the same network segment. If yes, proceed to step S203; otherwise, proceed to step S204.

[0071] S203: Reject the IP address allocation and control the communication device to re-initiate an IP address request to the external network.

[0072] S204: Establish a connection with an external network using the second network mode.

[0073] The processor obtains the IP address allocated by the external network to the STA mode, compares its network segment with the replacement network segment after the switch, and if an overlap is found, it rejects the conflicting IP address and forces the STA mode to re-initiate an IP address request to the external network until it obtains an IP address that is truly separate from the replacement network segment.

[0074] For example, the vehicle's infotainment system switches the access point (AP) network segment to 192.168.145.0 / 24. Subsequently, in STA mode, it obtains an IP address of 192.168.145.88 with a subnet mask of 255.255.255.0 from external Wi-Fi. The processor calculates that this IP address belongs to the 192.168.145.0 / 24 network segment, which is exactly the same as the AP's replacement network segment. Therefore, the processor rejects this IP address and resends a DHCP Discover request. The second IP address obtained is 192.168.50.10, and its network segment is 192.168.50.0 / 24, which does not overlap with 192.168.145.0 / 24, so the verification passes.

[0075] In an IPv6 network, the processor obtains the IPv6 address and prefix length. For example, if the alternative network segment is 2001:db8:1:: / 48, the obtained IP address is 2001:db8:1:2::10 / 64. Since both are the same within the / 48 prefix length (both are 2001:db8:1::), they are determined to be the same network segment, triggering a rejection and a re-request.

[0076] By rejecting conflicting IPs and forcing re-application, any possible IP address intrusion is eliminated at the source, making the logical separation of the dual-mode network more thorough and reliable.

[0077] In some external networks, such as older public Wi-Fi networks or hotspots for specific devices, DHCP servers may only assign IP addresses within a fixed subnet, for example, only IP addresses within the 192.168.143.x subnet. If an alternative subnet also happens to be within this subnet, each subsequent request will obtain an IP address from the same subnet, causing a loopback failure. Therefore, the processor can disable the first network mode or display an IP conflict warning via the user interface when multiple IP address requests fail to yield a non-overlapping IP address. This ensures network stability or provides users with decision-making support in extreme conflict scenarios, preventing communication failures.

[0078] Furthermore, when dual modes coexist, the routing table will contain default routes or directly connected routes for both network modes simultaneously. For example, the route for AP mode points to 192.168.143.0 / 24, and the route for STA mode points to 192.168.50.0 / 24. When a communication device wants to access the Internet, such as when the destination IP is a public IP address 8.8.8.8, the routing table will look up a matching route entry. Since both routes could be default routes or both match the same prefix, the processor will be unable to determine which path to choose. That is, a data packet that should exit via STA mode may be incorrectly redirected to AP mode, causing the data packet to fail to reach the Internet, resulting in network connection failure or delay. Therefore, to ensure that data packets can be transmitted efficiently and accurately along the expected path, a clear priority determination mechanism needs to be introduced into the routing table.

[0079] Specifically, such as Figure 3 As shown, Figure 3 This is a flowchart illustrating a routing and forwarding method provided in an embodiment of the present application, including steps S301 to S304.

[0080] S301: A routing priority rule is preset in the routing table of the communication device, wherein the priority of the routing entry corresponding to the second network mode is higher than that of the first network mode.

[0081] S302: When forwarding data packets, check if there is a routing entry that matches the second network mode. If yes, proceed to step S303; otherwise, proceed to step S304.

[0082] S303: Match the routing entry corresponding to the second network mode.

[0083] S304: Match the routing entry corresponding to the first network mode.

[0084] The processor pre-defined routing priority rules, enforcing a second network mode. Routes connecting to the external internet typically have higher priority than the first network mode, which is usually used for local device interconnection. When data packets need to be forwarded, the processor first searches the routing table for and matches the route entry corresponding to the second network mode; only when the second network mode route is unavailable does it match the first network mode route. This approach ensures that critical business data, such as internet access, is preferentially transmitted via the external network, while local network services can still serve as a supplement.

[0085] It should be noted that in certain special application scenarios, users may wish to temporarily increase the priority of AP mode, for example, by sharing an external data service with a specific device via AP mode. In this case, the communication device can provide a configuration interface that allows users or applications to adjust the priority rules. For example, through the user interface or API, the routing priority of AP mode can be temporarily increased to the same level as or higher than that of STA mode. However, as a general optimization approach, the second network mode is set to a higher priority by default.

[0086] Furthermore, if the information in the routing table is static, while the actual network configuration changes dynamically, outdated routing entries will lead to incorrect routing decisions when the network configuration changes, preventing data packets from being forwarded along the expected path. Therefore, to ensure that routing decisions are always consistent with the current network state, the processor can also monitor network configuration change events and automatically trigger update operations on the routing entries in the routing table corresponding to the first and second network modes when such events occur, thereby ensuring that the routing table always reflects the latest network topology.

[0087] Specifically, the processor continuously monitors configuration changes related to the first and second network modes, such as whether the first network segment information has been reconfigured, whether the IP address of the second network mode has changed, or whether the network mode of the communication device has switched. When the processor detects any of these events, it immediately performs a routing table update operation. The update includes at least: removing currently invalid or incorrect routing entries. For example, in event A, the route pointing to the original AP network segment 192.168.143.0 / 24 is deleted, and all routes related to the old AP IP address are also deleted. New routing entries are added or modified, and priorities are updated.

[0088] For example, when the vehicle's infotainment system switches its AP mode network segment from 192.168.143.0 / 24 to 192.168.144.0 / 24 due to a network segment conflict, the processor can trigger a routing table update. This involves deleting the route entry pointing to the 192.168.143.0 interface and adding a direct route to the 192.168.144.0 / 24 interface, with the outgoing interface being the AP interface. Simultaneously, the new route entry is ensured to have a lower priority than existing STA mode routes, so as not to affect external network access. The update process is completed within milliseconds, allowing mobile devices connected in AP mode to continue communicating using the new network segment almost imperceptibly.

[0089] Alternatively, when the vehicle's STA mode DHCP lease expires and it obtains a new IP address (192.168.100.50) from the external network instead of the previous 192.168.50.10, the processor detects the IP address change event and subsequently updates the routing entries related to STA mode in the routing table. If the network segment of the new IP address does not conflict with the old default route (e.g., the old IP is 192.168.50.10 / 24 and the new IP is 192.168.100.50 / 24), the default route is retained, but its outgoing interface IP address information is updated. If the change in the network segment of the new IP address necessitates modification of the default route (e.g., the default gateways of the two network segments are different), the old default route is deleted and the new default route is added.

[0090] When the user manually disables AP mode through the vehicle's infotainment system, or the system automatically disables AP mode due to a conflict, the processor detects the network mode switching event and can delete all routing entries related to AP mode from the routing table, including directly connected routes and any routes learned through AP mode, to avoid leaving isolated, non-forwardable entries in the routing table and to prevent interference with data forwarding in STA mode.

[0091] By dynamically adjusting routing entries based on changes in network configuration, the problem of outdated routing information caused by configuration changes is eliminated. This ensures that every packet forwarding decision is based on the latest and correct routing information, improving the adaptability of communication equipment in dynamic network environments and avoiding failures such as packet loss, connection interruption, or routing loops caused by outdated routing tables.

[0092] While a pre-defined list of backup network segments can eliminate network segment overlap, a fixed number of backup segments may be insufficient for complex communication devices with numerous interfaces, and management may lack flexibility. Therefore, to overcome the limitations of a fixed backup network segment list, the processor can introduce a dynamic address resource pool. This means the communication device maintains a dynamic subnet resource pool that records the currently occupied subnet information for all network interfaces, including the first network mode, the second network mode, and other interfaces. When an alternative network segment needs to be determined, the processor allocates a free subnet from this resource pool that is not currently occupied by any interface; simultaneously, the original first network segment information is returned to the resource pool so that it can be used by other interfaces or in the future.

[0093] It should be noted that a dynamic address resource pool refers to a set of network subnets maintained by the communication equipment, used to dynamically allocate and reclaim subnet resources for various network interfaces within the equipment. This pool can be a database or a list. The contents of this dynamic address resource pool can be preset at the factory or dynamically added through firmware upgrades or remote configuration; this application does not impose any restrictions on this.

[0094] In addition, the processor can also combine dynamic resource pools with a list of backup network segments. For example, the device can first try to select from the list of backup network segments; if all network segments in the list are occupied or insufficient, then the dynamic address resource pool can be used for allocation, so as to balance fast response and resource flexibility.

[0095] In addition, since the detection and adjustment of network segment conflicts occur when establishing a connection with an external network in the second network mode, in order to reduce the latency in establishing the connection and avoid the possible momentary network configuration chaos before the first network mode is switched after the conflict is detected, the processor can also advance the detection and avoidance of network segment conflicts to before the second network mode officially initiates the connection. That is, before step S102, the processor actively scans all accessible external networks around the communication device to obtain their network segment information, i.e., candidate network segment information. Then, based on the current network segment information of the first network mode, it pre-calculates and determines a pre-selected network segment that does not overlap with all candidate network segments, and pre-configures the network segment of the first network mode as the pre-selected network segment to minimize any risk of conflict and delay.

[0096] Specifically, the processor scans the surrounding external networks that can be accessed in real time. For each accessible external network in the list, the processor obtains the network segment information associated with each network by parsing its broadcast frames or actively sending a probe request and receiving a response. The processor compares all the obtained candidate network segment information with the first network segment information currently configured in the first network mode of this device. If the first network segment information itself does not overlap with any of the candidate network segments, then the pre-selected network segment can directly use the first network segment information. If there is a conflict, a network segment that meets the conditions is selected from the backup network segment list or the dynamic address resource pool. Through the predictive adjustment strategy, the latency when establishing a connection in the second network mode is shortened, and the instantaneous network segment overlap window that may occur during the connection establishment process is eliminated.

[0097] As a specific embodiment, this embodiment takes a family car equipped with an intelligent vehicle system as an example to describe the network address configuration method. The vehicle system supports dual network modes working simultaneously, namely AP mode and STA mode.

[0098] Specifically, the driver enters the vehicle with a smartphone. After the vehicle's infotainment system is powered on, its AP mode is configured according to pre-written fixed network segment parameters, which define the private network segment provided by AP mode. Simultaneously, in order to use online music and real-time navigation services, the infotainment system automatically activates STA mode, initiating connection requests to nearby accessible external networks.

[0099] When the driver connects their phone to the hotspot provided by the vehicle's infotainment system, the phone obtains an IP address assigned in AP mode. Almost simultaneously, the vehicle's STA mode searches for an available public Wi-Fi hotspot and attempts to establish a connection. During this connection establishment process, the vehicle's infotainment system obtains information about the network segment associated with this external network through initial communication with it.

[0100] Subsequently, the vehicle's infotainment system compares its own AP mode configured network segment information with the acquired external network segment information to determine if they belong to the same network segment. Here, "same network segment" means that the IP address ranges corresponding to the two network segments at least partially overlap. In IPv4 networks, this range is determined by both the IP address and the subnet mask. The external public Wi-Fi happens to use a network segment that is exactly the same as the fixed network segment in the vehicle's AP mode. The vehicle's infotainment system determines that they belong to the same network segment, posing a risk of IP conflict. If no action is taken, when a mobile phone accesses vehicle resources via AP mode while the vehicle's infotainment system accesses an external network via STA mode, the routing table will be unable to correctly distinguish data packets destined for different targets within the same network segment, leading to data transmission interruptions or errors.

[0101] Upon detecting overlapping network segments, the vehicle's infotainment system automatically triggers a network segment switching mechanism. The system's storage module pre-stores multiple backup network segments that do not overlap with the fixed network segment in AP mode, such as different private IPv4 network segments. The system then sequentially checks the IP address occupancy status within each backup network segment, probing whether any device within that segment is using a specific IP address by sending ARP requests.

[0102] For the first backup network segment, detection revealed that some IP addresses within it were already in use, indicating a potential conflict. The vehicle's infotainment system abandoned using this segment. Next, the second backup network segment was detected, confirming that no IP addresses within it were responding to ARP requests, indicating that the segment was idle. The vehicle's infotainment system designated this unoccupied backup network segment as the replacement segment and automatically switched the AP mode network segment to this replacement segment, while simultaneously updating the IP addresses in AP mode.

[0103] After completing the network segment switch, the vehicle's infotainment system continues the connection process between STA mode and the external network, obtaining an IP address assigned by the external network. At this point, the system initiates an IP verification step, comparing the network segment of the IP address obtained in STA mode with the network segment replaced by the new AP mode. In this scenario, the two belong to different network segments, the verification passes, and the system successfully completes the dual-mode network configuration.

[0104] Subsequently, when the vehicle's infotainment system needs to forward data packets, the preset routing priority rules in its routing table come into play. These rules prioritize routing entries for STA mode over AP mode. The system first checks for a matching routing entry for the STA mode network interface, then sends internet access data packets through the external network, ensuring smooth online navigation and music services. AP mode routing entries are only matched and used for local communication between devices; the routing paths for both modes are independent.

[0105] Meanwhile, the routing table is updated in real time. When an AP mode network segment switches, the route entries pointing to the original network segment are automatically deleted, and new route entries pointing to the replacement network segment are added. This real-time updating of the routing table ensures that route resolution always remains consistent with the current network configuration.

[0106] based on Figure 1 Following the same logic as the network address configuration method shown, this application also provides a corresponding network address configuration device, such as... Figure 4 As shown, the angle verification device includes an acquisition module 401, a connection module 402, and a judgment module 403: the acquisition module 401 is used to acquire the first network segment information configured in the first network mode; the connection module 402 is used to acquire the second network segment information associated with the external network when establishing a connection with the external network in the second network mode; the judgment module 403 is used to determine whether the second network segment information and the first network segment information belong to the same network segment, wherein the same network segment means that the network segment range corresponding to the second network segment information and the network segment range corresponding to the first network segment information at least partially overlap. The network segment range is determined by the IP address and subnet mask in the Internet Protocol version IPv4 network, and by the prefix and prefix length in the IPv6 network; a substitute network segment belonging to a different network segment from the second network segment information is determined, and the network segment of the first network mode is configured as the substitute network segment; the first network segment information configured in the first network mode remains unchanged.

[0107] Optionally, the alternative network segment is one of the pre-stored backup network segments, and the backup network segment does not overlap with the network segment corresponding to the first network segment information; the judgment module 403 is used to detect the Internet Protocol address occupancy status in each backup network segment; based on the detected occupancy status, an unoccupied backup network segment is selected from the backup network segments as the alternative network segment.

[0108] Optionally, the determination module 403 is used to configure the network segment of the first network mode as the alternative network segment, obtain the IP address allocated by the external network obtained by the second network mode; determine whether the network segment of the IP address and the alternative network segment belong to the same network segment; if so, reject the IP address allocation and control the communication device to re-initiate the IP address request to the external network; if not, establish a connection with the external network in the second network mode.

[0109] Optionally, the judgment module 403 is used to close the first network mode or output an IP conflict prompt through the user interface when it is still impossible to obtain an IP address that does not overlap with the network segment after multiple IP address requests.

[0110] Optionally, the device further includes an update module 404, which is used to preset routing priority rules in the routing table of the communication device, wherein the priority of the routing entry corresponding to the second network mode is higher than that of the first network mode; when forwarding data packets, it checks whether there is a routing entry that matches the second network mode; if so, it matches the routing entry corresponding to the second network mode; if not, it matches the routing entry corresponding to the first network mode.

[0111] Optionally, the update module 404 is used to update the routing entries in the routing table corresponding to the first network mode and the second network mode in real time when the first network segment information is reconfigured, the IP address of the second network mode is changed, or the network mode of the communication device is switched.

[0112] Optionally, the determination module 403 is used to allocate a subnet that is not occupied by the first network mode, the second network mode, or other network interfaces of the device from the dynamic address resource pool built into the communication device as an alternative network segment; and to reclaim the first network segment information configured in the first network mode into the dynamic address resource pool.

[0113] Optionally, the acquisition module 401 is used to scan the accessible external networks around the communication device and acquire candidate network segment information corresponding to each external network; based on each candidate network segment information and the first network segment information, determine a pre-selected network segment that does not overlap with each candidate network segment information; and configure the network segment of the first network mode as the pre-selected network segment.

[0114] This application also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 The network address configuration method provided in the illustrated embodiment.

[0115] Readable storage media may include, for example, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0116] This application also provides a computer program product, including a computer program that, when executed by a processor, implements... Figure 1Provides network address configuration methods.

[0117] Computer program products can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0118] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for apparatus or apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The apparatus and apparatus embodiments described above are merely illustrative. Units described as separate components may or may not be physically separate. Components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0120] This application also provides a vehicle, which includes a vehicle body and a vehicle-mounted unit. The vehicle-mounted unit is disposed in the vehicle body and includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, it implements the above-described network address configuration method.

[0121] This application also provides an electronic device, such as Figure 5As shown, the electronic device 11 includes a processor 22 (which may be configured to be at least one) and a memory 33 (e.g., a second memory). The memory 33 is used to store executable instructions (e.g., applications) of the processor 22. The applications stored in the memory 33 may include one or more modules, each corresponding to a set of instructions. The processor 22 is configured to execute instructions for performing the network address configuration method described in the above embodiments.

[0122] Electronic device 11 may also include a power supply component configured to perform power management of electronic device 11, a wired or wireless network interface configured to connect electronic device 11 to a network, and an input / output (I / O) interface. Electronic device 11 may operate on an operating system stored in memory 33, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.

[0123] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.

[0124] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0125] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0127] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0128] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0129] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program verification codes, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0130] It should be noted that in the description of this application, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0131] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications or equivalent substitutions made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A network address configuration method, characterized in that, Applied to a communication device that supports a first network mode and a second network mode, the network address configuration method includes: Obtain the first network segment information configured in the first network mode; When establishing a connection with an external network in the second network mode, obtain the second network segment information associated with the external network; Determine whether the second network segment information and the first network segment information belong to the same network segment. The same network segment means that the network segment range corresponding to the second network segment information and the network segment range corresponding to the first network segment information at least partially overlap. The network segment range is determined by the Internet Protocol IP address and subnet mask in the Internet Protocol version 4 network, and by the prefix and prefix length in the IPv6 network. If so, then determine the alternative network segment that belongs to a different network segment than the second network segment information, and configure the network segment of the first network mode as the alternative network segment; If not, the first network segment information of the first network mode configuration remains unchanged.

2. The network address configuration method as described in claim 1, characterized in that, The first network mode is a wireless access point mode, through which the communication device provides network services to external devices. The second network mode is a wireless client mode, through which the communication device accesses an external hotspot network.

3. The network address configuration method as described in claim 1, characterized in that, The alternative network segment is one of the pre-stored backup network segments. The backup network segment does not overlap with the network segment corresponding to the first network segment information. The step of determining the alternative network segment, which belongs to a different network segment than the second network segment information, includes: Detect the Internet Protocol address occupancy status within each of the aforementioned backup network segments; Based on the detected occupancy status, an unoccupied backup network segment is selected from the backup network segments as the replacement network segment.

4. The network address configuration method as described in claim 1, characterized in that, Also includes: After configuring the network segment of the first network mode as the alternative network segment, obtain the IP address allocated by the external network obtained by the second network mode; Determine whether the network segment of the IP address and the alternative network segment belong to the same network segment; If so, the IP address allocation is rejected, and the communication device is controlled to re-initiate an IP address request to the external network; If not, then establish a connection with the external network using the second network mode.

5. The network address configuration method as described in claim 4, characterized in that, Also includes: If an IP address that does not overlap with the network segment cannot be obtained after multiple requests for the IP address, the first network mode is turned off, or an IP conflict prompt is displayed through the user interface.

6. The network address configuration method as described in claim 1, characterized in that, Also includes: A routing priority rule is preset in the routing table of the communication device, wherein the priority of the routing entry corresponding to the second network mode is higher than that of the first network mode; When forwarding data packets, check if there is a routing entry that matches the second network pattern; If so, then match the routing entry corresponding to the second network mode; If not, then match the routing entry corresponding to the first network mode.

7. The network address configuration method as described in claim 6, characterized in that, Also includes: When the first network segment information is reconfigured, the IP address of the second network mode is changed, or the network mode of the communication device is switched, the routing entries in the routing table corresponding to the first network mode and the second network mode are updated in real time.

8. The network address configuration method as described in claim 1, characterized in that, The determination of the alternative network segment that belongs to a different network segment from the second network segment information includes: From the dynamic address resource pool built into the communication device, allocate a subnet that is not occupied by the first network mode, the second network mode, or other network interfaces of the device as the alternative network segment; The first network segment information configured in the first network mode is recycled to the dynamic address resource pool.

9. The network address configuration method as described in claim 1, characterized in that, Before establishing a connection with an external network in the second network mode, the following steps are also included: Scan the accessible external networks around the communication device and obtain candidate network segment information for each external network; Based on each candidate network segment information and the first network segment information, a pre-selected network segment that does not overlap with each candidate network segment information is determined; Configure the network segment of the first network mode as the pre-selected network segment.

10. A vehicle, characterized in that, include: Vehicle body; The vehicle-mounted system is installed inside the vehicle body and includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements the network address configuration method described in claims 1 to 9.