WO2022179410A1 - 一种IPv6地址生成方法及相关装置 - Google Patents

一种IPv6地址生成方法及相关装置 Download PDF

Info

Publication number
WO2022179410A1
WO2022179410A1 PCT/CN2022/076316 CN2022076316W WO2022179410A1 WO 2022179410 A1 WO2022179410 A1 WO 2022179410A1 CN 2022076316 W CN2022076316 W CN 2022076316W WO 2022179410 A1 WO2022179410 A1 WO 2022179410A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
terminal device
iapd
network device
prefix
Prior art date
Application number
PCT/CN2022/076316
Other languages
English (en)
French (fr)
Inventor
李剑
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022179410A1 publication Critical patent/WO2022179410A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming

Definitions

  • the present application relates to the field of electronic technologies, and in particular, to a method for generating an IPv6 address and a related device.
  • IPv6 address deployment includes stateless address allocation and stateful address allocation.
  • stateful address allocation is to assign Identity Association for Non-temporary Address (IANA) addresses to terminal devices/network devices through Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol for IPV6, DHCPV6), terminal devices/network devices The device uses this IANA address to surf the Internet.
  • IANA Identity Association for Non-temporary Address
  • IAPD Identity Association for Prefix Delegation
  • the terminal device/network device cannot obtain the IANA address and thus cannot obtain the IPv6 address, resulting in the terminal device/network device being unable to access the Internet.
  • the embodiments of the present application provide a method for generating an IPV6 address and a related apparatus, through which an ipv6 address of an electronic device can be provided, so as to realize data communication between the electronic device and a wide area network.
  • the present application provides a method for generating an IPV6 address.
  • the method is applied to a network device.
  • An uplink interface of the network device performs data communication with a DHCPv6 server, and a downlink interface of the network device performs data communication with a terminal device.
  • the method includes:
  • the network device sends a configuration request to the DHCPv6 server
  • the network device receives the IAPD address prefix sent by the DHCPv6 server to the network device based on the configuration request;
  • the network device Based on the received IAPD address prefix, the network device configures a first IPv6 address for the terminal device, configures a second IPv6 address for the downlink interface of the network device, and configures a third IPv6 address for the uplink interface of the network device; the third IPv6 address is the same as the IAPD address.
  • the address prefixes match; the first IPv6 address and the second IPv6 address are used to implement communication between the network device and the terminal device, and the third IPv6 address is used for the network device to access the wide area network.
  • the router when there is a network device (such as a router) between the terminal device and the DHCPv6 server, the router generates an address on the user side by using the acquired IAPD address prefix, and sends an address to the terminal based on the communication link between the terminal device and the router.
  • Devices and routers allocate ipv6 addresses to realize data communication between terminal devices and routers.
  • the router can also generate the ipv6 address of the uplink interface through the obtained IAPD address prefix, which solves the problem of the router accessing the WAN and realizes data communication between the terminal device and the WAN.
  • the network device before the network device sends a configuration request to the DHCPv6 server, it further includes: the network device sends an RS message to the DHCPv6 server; the network device receives the RA message sent by the DHCPv6 server to the network device based on the RS message, The RA message instructs the network device to send a configuration request to the DHCPv6 server to obtain address information.
  • the RA message includes at least an address configuration identifier M, and the value of the address configuration identifier M is 1, and the network device uses a stateful address configuration method to obtain address information. Stateful address configuration uses the DHCPv6 protocol.
  • the network device sends a configuration request to the DHCPv6 server, and the DHCPv6 server returns the corresponding configuration information according to the policy.
  • the method further includes: the network device configures a third IPv6 address for the uplink interface of the network device based on the received IAPD address prefix, and before the method further includes: after the network device receives the DHCPv6 server sending to the network device based on the configuration request The network device configures a third IPv6 address for the uplink interface of the network device based on the received IAPD address prefix, including: the network device selects the IAPD address prefix as the uplink interface of the network device based on the received IANA address and IAPD address prefix. Configure the third IPv6 address.
  • the router can generate the ipv6 address of the upstream interface (WAN port) according to the IAPD address prefix. It can be detected that the address prefix of the third IPv6 address matches the IAPD address prefix obtained by the router. For example, if the IAPD address prefix acquired by the router is M bits, the first M bits of the third IPv6 address are the same as the acquired IAPD address prefix.
  • the length of the IAPD address prefix is M bits
  • the network device configures a third IPv6 address for the uplink interface of the network device based on the received IAPD address prefix, including: when M is less than N, the network device assigns M
  • the 1-bit IAPD address prefix is extended to an N-bit IAPD address prefix, where N is a preset value, and M and N are both positive integers; the network device adds the N-bit IAPD address prefix to the interface ID of the upstream interface of the network device to form the third IPv6 address; the network device uses the third IPv6 address as the network address of the uplink interface of the network device; or, when M is equal to N, the network device adds the M-bit IAPD address prefix to the interface ID of the uplink interface of the network device,
  • the third IPv6 address is formed, where N is a preset value, and both M and N are positive integers; the network device uses the third IPv6 address as the network address of the uplink
  • the network device expands the M-bit IAPD address prefix to the N-bit IAPD address prefix, including: the network device extends the M-bit IAPD address prefix to N bits by adding 0 or 1 at the tail. IAPD address prefix. Optionally, it can also be extended to an N-bit IAPD address prefix by adding any combination of 0 and 1 at the end.
  • the application provides a method for generating an IPV6 address, the method comprising:
  • the terminal device sends a configuration request to the DHCPv6 server
  • the terminal device receives the IAPD address prefix sent by the DHCPv6 server to the terminal device based on the configuration request;
  • the terminal device configures an IPv6 address for the terminal device based on the received IAPD address prefix, the IPv6 address matches the IAPD address prefix, and the IPv6 address is used for the terminal device to access the WAN.
  • the terminal device when there is no network device (such as a router) between the terminal device and the DHCPv6 server, the terminal device can generate an ipv6 address through the IAPD address prefix and use it as its own ipv6 address, and realize the terminal device access based on the ipv6 address. Wan. Even if the terminal device does not obtain the IANA address sent by the DHCPv6 server, the terminal device can still access the WAN.
  • the terminal device can generate an ipv6 address through the IAPD address prefix and use it as its own ipv6 address, and realize the terminal device access based on the ipv6 address. Wan. Even if the terminal device does not obtain the IANA address sent by the DHCPv6 server, the terminal device can still access the WAN.
  • the terminal device before the terminal device sends a configuration request to the DHCPv6 server, it further includes: the terminal device sends an RS message to the DHCPv6 server; the terminal device receives the RA message sent by the DHCPv6 server to the terminal device based on the RS message, The RA message instructs the terminal device to send a configuration request to the DHCPv6 server to obtain address information.
  • the terminal device if the RA message includes at least an address configuration identifier M, and the value of the address configuration identifier M is 1, the terminal device obtains the address information by using a stateful address configuration method. Stateful address configuration uses the DHCPv6 protocol.
  • the terminal device sends a configuration request to the DHCPv6 server, and the DHCPv6 server returns the corresponding configuration information according to the policy.
  • the method further includes: the terminal device configures an IPv6 address for the terminal device based on the received IAPD address prefix, before further comprising: the terminal device receiving the IANA address sent by the DHCPv6 server to the terminal device based on the configuration request;
  • the terminal device configures an IPv6 address for the terminal device based on the received IAPD address prefix, including: the terminal device selects an IAPD address prefix to configure an IPv6 address for the terminal device based on the received IANA address and the IAPD address prefix. It is described here that even when the terminal device receives the IANA address, the terminal device can generate the ipv6 address of the upstream interface (WAN port) according to the IAPD address prefix.
  • the address prefix of the third IPv6 address matches the IAPD address prefix obtained by the terminal device. For example, if the IAPD address prefix acquired by the terminal device is M bits, the first M bits of the third IPv6 address are the same as the acquired IAPD address prefix.
  • the length of the IAPD address prefix is M bits
  • the terminal device configures an IPv6 address for the terminal device based on the received IAPD address prefix, including: when M is less than N, the terminal device uses the M-bit IAPD address The prefix is expanded to an N-bit IAPD address prefix, where N is a preset value, and M and N are both positive integers; the terminal device forms an IPv6 address by adding the N-bit IAPD address prefix to the interface ID of the terminal device; the terminal device uses the IPv6 The address is used as the network address of the terminal device; or, when M is equal to N, the terminal device forms an IPv6 address by adding the M-bit IAPD address prefix to the interface ID of the terminal device, where N is a preset value, and both M and N are positive Integer; the end device uses the IPv6 address as the end device's network address.
  • a method for generating IPv6 addresses based on IAPD address prefixes is provided
  • the terminal device extends the M-bit IAPD address prefix to an N-bit IAPD address prefix, including: the terminal device extends the M-bit IAPD address prefix to N bits by adding 0 or 1 at the tail IAPD address prefix.
  • the terminal device can also be extended to an N-bit IAPD address prefix by adding any combination of 0 and 1 at the end.
  • the present application provides an electronic device, comprising: one or more processors and one or more memories; the one or more memories are coupled with the one or more processors; the one or more memories are used for
  • the computer program code is stored in the computer program code, and the computer program code includes computer instructions; when the computer instructions are executed on the processor, the electronic device executes the IPV6 address generation method in any possible implementation manner of any of the above aspects.
  • an embodiment of the present application provides a computer storage medium, including computer instructions, which, when the computer instructions are run on an electronic device, cause the communication apparatus to perform the generation of an IPV6 address in any possible implementation manner of any of the above aspects method.
  • embodiments of the present application provide a computer program product, which, when the computer program product runs on a computer, enables the computer to execute the method for generating an IPV6 address in any possible implementation manner of any of the foregoing aspects.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • FIG. 2A is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 2B is a schematic structural diagram of a network device according to an embodiment of the present application.
  • 3A and 3B are schematic flowcharts of a method for generating an ipv6 address according to an embodiment of the present application
  • FIG. 4 is a schematic flowchart of another method for generating an ipv6 address provided by an embodiment of the present application.
  • FIG. 5 is a data schematic diagram of a data packet provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of still another method for generating an ipv6 address according to an embodiment of the present application.
  • a component may be, but is not limited to, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer.
  • an application running on a computing device and the computing device may be components.
  • One or more components may reside within a process and/or thread of execution, and a component may be localized on one computer and/or distributed between 2 or more computers.
  • these components can execute from various computer readable media having various data structures stored thereon.
  • a component may, for example, be based on a signal having one or more packets of data (eg, data from two components interacting with another component between a local system, a distributed system, and/or a network, such as a wide area network interacting with other systems via signals) Communicate through local and/or remote processes.
  • packets of data eg, data from two components interacting with another component between a local system, a distributed system, and/or a network, such as a wide area network interacting with other systems via signals
  • GSM global system for mobile communication
  • CDMA code division multiple access
  • WCDMA wideband code division multiple access
  • GPRS general packet radio service
  • long term evolution long term evolution
  • LTE long term evolution
  • LTE frequency division duplex frequency division duplex
  • TDD time division duplex
  • UMTS universal mobile telecommunications system
  • EDGE enhanced data rate for GSM evolution
  • WiMAX worldwide interconnection microwave access
  • the technical solutions of the embodiments of the present application may also be applied to other communication systems, such as a public land mobile network (PLMN) system, a fifth generation (5th generation, 5G) system or a communication system after 5G or a new wireless ( new radio, NR), etc.
  • the 5G mobile communication system described in this application includes a non-standalone (NSA) 5G mobile communication system and/or an independent (standalone, SA) 5G mobile communication system.
  • the technical solutions provided in this application can also be applied to future communication systems, such as the sixth generation mobile communication system.
  • the communication system may also be a PLMN network, a device-to-device (D2D) network, a machine-to-machine (M2M) network, an IoT network, or other networks.
  • D2D device-to-device
  • M2M machine-to-machine
  • FIG. 1 is a system architecture diagram of a communication system provided by an embodiment of the present application.
  • the communication system includes a DHCPv6 (Dynamic Host Configuration Protocol for IPv6) server 101, a network device 102, and one or more terminal devices (eg, terminal device 1, terminal device 2, and terminal device 3).
  • the DHCPv6 server 101 can directly establish a communication connection with the terminal equipment to provide network services for the terminal equipment; it can also establish a communication connection with the terminal equipment through the network equipment 102 to provide network services for the terminal equipment.
  • DHCPv6 Dynamic Host Configuration Protocol for IPv6
  • the DHCPv6 server 101 includes devices for accessing the WAN, such as base stations, broadband access servers (BRAS), optical network units, broadband network gateways (BNG), aggregation switches, and the like.
  • the base station may include various forms of base stations, such as: a macro base station, a micro base station (also referred to as a small station), a relay station, an access point, and the like.
  • the DHCPv6 server 101 may be mounted on the above-mentioned device accessing the wide area network.
  • the DHCPv6 server 101 can directly establish a communication connection with the terminal device to provide network services for the terminal device, such as the terminal device 3 in FIG. 1; it can also establish a communication connection with the terminal device through the network device 102 to provide the terminal device. Terminal 1 and Terminal 2 in 1.
  • the network device 102 includes routers, gateways and other devices, provides functions of connecting to the network and transmitting information, and can be connected with multiple terminal devices to share the network.
  • the network device 102 includes an uplink interface (WAN port) and a downlink interface (LAN port).
  • the uplink interface of the network device 102 can be connected to the DHCPv6 server 101, and the network device 102 can access the WAN through the IANA address provided by the DHCPv6 server 101; the network device
  • the downlink interface of 102 can be connected to one or more terminal devices for data communication between the network device 102 and the terminal devices.
  • both the uplink interface and the downlink interface of the network device 102 need to be configured with ipv6 addresses, so that the network device 102 and other devices can communicate with each other.
  • the network device 102 is connected to the terminal device 1 through the downlink interface 1, and the network device 102 configures an ipv6 address for the downlink interface 1 and the terminal device 1 respectively to establish a communication link between the network device 102 and the terminal device 1,
  • the terminal device 1 can access the wide area network through the network device 102 .
  • the network device 102 is connected to the terminal device 2 through the downlink interface 2, and the network device 102 configures an ipv6 address for the downlink interface 2 and the terminal device 2 respectively, so as to establish a communication link between the network device 102 and the terminal device 2, so that the network The device 102 and the terminal device 2 can implement data communication, and then the terminal device 2 can access the wide area network through the network device 102 .
  • the network device 102 may establish a wireless connection with one or more terminal devices, such as a Wi-Fi connection.
  • the network device 102 establishes a wireless communication link with the terminal device, and configures an ipv6 address for the network device 102 and the terminal device respectively, so that the network device 102 and the terminal device can realize data communication, then the terminal device can access the WAN through the network device 102 .
  • Terminal equipment may also be referred to as user equipment (UE), access terminal, subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device.
  • the terminal device can be a station (STAION, ST) in a WLAN, a cellular phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital processor ( personal digital assistant (PDA) device, handheld device with wireless communication capabilities, computing device or other processing device connected to a wireless modem, in-vehicle device, connected vehicle terminal, computer, laptop computer, handheld communication device, handheld computing device equipment, satellite wireless equipment, wireless modem cards, television set top boxes (STBs), customer premise equipment (CPEs) and/or other equipment for communicating over wireless systems and next generation communication systems, For example, a terminal device in a 5G network or a terminal device in a future evolved public land mobile network (PLMN) network, etc.
  • FIG. 2A exemplarily shows a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may be a terminal device (terminal device 1 , terminal device 2 , and terminal device 3 ) in the foregoing system architecture.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the charging management module 140 is used to receive charging input from the charger.
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including UWB, wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (bluetooth, BT), global Navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • Bluetooth blue, BT
  • global Navigation satellite system global navigation satellite system
  • GNSS global navigation satellite system
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication technology
  • NFC near field communication technology
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing the instructions stored in the internal memory 121 .
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like.
  • FIG. 2B exemplarily shows a schematic structural diagram of the network device 102 in the above-mentioned system architecture provided by the embodiment of the present application.
  • the network device 102 may include a processor 1021 , a memory 1022 , a wireless communication processing module 1023 , a wired communication processing module 1024 and a power switch 1025 .
  • the memory 1022 may exist independently, and may be connected to the processor 1021 through a bus.
  • the memory 1022 may also be integrated with the processor 1021. Among them, the bus is used to realize the connection between these components. in:
  • the processor 1021 may be used to read and execute computer readable instructions.
  • the processor 1021 may mainly include a controller, an arithmetic unit, and a register.
  • the controller is mainly responsible for instruction decoding, and sends out control signals for the operations corresponding to the instructions.
  • the arithmetic unit is mainly responsible for performing fixed-point or floating-point arithmetic operations, shift operations, and logical operations, and can also perform address operations and conversions.
  • Registers are mainly responsible for saving register operands and intermediate operation results temporarily stored during instruction execution.
  • the hardware architecture of the processor 1021 may be an application specific integrated circuit (Application Specific Integrated Circuits, ASIC) architecture, a MIPS architecture, an ARM architecture, an NP architecture, or the like.
  • the processor 1021 may be configured to parse the signals received by the wireless communication processing module 1023 and/or the wired communication processing module 1024, such as a broadcast probe request of the electronic device 100, instructions sent by the electronic device 100, and the like.
  • the processor 1021 may be configured to perform corresponding processing operations according to the parsing result, such as generating a probe response.
  • the processor 1021 may also be configured to generate a signal sent by the wireless communication processing module 1023 and/or the wired communication processing module 1024, such as a broadcast signal, or sent to the electronic device 100 for feedback of the connection status (such as connection success, connection failure, etc.).
  • a signal sent by the wireless communication processing module 1023 and/or the wired communication processing module 1024 such as a broadcast signal, or sent to the electronic device 100 for feedback of the connection status (such as connection success, connection failure, etc.).
  • Memory 1022 is coupled to processor 1021 for storing various software programs and/or sets of instructions.
  • memory 1022 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
  • the wireless communication processing module 1023 may include one or more of a Bluetooth (BT) communication processing module and a WLAN communication processing module.
  • BT Bluetooth
  • WLAN wireless local area network
  • one or more of the Bluetooth (BT) communication processing module and the WLAN communication processing module may listen to signals transmitted by other devices (eg, electronic device 100 ), such as probe requests, scan signals, etc., and A response signal, such as a probe response, a scan response, etc., can be sent, so that other devices (such as the electronic device 100) can discover the network device 102 and establish a wireless communication connection with other devices (such as the electronic device 100) through a Bluetooth or a WLAN.
  • One or more wireless communication technologies to communicate with other devices, such as electronic device 100 may listen to signals transmitted by other devices (eg, electronic device 100 ), such as probe requests, scan signals, etc., and A response signal, such as a probe response, a scan response, etc., can be sent, so that other devices (such as the electronic device 100) can discover the network device 102 and establish a wireless communication connection with other devices (such as the electronic device 100) through a Bluetooth or a WLAN.
  • One or more wireless communication technologies to communicate with other devices, such as electronic device 100 may be
  • one or more of the Bluetooth (BT) communication processing module and the WLAN communication processing module may also transmit signals, such as broadcast signals, so that other devices (eg, the electronic device 100) can discover the network device 102, And establish a wireless communication connection with other devices (eg, electronic device 100 ), and communicate with other devices (eg, electronic device 100 ) through one or more wireless communication technologies in Bluetooth or WLAN.
  • signals such as broadcast signals
  • the power switch 1025 may be used to control the supply of power to the network device 102 from a power source.
  • the wired communication processing module 1024 can be used to connect to the wide area network through the uplink interface, and communicate with the devices in the wide area network; it can also be used to connect to the local area network through the downlink interface, and communicate with the devices in the local area network, wherein,
  • the uplink interface can also be called the WAN interface.
  • the WAN interface is used for the connection between the network device 102 and the WAN, including, for example, an RJ-45 port, an AUI port, a high-speed synchronous serial port (SERIAL), an asynchronous serial port (ASYNC), an ISDN BRI port, and the like.
  • the RJ-45 port is a twisted pair Ethernet port, and the network device 102 can realize the connection with the Fast Ethernet through the twisted pair.
  • RJ-45 ports can also be used to establish connections between a wide area network and a local area network VLAN (Virtual Local Area Network), as well as to remote networks or the Internet.
  • VLAN Virtual Local Area Network
  • High-speed synchronous serial port is mainly used to connect network connection modes such as DDN, Frame Relay, X.25, PSTN (analog telephone line) which are widely used at present.
  • Asynchronous serial port is mainly used in the connection of Modem or Modem pool, which can realize remote computer dialing into the network through the public telephone network.
  • the ISDN BRI port is used to connect the ISDN line to the Internet or other remote networks through a router, and can achieve a communication rate of 128Kbps.
  • the downlink interface may also be called a LAN interface.
  • the network device 102 may include one or more LAN interfaces for connecting the network device 102 to a local area network, including, for example, AUI ports, RJ-45 ports, SC ports, and the like. Among them, each LAN interface can be connected with a terminal device.
  • the AUI port is an interface used to connect with the thick coaxial cable, and the network device 102 can realize the connection with the 10Base-5 network through the thick coaxial cable transceiver.
  • the RJ-45 port is a twisted pair Ethernet port, and the network device 102 can realize the connection with the Fast Ethernet through the twisted pair.
  • the SC port is also called the fiber port, which is used for connection with the fiber. Fiber ports are usually not directly connected to workstations with fiber, but connected to switches with fiber ports such as Fast Ethernet or Gigabit Ethernet through fiber.
  • the network device 102 further includes one or more configuration interfaces, and the configuration interfaces include, for example, a Console port, an AUX port, and the like.
  • the Console port is directly connected to the serial port of the computer using a dedicated connection for configuration, and is configured locally using a terminal emulation program.
  • the AUX port is an asynchronous port, which is mainly used for remote configuration, and can also be used for dial-up connection, and can also be connected to MODEM through a transceiver.
  • An ipv6 address has an address length of 128 bits and consists of eight 16-bit fields, including a 64-bit prefix and a 64-bit interface ID.
  • the 64-bit prefix is usually a prefix assigned by the server, or a prefix generated based on a field assigned by the server; the interface ID can be automatically configured from the MAC address of the interface, or manually configured in EUI-64 format.
  • Case 1 A network device 102 (a router is used as an example below) exists between the terminal device and the DHCPv6 server 101 , and the DHCPv6 server 101 provides the terminal device with an ipv6 address through the network device 102 .
  • the DHCPv6 server 101 provides ipv6 addresses for the terminal device 1 and the terminal device 2, and the specific method flow is shown in FIG. 3A ,
  • Step S101 the router sends a router solicitation (Router Solicitation, RS) message to the DHCPv6 server.
  • RS Route Solicitation
  • the router sends an RS message.
  • the destination address of the IP packet of the RS message can be filled with the broadcast address, and the source address can be filled with the MAC address of the requester (the router).
  • the RS message is used to request the establishment of a communication connection with a DHCPv6 server.
  • Step S102 After receiving the RS message, the DHCPv6 server sends a route response (Router Advertisement, RA) message to the router based on the RS message.
  • RA Route Response
  • the DHCPv6 server After receiving the RS message, the DHCPv6 server sends an RA message to the router in response to the RS message.
  • the RA message includes one or more of the following: address configuration identifier M and other information configuration identifier O; one or more link prefixes and the life cycle of link prefixes, and so on.
  • the address configuration identifier M is used to indicate whether the router uses the stateless address configuration method to obtain the address information or the stateful address configuration method to obtain the address information. When the value of M is 0, the stateless address configuration method is used. When the value of M is 1, the stateful address configuration method is used, which means that the router obtains address information through the dynamic host configuration protocol DHCPV6.
  • the other information configuration flag O is used to indicate whether the router uses the stateless address configuration method to obtain other configuration information or the stateful address configuration method to obtain other configuration information.
  • O the value of O is 1, the router uses the stateful address configuration method to obtain other configuration information through DHCPV6.
  • Configuration information other configuration information can be information related to the domain name system, or information of other services in the network.
  • the router After the router receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration M flag is 0, step S103 , the router obtains address information by using a stateless address configuration method.
  • the RA message carries the correct link prefix.
  • the router uses the link prefix and interface ID to generate a global unicast address to complete the stateless address configuration.
  • the terminal device obtains other configuration information in a stateless address configuration manner.
  • the router After the terminal device receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration identifier M is 1, step S104 , the router obtains address information by using a stateful address configuration method.
  • the terminal device obtains other configuration information by using the stateful address configuration method.
  • the stateful address configuration uses the DHCPv6 protocol.
  • the DHCPv6 client ie, the router
  • the DHCPv6 server returns the corresponding configuration information according to the policy.
  • Step S105 the router sends a configuration request to the DHCPv6 server, requesting to obtain the IANA address and the IAPD address prefix.
  • Step S106 the DHCPv6 server sends the IANA address and the IAPD address prefix to the router based on the received configuration request.
  • the IANA address is the network-side address (ipv6 address) provided by the DHCPv6 server for the network device (router).
  • the network-side address is provided for the router's uplink interface (WAN port) for the router to access the WAN.
  • the IAPD address prefix is used to provide the network device (router) with a user-side address to the terminal device, and the user-side address can be generated through the IAPD address prefix.
  • the user-side address is the ipv6 address provided by the router to the terminal device that has established a connection with the router, and The ipv6 address provided to the downlink interface (LAN port) of the router.
  • the user side address is used for data communication between the terminal device and the router.
  • the IAPD address prefix is the subnet prefix sent by the DHCPv6 server to the router. Its function is to assign a network number to the router, and then the router can divide this network number into several network segments and assign them to its interface (downlink interface LAN). ports), and terminal equipment or other nodes connected in these ports to establish communication links.
  • the IAPD address prefix specifies the network segment where the router can assign addresses to its own downlink interface and other terminal devices (or nodes), and the address of the router's uplink interface (WAN port) needs to be provided by the IANA address.
  • Step S107 the router uses the received IANA address as the ipv6 address of the uplink interface, generates a user side ipv6 address based on the received IAPD address prefix, and assigns the user side ipv6 address to the terminal device.
  • the router uses the received IANA address as the ipv6 address of the uplink interface (WAN port); and generates the ipv6 address of the user side based on the received IAPD address prefix, and establishes a communication link between the router and the terminal device. road.
  • the router is connected to the terminal device 1 through the downlink interface 1, and the router configures an ipv6 address for the downlink interface 1 and the terminal device 1 based on the IAPD address prefix, respectively, to establish the router and the terminal device. 1, so that the router and the terminal device 1 can realize data communication, then the terminal device 1 can access the WAN through the router.
  • terminal device 2 the terminal device 2.
  • a router and a terminal device establish a wireless connection (such as a Wi-Fi connection), the router establishes a communication link between the router and the terminal device, and an ipv6 address is configured for the router and the terminal device respectively based on the IAPD address prefix, so that the router and the terminal device can To realize data communication, the terminal device can access the WAN through the router.
  • a wireless connection such as a Wi-Fi connection
  • the router establishes a communication link between the router and the terminal device
  • an ipv6 address is configured for the router and the terminal device respectively based on the IAPD address prefix, so that the router and the terminal device can To realize data communication, the terminal device can access the WAN through the router.
  • the router allocates an ipv6 address for the communication link between the terminal device and the router based on the obtained IAPD address prefix sent by the DHCPv6 server, and The obtained IANA address sent by the DHCPv6 server is used as the ipv6 address of the uplink interface (WAN port) to realize data communication between the terminal device and the Internet.
  • a network device such as a router
  • the router uses the received IANA address as the ipv6 address of the uplink interface (WAN port), and broadcasts the received IAPD address prefix in the local area network, and the terminal device receives the IAPD address prefix, based on the IAPD address prefix Generate an ipv6 address and use it as its own ipv6 address.
  • the ipv6 address may be generated by the terminal device based on the IAPD address prefix and the interface ID of the terminal device.
  • the DHCPv6 server In the second case, there is no network device (eg, router) between the terminal device and the DHCPv6 server, and the DHCPv6 server directly provides the terminal device with an ipv6 address.
  • the DHCPv6 server In the system architecture shown in FIG. 1 , the DHCPv6 server provides the terminal device 3 with an ipv6 address, and the specific method flow is shown in FIG. 3B .
  • Step S201 the terminal device sends an RS message to the DHCPv6 server.
  • Step S202 after receiving the RS message, the DHCPv6 server sends an RA message to the terminal device based on the RS message.
  • the terminal device After the terminal device receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration identifier M is 0, step S203 , the terminal device obtains address information by using a stateless address configuration method.
  • the terminal device After the terminal device receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration identifier M is 1, step S204, the terminal device obtains address information by using a stateful address configuration method.
  • the stateful address configuration uses the DHCPv6 protocol.
  • the DHCPv6 client ie, the terminal device
  • the DHCPv6 server returns the corresponding configuration information according to the policy.
  • the actions performed by the terminal device in steps S201 to S204 may refer to the actions performed by the router in the foregoing steps S101 to S104, which will not be repeated here.
  • Step S205 the terminal device sends a configuration request to the DHCPv6 server, requesting to obtain an IANA address.
  • Step S206 the DHCPv6 server sends the IANA address to the terminal device based on the received configuration request.
  • Step S207 the terminal device receives the IANA address, uses the IANA address as the ipv6 address of the terminal device itself, and the terminal device accesses the wide area network based on the ipv6 address.
  • step S205 may be replaced by the terminal device sending a configuration request to the DHCPv6 server, requesting the IANA address and the IAPD address prefix, then the terminal device uses the received IANA address as its own ipv6 address, and implements the terminal device based on the ipv6 address. Access the WAN. If the terminal device is used as a relay network device, the ipv6 address on the user side can also be generated by using the received IAPD address prefix to provide the next-level device or node with the ipv6 address.
  • the terminal device will receive the IANA address sent by the DHCPv6 server as its own ipv6 address, so that the terminal device can access the WAN.
  • the DHCPv6 server may not be able to use the DHCPv6 server for address configuration management reasons, or even because of configuration errors. If the IANA address is sent to the router/terminal device, the router/terminal device can only obtain the IAPD address prefix, but cannot obtain the IANA address, so that the router/terminal device cannot access the Internet. In case 1, when a router requests an IANA address and an IAPD address prefix from a DHCPv6 server, the DHCPv6 server does not assign an IANA address to the router, but only sends an IAPD address prefix to the router.
  • the router's uplink interface does not have an ipv6 address. Even though the router can assign a user-side address to the terminal device through the IAPD address prefix, because the router itself cannot access the Internet, the terminal device on the same local area network as the router Also can't get online. Similarly in case 2, when a terminal device requests an IANA address and an IAPD address prefix from the DHCPv6 server, the DHCPv6 server does not assign an IANA address to the terminal device, but only sends an IAPD address prefix to the terminal device. Because the terminal device does not receive the IANA address, the terminal device itself does not have an ipv6 address and cannot access the Internet.
  • the embodiment of the present application provides a method for generating an ipv6 address, which can generate an ipv6 address when the router/terminal device only receives the IAPD address prefix and does not receive the IANA address, thereby realizing Internet access.
  • a network device for example, a router
  • the DHCPv6 server provides the terminal device with an ipv6 address through the network device.
  • the method includes:
  • Step S301 the router sends an RS message to the DHCPv6 server.
  • Step S302 After receiving the RS message, the DHCPv6 server sends an RA message to the router based on the RS message.
  • the terminal device After the router receives the RA message, if the RA message indicates to use address automatic configuration and the value of the address configuration M flag is 0, step S303 , the terminal device obtains address information by using a stateless address configuration method.
  • the router After the terminal device receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration M flag is 1, step S304 , the router obtains address information by using a stateful address configuration method.
  • the actions performed by the router in steps S301 to S304 may refer to the actions performed by the router in the foregoing steps S101 to S104, which will not be repeated here.
  • Step S305 the router sends a configuration request to the DHCPv6 server, requesting to obtain the IANA address and the IAPD address prefix.
  • step S305 may be replaced by the router sending a configuration request to the DHCPv6 server, requesting to obtain an IANA address or an IAPD address prefix.
  • Step S306 the DHCPv6 server sends the IAPD address prefix to the router based on the received configuration request.
  • Step S307 the router generates its own ipv6 address based on the received IAPD address prefix, generates a user side ipv6 address based on the received IAPD address prefix, and allocates the user side ipv6 address to the terminal device.
  • the router receives the IAPD address prefix sent by the DHCPv6 server, but does not receive the IANA address. As shown in Figure 5, the data packet received by the router is captured at this time, and it can be seen that the data packet received by the router contains the IAPD address prefix. , without an IANA address.
  • the router When the router detects that it has not received the IANA address sent by the DHCPv6 server, the router generates the ipv6 address of the upstream interface (WAN port) of the router according to the received IAPD address prefix.
  • the specific generation method includes: if the length of the IAPD address prefix is less than 64 bits, then it is extended to 64 bits, and the extension method can be, for example, padding 0 at the end; if the length of the IAPD address prefix is 64 bits, no extension is required.
  • the IPv6 address of the WAN port of the router's uplink interface is generated, and the generation method includes, for example, the newly extended 64-bit IAPD address prefix + 64-bit interface ID.
  • the interface ID is the interface ID of the router's uplink interface, where the interface ID can be generated according to the EUI-64 specification according to the interface MAC address. It can be detected that the IPv6 address prefix used by the router's uplink interface (WAN port) matches the IAPD address prefix obtained by the router.
  • the IAPD address prefix acquired by the router is M bits, and the first M bits of the IPv6 address of the router's uplink interface (WAN port) are the same as the acquired IAPD address prefix.
  • the ipv6 address of the uplink interface (WAN port) of the router may also be referred to as the third ipv6 address.
  • the generation method may also be that the length of the IAPD address prefix acquired by the router is M bits, and the preset length is configured to be N bits, wherein M and N are integers, and M is less than N.
  • the value of the Nth bit of the N-bit mask of the N-bit mask of the IAPD address prefix after the extended N-bit mask is set to 1 as the minimum address prefix in the address pool.
  • the values of the last N-M bits in the N-bit mask are all set to 1 as the maximum address prefix in the address pool to generate the IAPD address pool.
  • the 60-bit IAPD address prefix is filled with 0 at the end, and expanded to 64 bits, that is, the 61st-64th bit is 0. Then set the value of the 64th bit in the 64-bit IAPD address prefix to 1 as the minimum address prefix in the address pool; set the 61st-64th bit value in the 64-bit IAPD address prefix 1, as the largest address prefix in the address pool.
  • the newly extended 64-bit IAPD address prefix may be one address prefix from the smallest address prefix to the largest address prefix in the address pool. Then the newly extended 64-bit IAPD address prefix + 64-bit interface ID.
  • the interface ID is the interface ID of the router's uplink interface, wherein the interface ID can be generated according to the EUI-64 specification according to the MAC address of the interface. It can be detected that the address prefix of the IPv6 address used by the WAN port of the router's uplink interface matches the IAPD address prefix obtained by the router.
  • the router may also generate the IPv6 address of the router's uplink interface (WAN port) by using the IAPD address prefix in other ways, which is not limited in this embodiment of the present application.
  • the router generates the ipv6 address on the user side based on the IAPD address prefix, assigns the ipv6 address of the downlink interface (LAN port) of the router, and assigns the ipv6 address to the terminal device connected to the router. Then the terminal device can access the WAN through the router based on its own ipv6 address.
  • the ipv6 address of the terminal device and the ipv6 address of the LAN port are in the same network segment.
  • the ipv6 address allocated by the router to the terminal device may also be referred to as the first ipv6 address
  • the ipv6 address of the LAN port of the router may also be referred to as the second ipv6 address.
  • the router when there is a network device (such as a router) between the terminal device and the DHCPv6 server, the router generates an address on the user side based on the obtained IAPD address prefix, and sends an address to the terminal device based on the communication link between the terminal device and the router. Assign ipv6 addresses to routers to realize data communication between terminal devices and routers. In the absence of an IANA address, the router generates the ipv6 address of the uplink interface through the IAPD address prefix, which solves the problem of the router accessing the WAN and realizes data communication between the terminal device and the WAN.
  • a network device such as a router
  • the DHCPv6 server sends the IANA address and the IAPD address prefix to the router, and the router detects that the IAPD address prefix is received. Even if the router receives the IANA address, the router can also generate an uplink interface according to the IAPD address prefix.
  • IAPD address prefix (WAN port) ipv6 address, 64-bit PD prefix to be extended + 64-bit interface ID, the interface ID is the interface ID of the router's uplink interface, and the interface ID can be generated according to the EUI-64 specification based on the interface MAC address.
  • the terminal device based on the system architecture of Case 1, if the terminal device does not receive the ipv6 address assigned by the router, it can obtain the IAPD address prefix from the router, and then the terminal device generates its own ipv6 address based on the IAPD address prefix, which is about to be extended.
  • 64-bit PD prefix + 64-bit interface ID the interface ID is the interface ID of the terminal device connecting to the local area network, wherein the interface ID can be generated according to the EUI-64 specification according to the interface MAC address.
  • the router receives the IAPD address prefix, broadcasts the IAPD address prefix in the local area network, and the terminal device receives the IAPD address prefix and generates its own ipv6 address.
  • the ipv6 address may be generated based on the IAPD address prefix and the interface ID of the terminal device.
  • the terminal device For the manner in which the terminal device generates the ipv6 address based on the IAPD address prefix, reference may be made to the foregoing manner for the router to generate the ipv6 address based on the IAPD address prefix, which will not be repeated here.
  • the router when a network device (such as a router) exists between the terminal device and the DHCPv6 server, the router allocates an ipv6 address to the terminal device by obtaining the IAPD address prefix, and obtains the ipv6 address of the uplink interface through the IAPD address prefix , even if the router does not obtain the IANA address sent by the DHCPv6 server, it can also implement data communication between the terminal device and the WAN.
  • a network device such as a router
  • the method includes:
  • Step S401 the terminal device sends an RS message to the DHCPv6 server.
  • Step S402 After receiving the RS message, the DHCPv6 server sends an RA message to the terminal device based on the RS message.
  • the terminal device After the terminal device receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration M flag is 0, step S403, the terminal device obtains address information by using a stateless address configuration method.
  • the terminal device After the terminal device receives the RA message, if the RA message indicates to use automatic address configuration, and the value of the address configuration M flag is 1, step S404, the terminal device obtains address information by using a stateful address configuration method.
  • the actions performed by the terminal device in steps S401 to S404 may refer to the actions performed by the router in the foregoing steps S101 to S104, which will not be repeated here.
  • Step S405 the terminal device sends a configuration request to the DHCPv6 server, requesting an IANA address and an IAPD address prefix.
  • step S205 may be replaced by the terminal device sending a configuration request to the DHCPv6 server, requesting an IANA address or an IAPD address prefix.
  • Step S406 the DHCPv6 server sends the IAPD address prefix to the terminal device based on the received configuration request.
  • Step S407 the terminal device generates an ipv6 address based on the IAPD address prefix, and uses the ipv6 address as its own ipv6 address.
  • the terminal device receives the IAPD address prefix sent by the DHCPv6 server, but does not receive the IANA address. At this time, the data packet received by the terminal device is captured. It can be seen that the data packet received by the terminal device contains the IAPD address prefix, but no IANA address. address.
  • the terminal device generates the ipv6 address based on the IAPD address prefix. Specifically, if the length of the IAPD address prefix is less than 64 bits, it is extended to 64 bits, for example, by filling 0 at the end; if the length of the IAPD address prefix is 64 bits, no extension is required. Then, an IPv6 address is generated based on the 64-bit IAPD address prefix, and the generation method includes, for example, the newly extended 64-bit PD prefix+64-bit interface ID.
  • the interface ID is the interface ID of the terminal device connecting to the DHCPv6 server, wherein the interface ID can be generated according to the EUI-64 specification according to the MAC address of the interface.
  • the address prefix of the IPv6 address of the terminal device matches the IAPD address prefix obtained by the terminal device.
  • the IAPD address prefix acquired by the terminal device is M bits, and the first M bits of the IPv6 address of the terminal device are the same as the acquired IAPD address prefix.
  • the ipv6 address generated by the terminal device according to the IAPD address prefix may also be referred to as the fourth ipv6 address.
  • the generation method may also be, when the length of the IAPD address prefix acquired by the terminal device is M bits, and the preset length is configured as N bits, where M and N are integers, and M is less than N. Extend the obtained IAPD address prefix to an N-bit masked IAPD address prefix by filling 0, as the expanded IAPD address prefix. Then, the value of the Nth bit of the N-bit mask of the N-bit mask of the IAPD address prefix after the extended N-bit mask is set to 1 as the minimum address prefix in the address pool. The values of the last N-M bits in the N-bit mask are all set to 1 as the largest address prefix in the address pool to generate the IAPD address pool.
  • the 60-bit IAPD address prefix is filled with 0 at the end, and expanded to 64 bits, that is, the 61st-64th bit is 0. Then set the value of the 64th bit in the 64-bit IAPD address prefix to 1 as the minimum address prefix in the address pool; set the 61st-64th bit value in the 64-bit IAPD address prefix is 1, which is the largest address prefix in the address pool.
  • the newly extended 64-bit IAPD address prefix may be one address prefix from the smallest address prefix to the largest address prefix. Then the newly extended 64-bit IAPD address prefix + 64-bit interface ID.
  • the interface ID is the interface ID of the router's uplink interface, where the interface ID can be generated according to the EUI-64 specification according to the interface MAC address. It can be detected that the address prefix of the IPv6 address used by the terminal device matches the IAPD address prefix obtained by the terminal device.
  • the terminal device may also generate an IPv6 address by using the IAPD address prefix in other manners, which is not limited in this embodiment of the present application.
  • the terminal device receives the IANA address and the IAPD address prefix sent by the DHCPv6 server, and the terminal device detects that it has received the IAPD address prefix. Even if the terminal device receives the IANA address, the terminal device can The address prefix generates the ipv6 address of the WAN port of the uplink interface, which is the 64-bit PD prefix to be extended + the 64-bit interface ID.
  • the interface ID is the interface ID of the terminal device connecting to the LAN.
  • the interface ID can be generated according to the EUI-64 specification according to the interface MAC address. .
  • the terminal device when there is no network device (such as a router) between the terminal device and the DHCPv6 server, the terminal device can generate an ipv6 address through the IAPD address prefix and use it as its own ipv6 address, and realize the terminal device based on the ipv6 address. Access the WAN. Even if the terminal device does not obtain the IANA address sent by the DHCPv6 server, the terminal device can still access the WAN.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • software it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.
  • the process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium.
  • the program When the program is executed , which may include the processes of the foregoing method embodiments.
  • the aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

公开了一种IPv6地址生成方法,其特征在于,所述方法包括:网络设备向DHCPv6服务器发送配置请求;网络设备接收到DHCPv6服务器基于配置请求向网络设备发送的IAPD地址前缀;网络设备基于接收到的IAPD地址前缀,为终端设备配置第一IPv6地址,为网络设备的下行接口配置第二IPv6地址,以及为网络设备的上行接口配置第三IPv6地址;第一IPv6地址和第二IPv6地址用于实现网络设备和终端设备之间的通信,第三IPv6地址用于网络设备访问广域网。网络设备(例如路由器)通过获取到的IAPD地址前缀生成上行接口的ipv6地址,解决了路由器访问广域网的问题,以使终端设备和广域网之间能够实现数据的通信。

Description

一种IPv6地址生成方法及相关装置
本申请要求于2021年2月24日提交中国专利局、申请号为202110206724.1、申请名称为“一种IPv6地址生成方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子技术领域,尤其涉及一种IPv6地址生成方法及相关装置。
背景技术
从IPv4向IPv6迭代已经是大势所趋,常规的IPv6地址部署包括无状态地址分配和有状态地址分配。其中有状态地址分配是通过动态主机设置协议(Dynamic Host Configuration Protocol for IPV6,DHCPV6)给终端设备/网络设备分配身份关联非临时地址(Identity Association for Non-temporary Address,IANA)地址,终端设备/网络设备使用此IANA地址上网。
现有网络中存在以下IPv6部署情况:运营商配置为有状态地址分配模式,但DHCPV6服务器只给终端设备/网络设备分配身份关联前缀委派(Identity Association for Prefix Delegation,IAPD)地址前缀,并未下发IANA地址。
在该场景下,终端设备/网络设备无法获取IANA地址因而无法获取到IPv6地址,导致终端设备/网络设备无法上网。
发明内容
本申请实施例提供了一种IPV6地址生成方法及相关装置,可以通过该方法提供电子设备的ipv6地址,以使电子设备和广域网之间实现数据的通信。
第一方面,本申请提供了一种IPV6地址生成方法,该方法应用于网络设备,网络设备的上行接口与DHCPv6服务器进行数据通信,网络设备的下行接口与终端设备进行数据通信,方法包括:
网络设备向DHCPv6服务器发送配置请求;
网络设备接收到DHCPv6服务器基于配置请求向网络设备发送的IAPD地址前缀;
网络设备基于接收到的IAPD地址前缀,为终端设备配置第一IPv6地址,为网络设备的下行接口配置第二IPv6地址,以及为网络设备的上行接口配置第三IPv6地址;第三IPv6地址与IAPD地址前缀匹配;第一IPv6地址和第二IPv6地址用于实现网络设备和终端设备之间的通信,第三IPv6地址用于网络设备访问广域网。
本申请实施例,在终端设备和DHCPv6服务器之间存在网络设备(例如路由器)的情况下,路由器通过获取到的IAPD地址前缀生成用户侧的地址,并基于终端设备和路由器的通信链路向终端设备和路由器分配ipv6地址,实现终端设备和路由器的数据通信。并且路由器还可以通过获取到的IAPD地址前缀生成上行接口的ipv6地址,解决了路由器访问广域网的问题,为终端设备和广域网之间实现数据的通信。
在一些可能的实施方式中,网络设备向DHCPv6服务器发送配置请求,之前还包括:网络设备向DHCPv6服务器发送RS报文;网络设备接收到DHCPv6服务器基于RS报文向网络设备发送的RA报文,RA报文指示网络设备向DHCPv6服务器发送配置请求以获取地址信息。其中,RA报文中至少包括地址配置标识M,并且地址配置标识M的值为1,则网络 设备使用有状态地址配置方式获取地址信息。有状态地址配置使用DHCPv6协议,由网络设备向DHCPv6服务器发送配置请求,DHCPv6服务器根据策略返回相应配置信息。
在一些可能的实施方式中,方法还包括:网络设备基于接收到的IAPD地址前缀为网络设备的上行接口配置第三IPv6地址,之前还包括:网络设备接收到DHCPv6服务器基于配置请求向网络设备发送的IANA地址;网络设备基于接收到的IAPD地址前缀为网络设备的上行接口配置第三IPv6地址,包括:网络设备基于接收到的IANA地址和IAPD地址前缀,选择IAPD地址前缀为网络设备的上行接口配置第三IPv6地址。这里描述了即使在路由器接收到IANA地址的情况下,路由器也可以根据IAPD地址前缀生成上行接口(WAN口)的ipv6地址。其中可以检测到,第三IPv6地址的地址前缀和路由器获取到的IAPD地址前缀匹配。例如,若路由器获取到的IAPD地址前缀为M位,则第三IPv6地址的前M位与该获取到的IAPD地址前缀相同。
在一些可能的实施方式中,IAPD地址前缀的长度为M位,网络设备基于接收到的IAPD地址前缀为网络设备的上行接口配置第三IPv6地址,包括:当M小于N时,网络设备将M位的IAPD地址前缀扩展为N位的IAPD地址前缀,N为预设数值,M和N均为正整数;网络设备通过将N位的IAPD地址前缀加上网络设备的上行接口的接口ID,构成第三IPv6地址;网络设备将第三IPv6地址作为网络设备的上行接口的网络地址;或者,当M等于N时,网络设备将M位的IAPD地址前缀加上网络设备的上行接口的接口ID,构成第三IPv6地址,N为预设数值,M和N均为正整数;网络设备将第三IPv6地址作为网络设备的上行接口的网络地址。这里提供了一种基于IAPD地址前缀生成第三IPv6地址的方式。
在一些可能的实施方式中,网络设备将M位的IAPD地址前缀扩展为N位的IAPD地址前缀,包括:网络设备将M位的IAPD地址前缀通过尾部补0或补1的方式扩展为N位的IAPD地址前缀。可选的,还可以是通过尾部补0和1的任意组合的方式扩展为N位的IAPD地址前缀。
第二方面,本申请提供了一种IPV6地址生成方法,该方法包括:
终端设备向DHCPv6服务器发送配置请求;
终端设备接收到DHCPv6服务器基于配置请求向终端设备发送的IAPD地址前缀;
终端设备基于接收到的IAPD地址前缀,为终端设备配置IPv6地址,IPv6地址与IAPD地址前缀匹配,IPv6地址用于终端设备访问广域网。
本申请实施例,在终端设备和DHCPv6服务器之间不存在网络设备(例如路由器)的情况下,终端设备可以通过IAPD地址前缀生成ipv6地址并作为自身的ipv6地址,基于该ipv6地址实现终端设备访问广域网。即使终端设备没有获取到DHCPv6服务器发送的IANA地址,也可以实现终端设备访问广域网。
在一些可能的实施方式中,终端设备向DHCPv6服务器发送配置请求,之前还包括:终端设备向DHCPv6服务器发送RS报文;终端设备接收到DHCPv6服务器基于RS报文向终端设备发送的RA报文,RA报文指示终端设备向DHCPv6服务器发送配置请求以获取地址信息。其中,RA报文中至少包括地址配置标识M,并且地址配置标识M的值为1,则终端设备使用有状态地址配置方式获取地址信息。有状态地址配置使用DHCPv6协议,由终端设备向DHCPv6服务器发送配置请求,DHCPv6服务器根据策略返回相应配置信息。
在一些可能的实施方式中,方法还包括:终端设备基于接收到的IAPD地址前缀,为终端设备配置IPv6地址,之前还包括:终端设备接收到DHCPv6服务器基于配置请求向终端设备发送的IANA地址;终端设备基于接收到的IAPD地址前缀,为终端设备配置IPv6地址, 包括:终端设备基于接收到的IANA地址和IAPD地址前缀,选择IAPD地址前缀为终端设备配置IPv6地址。这里描述了即使在终端设备接收到IANA地址的情况下,终端设备也可以根据IAPD地址前缀生成上行接口(WAN口)的ipv6地址。其中可以检测到,第三IPv6地址的地址前缀和终端设备获取到的IAPD地址前缀匹配。例如,若终端设备获取到的IAPD地址前缀为M位,则第三IPv6地址的前M位与该获取到的IAPD地址前缀相同。
在一些可能的实施方式中,IAPD地址前缀的长度为M位,终端设备基于接收到的IAPD地址前缀,为终端设备配置IPv6地址,包括:当M小于N时,终端设备将M位的IAPD地址前缀扩展为N位的IAPD地址前缀,N为预设数值,M和N均为正整数;终端设备通过将N位的IAPD地址前缀加上终端设备的接口ID,构成IPv6地址;终端设备将IPv6地址作为终端设备的网络地址;或者,当M等于N时,终端设备通过将M位的IAPD地址前缀加上终端设备的接口ID,构成IPv6地址,N为预设数值,M和N均为正整数;终端设备将IPv6地址作为终端设备的网络地址。这里提供了一种基于IAPD地址前缀生成IPv6地址的方式。其中,这里的ipv6地址为实施例中的第四ipv6地址。
在一些可能的实施方式中,终端设备将M位的IAPD地址前缀扩展为N位的IAPD地址前缀,包括:终端设备将M位的IAPD地址前缀通过尾部补0或补1的方式扩展为N位的IAPD地址前缀。可选的,还可以是通过尾部补0和1的任意组合的方式扩展为N位的IAPD地址前缀。
第三方面,本申请提供了一种电子设备,包括:一个或多个处理器、一个或多个存储器;该一个或多个存储与一个或多个处理器耦合;该一个或多个存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令;当该计算机指令在该处理器上运行时,使得该电子设备执行上述任一方面任一种可能的实现方式中的IPV6地址生成方法。
第四方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得通信装置执行上述任一方面任一项可能的实现方式中的IPV6地址生成方法。
第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面任一项可能的实现方式中的IPV6地址生成方法。
附图说明
图1为本申请实施例提供的一种系统架构示意图;
图2A为本申请实施例提供的一种电子设备的结构示意图;
图2B为本申请实施例提供的一种网络设备的结构示意图;
图3A和图3B为本申请实施例提供的一种ipv6地址生成方法的流程示意图;
图4为本申请实施例提供的又一种ipv6地址生成方法的流程示意图;
图5为本申请实施例提供的一种数据包的数据示意图;
图6为本申请实施例提供的又一种ipv6地址生成方法的流程示意图。
具体实施方式
下面将结合附图对本申请实施例中的技术方案进行地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单 独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
在本申请中使用的术语“部件”、“模块”、“系统”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。例如,部件可以是但不限于,在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或计算机。通过图示,在计算设备上运行的应用和计算设备都可以是部件。一个或多个部件可驻留在进程和/或执行线程中,部件可位于一个计算机上和/或分布在2个或更多个计算机之间。此外,这些部件可从在上面存储有各种数据结构的各种计算机可读介质执行。部件可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一部件交互的二个部件的数据,例如通过信号与其它系统交互的广域网)的信号通过本地和/或远程进程来通信。
本申请实施例的技术方案可以应用于各种通信系统,例如:全球移动通信系统(global system for mobile communication,GSM)系统、码分多址(code division multiple access,CDMA)系统、宽带码多分址(wideband code division multiple access,WCDMA)系统、通用分组无线业务(general packet radio service,GPRS)、长期演进(long term evolution,LTE)系统、LTE频分双工(frequency division duplex,FDD)系统、LTE时分双工(time division duplex,TDD)系统、通用移动通信(universal mobile telecommunications system,UMTS)系统、增强型数据速率GSM演进(enhanced data rate for GSM evolution,EDGE)系统、全球互联微波接入(worldwide interoperability for microwave access,WiMAX)系统。本申请实施例的技术方案还可以应用于其他通信系统,例如公共陆地移动网络(public land mobile network,PLMN)系统,第五代(5th generation,5G)系统或5G之后的通信系统或新无线(new radio,NR)等,本申请所述的5G移动通信系统包括非独立组网(non-standalone,NSA)的5G移动通信系统和/或独立组网(standalone,SA)的5G移动通信系统。本申请提供的技术方案还可以应用于未来的通信系统,如第六代移动通信系统。通信系统还可以是PLMN网络、设备到设备(device-to-device,D2D)网络、机器到机器(machine to machine,M2M)网络、IoT网络或者其他网络。
如图1所示,图1是本申请实施例提供的一种通信系统的系统架构图。该通信系统包括DHCPv6(Dynamic Host Configuration Protocol for IPv6)服务器101、网络设备102和一个或多个终端设备(例如终端设备1、终端设备2和终端设备3)。DHCPv6服务器101可以直接与终端设备立通信连接,为终端设备提供网络服务;也可以通过网络设备102与终端设备建立通信连接,为终端设备提供网络服务。其中,
DHCPv6服务器101包括用于接入广域网的设备,例如基站,宽带远程接入服务器(broadband access serve,BRAS)、光网络单元、宽带网络业务网关(broadband network gateway,BNG),汇聚交换机等。其中,基站可以包括各种形式的基站,例如:宏基站,微基站(也称为小站),中继站,接入点等。可选的,DHCPv6服务器101可以搭载在上述接入广域网的设备上。
DHCPv6服务器101可以直接与终端设备建立通信连接,为终端设备提供网络服务,例如图1中的终端设备3;也可以通过网络设备102与终端设备建立通信连接,为终端设备提供网络服务,例如图1中的终端设备1和终端设备2。
网络设备102包括路由器、网关等设备,提供了连接网络、传输信息的功能,可以与多个终端设备连接来分享网络。其中,网络设备102包括上行接口(WAN口)和下行接口(LAN口),网络设备102的上行接口可以连接DHCPv6服务器101,并且网络设备102通过DHCPv6 服务器101提供的IANA地址能够访问广域网;网络设备102的下行接口可以连接一个或多个终端设备,用于网络设备102与终端设备进行数据通信。当终端设备想要通过网络设备102访问网络时,网络设备102的上行接口和下行接口都需要配置ipv6地址,使网络设备102与其他设备之间可以互相通信。例如图1中,网络设备102通过下行接口1和终端设备1进行连接,网络设备102为下行接口1和终端设备1分别配置一个ipv6地址,以建立网络设备102和终端设备1的通信链路,使网络设备102和终端设备1能够实现数据的通信,那么终端设备1可以通过该网络设备102访问广域网。又例如,网络设备102通过下行接口2和终端设备2进行连接,网络设备102为下行接口2和终端设备2分别配置一个ipv6地址,以建立网络设备102和终端设备2的通信链路,使网络设备102和终端设备2能够实现数据的通信,那么终端设备2可以通过该网络设备102访问广域网。
在一些实施例中,网络设备102可以和一个或多个终端设备建立无线连接,连接方式例如Wi-Fi连接。网络设备102建立和终端设备的无线通信链路,为网络设备102和终端设备分别配置一个ipv6地址,使网络设备102和终端设备能够实现数据的通信,那么终端设备可以通过该网络设备102访问广域网。
终端设备也可以称为用户设备(user equipment,UE)、接入终端、用户单元、用户站、移动站、移动台、远方站、远程终端、移动设备、用户终端、终端、无线通信设备、用户代理或用户装置。终端设备可以是WLAN中的站点(STAION,ST),可以是蜂窝电话、无绳电话、会话启动协议(session initiationprotocol,SIP)电话、无线本地环路(wireless local loop,WLL)站、个人数字处理(personal digital assistant,PDA)设备、具有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、车载设备、车联网终端、电脑、膝上型计算机、手持式通信设备、手持式计算设备、卫星无线设备、无线调制解调器卡、电视机顶盒(set top box,STB)、用户驻地设备(customer premise equipment,CPE)和/或用于在无线系统上进行通信的其它设备以及下一代通信系统,例如,5G网络中的终端设备或者未来演进的公共陆地移动网络(public land mobile network,PLMN)网络中的终端设备等。
图2A示例性的示出了本申请实施例提供的一种电子设备100的结构示意图,电子设备100可以是上述系统架构中的终端设备(终端设备1、终端设备2、终端设备3)。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处 理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
充电管理模块140用于从充电器接收充电输入。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括UWB,无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信 模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。
图2B示例性的示出了本申请实施例提供的上述系统架构中的网络设备102的结构示意图。如图2B所示,网络设备102可以包括处理器1021、存储器1022、无线通信处理模块1023、有线通信处理模块1024和电源开关1025。存储器1022可以是独立存在的,可以通过总线与处理器1021相连接。存储器1022也可以和处理器1021集成在一起。其中,总线用于实现这些组件之间的连接。其中:
处理器1021可用于读取和执行计算机可读指令。具体实现中,处理器1021可主要包括控制器、运算器和寄存器。其中,控制器主要负责指令译码,并为指令对应的操作发出控制信号。运算器主要负责执行定点或浮点算数运算操作、移位操作以及逻辑操作等,也可以执行地址运算和转换。寄存器主要负责保存指令执行过程中临时存放的寄存器操作数和中间操作结果等。具体实现中,处理器1021的硬件架构可以是专用集成电路(Application Specific Integrated Circuits,ASIC)架构、MIPS架构、ARM架构或者NP架构等等。
处理器1021可以用于解析无线通信处理模块1023和/或有线通信处理模块1024接收到的信号,如电子设备100的广播的探测请求,电子设备100发送的指令,等等。处理器1021可以用于根据解析结果进行相应的处理操作,如生成探测响应等。
在一些实施例中,处理器1021还可以用于生成无线通信处理模块1023和/或有线通信处理模块1024向外发送的信号,如广播信号,又如向电子设备100发送的用于反馈连接状态(如连接成功、连接失败等)的信号。
存储器1022与处理器1021耦合,用于存储各种软件程序和/或多组指令。具体实现中,存储器1022可包括高速随机存取的存储器,并且也可包括非易失性存储器,例如一个或多个磁盘存储设备、闪存设备或其他非易失性固态存储设备。
无线通信处理模块1023可以包括蓝牙(BT)通信处理模块、WLAN通信处理模块中的一项或多项。
在一些实施例中,蓝牙(BT)通信处理模块、WLAN通信处理模块中的一项或多项可以监听到其他设备(如电子设备100)发射的信号,如探测请求、扫描信号等等,并可以发送响应信号,如探测响应、扫描响应等,使得其他设备(如电子设备100)可以发现网络设备102,并与其他设备(如电子设备100)建立无线通信连接,通过蓝牙或WLAN中的一种或多种无线通信技术与其他设备(如电子设备100)进行通信。
在另一些实施例中,蓝牙(BT)通信处理模块、WLAN通信处理模块中的一项或多项也可以发射信号,如广播信号,使得其他设备(如电子设备100)可以发现网络设备102,并与其他设备(如电子设备100)建立无线通信连接,通过蓝牙或WLAN中的一种或多种无线通信技术与其他设备(如电子设备100)进行通信。
电源开关1025可用于控制电源向网络设备102的供电。
有线通信处理模块1024可用于通过上行接口连接到广域网,与广域网中的设备通信;还可用于通过下行接口连接到局域网,和该局域网中的设备进行通信,其中,
上行接口又可称为WAN接口。WAN接口用于网络设备102与广域网的连接,包括例如RJ-45端口、AUI端口、高速同步串口(SERIAL)、异步串口(ASYNC)、ISDN BRI端口等。RJ-45端口是双绞线以太网端口,网络设备102可通过双绞线实现与快速以太网的连接。在一些实施例中,利用RJ-45端口也可以建立广域网与局域网VLAN(虚拟局域网)之间,以及与远程网络或Internet的连接。高速同步串口(SERIAL)主要用于连接目前应用非常广泛的DDN、帧中继(Frame Relay)、X.25、PSTN(模拟电话线路)等网络连接模式。异步串口(ASYNC)主要是应用于Modem或Modem池的连接,可以实现远程计算机通过公用电话网拨入网络。ISDN BRI端口用于ISDN线路通过路由器实现与Internet或其他远程网络的连接,可实现128Kbps的通信速率。
下行接口又可称为LAN接口。网络设备102可以包括一个或多个LAN接口,LAN接口用于网络设备102与局域网的连接,包括例如AUI端口、RJ-45端口、SC端口等。其中,每一个LAN接口可以与一个终端设备连接。AUI端口是用来与粗同轴电缆连接的接口,网络设备102可通过粗同轴电缆收发器实现与10Base-5网络的连接。RJ-45端口是双绞线以太网端口,网络设备102可通过双绞线实现与快速以太网的连接。SC端口又叫光纤端口,用于与光纤的连接。光纤端口通常是不直接用光纤连接至工作站,而是通过光纤连接到快速以太网或千兆以太网等具有光纤端口的交换机。
可选的,网络设备102还包括一个或多个配置接口,配置接口包括例如Console端口、AUX端口等。Console端口使用配置专用连线直接连接至计算机的串口,利用终端仿真程序进行本地配置。AUX端口为异步端口,主要用于远程配置,也可用于拔号连接,还可通过收发器与MODEM进行连接。
基于上述系统架构以及电子设备100和网络设备102的硬件结构,下面介绍本申请实施例中两种情况下终端设备获取ipv6地址的方法流程,在介绍ipv6地址的生成方法之前,首先简单介绍一下ipv6地址的格式。ipv6地址的地址长度为128位,由八个16位字段组成,包括64位的前缀和64位的接口ID。其中,64位的前缀通常是由服务器分配的前缀,或者基于服务器分配的字段生成的前缀;接口ID可以从接口的MAC地址自动配置,也可以采用EUI-64格式手动配置。
情况一、终端设备和DHCPv6服务器101之间存在网络设备102(下面以路由器为例),DHCPv6服务器101通过网络设备102为终端设备提供ipv6地址。如图1所示的系统架构中, DHCPv6服务器101为终端设备1和终端设备2提供ipv6地址,具体方法流程如图3A所示,
步骤S101、路由器向DHCPv6服务器发送路由请求(Router Solicitation,RS)报文。
路由器发送RS报文,该RS报文的IP包的目的地址可以填写广播地址,源地址可以填写请求者(该路由器)的MAC地址,该RS报文用于请求与一个DHCPv6服务器建立通信连接。
步骤S102、DHCPv6服务器接收到RS报文后,基于该RS报文向路由器发送路由应答(Router Advertisement,RA)报文。
DHCPv6服务器接收到RS报文后,响应于该RS报文,向路由器发送RA报文。该RA报文包含以下中的一项或多项:地址配置标识M和其他信息配置标识O;一个或多个链路前缀以及链路前缀的生命周期等等。
其中,地址配置标识M用于指示路由器使用无状态地址配置方式获取地址信息还是有状态地址配置方式获取地址信息,当M的值为0时使用无状态地址配置方式,路由器使用RA报文中携带的链路前缀和接口ID生成全球单播地址,完成无状态地址配置;当M的值为1时使用有状态地址配置方式,表示路由器通过动态主机配置协议DHCPV6来获取地址信息。
其他信息配置标识O用于指示路由器使用无状态地址配置方式获取其他配置信息还是有状态地址配置方式获取其他配置信息,当O的值为1时,路由器使用有状态地址配置方式,通过DHCPV6获取其他配置信息,其他配置信息可以是域名系统相关的信息,或网络中其他服务的信息。
路由器接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置M标识的值为0,步骤S103、路由器使用无状态地址配置方式获取地址信息。
RA报文中携带了正确的链路前缀,路由器使用这些链路前缀和接口ID生成全球单播地址,完成无状态地址配置。
可选的,其他信息配置标识O的值为0,则终端设备使用无状态地址配置方式获取其他配置信息。
终端设备接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置标识M的值为1,步骤S104、路由器使用有状态地址配置方式获取地址信息。
可选的,其他信息配置标识O标记的值为1,则终端设备使用有状态地址配置方式获取其他配置信息。
有状态地址配置使用DHCPv6协议,由DHCPv6客户端(即路由器)向DHCPv6服务器发送配置请求,DHCPv6服务器根据策略返回相应配置信息。
步骤S105、路由器向DHCPv6服务器发送配置请求,请求获取IANA地址和IAPD地址前缀。
步骤S106、DHCPv6服务器基于接收到的配置请求,向路由器发送IANA地址和IAPD地址前缀。
IANA地址是DHCPv6服务器为网络设备(路由器)提供的网络侧地址(ipv6地址),该网络侧地址是为路由器的上行接口(WAN口)提供的,用于路由器访问广域网。
IAPD地址前缀用于为网络设备(路由器)向终端设备提供用户侧地址,通过IAPD地址前缀可以生成用户侧地址,该用户侧地址是路由器提供给与路由器建立了连接的终端设备的ipv6地址,以及提供给路由器的下行接口(LAN口)的ipv6地址。该用户侧地址用于终端设备和路由器进行数据通信。具体来说,IAPD地址前缀是DHCPv6服务器发送给路由器的子网前缀,其作用为给路由器分配一个网络号,然后路由器可以把这个网络号再分成若干个网 段分配给它的接口(下行接口LAN口)、以及连接在这些接口中的终端设备或者其他节点,以建立通信链路。
即IAPD地址前缀指定了路由器可以给自身的下行接口和其他终端设备(或节点)分配地址的网段,而路由器上行接口(WAN口)的地址需要通过IANA地址来提供。
步骤S107、路由器将接收到的IANA地址作为上行接口的ipv6地址,并基于接收到的IAPD地址前缀生成用户侧的ipv6地址,向终端设备分配该用户侧的ipv6地址。
在上述图1的系统架构中,路由器将接收到的IANA地址作为上行接口(WAN口)的ipv6地址;并且基于接收到的IAPD地址前缀生成用户侧的ipv6地址,建立路由器和终端设备的通信链路。举例来说,在上述图1的系统架构中,路由器通过下行接口1和终端设备1进行连接,路由器基于IAPD地址前缀为下行接口1和终端设备1分别配置一个ipv6地址,以建立路由器和终端设备1的通信链路,使路由器和终端设备1能够实现数据的通信,那么终端设备1可以通过该路由器访问广域网。终端设备2同理。
又例如,路由器和终端设备建立无线连接(例如Wi-Fi连接),路由器建立路由器和终端设备的通信链路,基于IAPD地址前缀为路由器和终端设备分别配置一个ipv6地址,使路由器和终端设备能够实现数据的通信,那么终端设备可以通过该路由器访问广域网。
由此可知,在终端设备和DHCPv6服务器之间存在网络设备(例如路由器)的情况下,路由器基于获取到的DHCPv6服务器发送的IAPD地址前缀,为终端设备和路由器的通信链路分配ipv6地址,并且将获取到的DHCPv6服务器发送的IANA地址作为上行接口(WAN口)的ipv6地址,为终端设备和互联网之间实现数据的通信。
在一些实施例中,路由器将接收到的IANA地址作为上行接口(WAN口)的ipv6地址,并且在局域网中广播接收到的IAPD地址前缀,终端设备接收到该IAPD地址前缀,基于该IAPD地址前缀生成ipv6地址并作为自身的ipv6地址。其中该ipv6地址可以是终端设备基于IAPD地址前缀和终端设备的接口ID生成。
情况二、终端设备和DHCPv6服务器之间不存在网络设备(例如路由器),DHCPv6服务器直接为终端设备提供ipv6地址。如图1所示的系统架构中,DHCPv6服务器为终端设备3提供ipv6地址,具体方法流程如图3B所示。
步骤S201、终端设备向DHCPv6服务器发送RS报文。
步骤S202、DHCPv6服务器接收到RS报文后,基于该RS报文向终端设备发送RA报文。
终端设备接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置标识M的值为0,步骤S203、终端设备使用无状态地址配置方式获取地址信息。
终端设备接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置标识M的值为1,步骤S204、终端设备使用有状态地址配置方式获取地址信息。有状态地址配置使用DHCPv6协议,由DHCPv6客户端(即终端设备)向DHCPv6服务器发送配置请求,DHCPv6服务器根据策略返回相应配置信息。
其中,上述终端设备在步骤S201-步骤S204执行的动作可以参考路由器在上述步骤S101-步骤S104执行的动作,此处不再赘述。
步骤S205、终端设备向DHCPv6服务器发送配置请求,请求获取IANA地址。
步骤S206、DHCPv6服务器基于接收到的配置请求,向终端设备发送IANA地址。
步骤S207、终端设备接收到IANA地址,将该IANA地址作为该终端设备自身的ipv6地址,终端设备基于该ipv6地址访问广域网。
在一些实施例中,步骤S205可替换为终端设备向DHCPv6服务器发送配置请求,请求IANA地址和IAPD地址前缀,则终端设备将接收到的IANA地址作为自身的ipv6地址,基于该ipv6地址实现终端设备访问广域网。若终端设备作为一个中继网络设备,也可以利用接收到的IAPD地址前缀生成用户侧的ipv6地址,为下一级的设备或节点提供ipv6地址。
由此可知,在终端设备和DHCPv6服务器之间不存在网络设备(例如路由器)的情况下,终端设备将接收到DHCPv6服务器发送的IANA地址作为自身的ipv6地址,实现终端设备能够访问广域网。
上述两种情况说明了路由器/终端设备获取ipv6地址的方法,而在一些实际场景中,在上述步骤S106/步骤S206中,DHCPv6服务器会因为地址配置管理的原因,甚至因为配置错误的原因,不向路由器/终端设备发送IANA地址,则路由器/终端设备只能获取到IAPD地址前缀,不能获取到IANA地址,导致路由器/终端设备无法上网。在情况一中,路由器向DHCPv6服务器请求IANA地址和IAPD地址前缀时,DHCPv6服务器不给路由器分配IANA地址,只给路由器发送IAPD地址前缀。由于路由器没有接收到IANA地址,导致路由器的上行接口没有ipv6地址,即使路由器可以通过IAPD地址前缀为终端设备分配用户侧地址,但由于路由器本身无法上网,则与该路由器在同一局域网下的终端设备也无法上网。同理于情况二,终端设备向DHCPv6服务器请求IANA地址和IAPD地址前缀时,DHCPv6服务器不给终端设备分配IANA地址,只给终端设备发送IAPD地址前缀。由于终端设备没有接收到IANA地址,导致终端设备自身没有ipv6地址,无法上网。
针对上述场景,本申请实施例提供了一种ipv6地址的生成方法,可以在路由器/终端设备只接收到IAPD地址前缀,没有接收到IANA地址的情况下,实现ipv6地址的生成,从而实现上网。针对于上述情况一,终端设备和DHCPv6服务器之间存在网络设备(例如路由器),DHCPv6服务器通过网络设备为终端设备提供ipv6地址。如图4所示,该方法包括:
步骤S301、路由器向DHCPv6服务器发送RS报文。
步骤S302、DHCPv6服务器接收到RS报文后,基于该RS报文向路由器发送RA报文。
路由器接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置M标识的值为0,步骤S303、终端设备使用无状态地址配置方式获取地址信息。
终端设备接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置M标识的值为1,步骤S304、路由器使用有状态地址配置方式获取地址信息。
其中,上述路由器在步骤S301-步骤S304执行的动作可以参考路由器在上述步骤S101-步骤S104执行的动作,此处不再赘述。
步骤S305、路由器向DHCPv6服务器发送配置请求,请求获取IANA地址和IAPD地址前缀。
在一些实施例中,步骤S305可以替换为路由器向DHCPv6服务器发送配置请求,请求获取IANA地址或IAPD地址前缀。
步骤S306、DHCPv6服务器基于接收到的配置请求,向路由器发送IAPD地址前缀。
步骤S307、路由器基于接收到的IAPD地址前缀生成自身的ipv6地址,并基于接收到的IAPD地址前缀生成用户侧的ipv6地址,向终端设备分配该用户侧的ipv6地址。
路由器接收到DHCPv6服务器发送的IAPD地址前缀,且没有接收到IANA地址,如图5所示,此时抓取到路由器接收到的数据包,可以看出路由器接收到的数据包中包含IAPD地址前缀,没有IANA地址。
路由器检测到没有接收到DHCPv6服务器发送的IANA地址,则路由器根据接收到的IAPD地址前缀生成路由器的上行接口(WAN口)的ipv6地址。具体的生成方式包括,如果IAPD地址前缀的长度小于64bit,则将其扩展为64bit,扩展的方式例如可以为尾部填0;如果IAPD地址前缀的长度为64bit,则不需扩展。然后基于64bit的IAPD地址前缀生成路由器上行接口WAN口的IPv6地址,生成方式例如包括:新扩展的64bit的IAPD地址前缀+64bit的接口ID。接口ID为路由器上行接口的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。可以检测到的是,路由器的上行接口(WAN口)使用的IPv6地址前缀和路由器获取到的IAPD地址前缀匹配。在一些实施例中,路由器获取到的IAPD地址前缀为M位,则路由器的上行接口(WAN口)的IPv6地址的前M位与该获取到的IAPD地址前缀相同。这里,路由器的上行接口(WAN口)的ipv6地址也可称为第三ipv6地址。
在一些实施例中,生成方式还可以是,路由器获取的IAPD地址前缀的长度为M位,且预设的长度配置为N位时,其中,M、N为整数,且M小于N。将获取的IAPD地址前缀通过补0的方式扩展为N位掩码的IAPD地址前缀,作为扩展后的IAPD地址前缀。然后,对扩展后的N位掩码的IAPD地址前缀的N位掩码的第N位的值设置为1作为地址池中的最小地址前缀,对扩展后的N位掩码的IAPD地址前缀的N位掩码中的最后N-M位的值都设置1作为地址池中的最大地址前缀,生成IAPD地址池。例如,N为64,M为60,则将60位IAPD地址前缀在尾部补0,扩展为64位,即第61位-第64位为0。然后将该64位的IAPD地址前缀中的第64位的值设置为1,作为地址池中的最小地址前缀;将该64位的IAPD地址前缀中的第61位-第64位的值都设置为1,作为地址池中的最大地址前缀。新扩展的64bit的IAPD地址前缀可以是该地址池中的最小地址前缀至最大地址前缀中的一个地址前缀。然后将该新扩展的64bit的IAPD地址前缀+64bit的接口ID。接口ID为路由器上行接口的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。可以检测到的是,路由器的上行接口WAN口使用的IPv6地址的地址前缀和路由器获取到的IAPD地址前缀匹配。
其中,路由器还可以通过其他方式利用IAPD地址前缀生成路由器上行接口(WAN口)的IPv6地址,本申请实施例对此不作限制。
路由器基于IAPD地址前缀生成用户侧的ipv6地址,分配路由器的下行接口(LAN口)的ipv6地址,并向与路由器连接的终端设备分配ipv6地址。则该终端设备可以基于自身的ipv6地址通过路由器访问广域网。其中,该终端设备的ipv6地址和LAN口的ipv6地址为同一网段。这里,路由器向该终端设备分配的ipv6地址也可称为第一ipv6地址,路由器的LAN口的ipv6地址也可称为第二ipv6地址。
由此可知,在终端设备和DHCPv6服务器之间存在网络设备(例如路由器)的情况下,路由器通过获取到的IAPD地址前缀生成用户侧的地址,并基于终端设备和路由器的通信链路向终端设备和路由器分配ipv6地址,实现终端设备和路由器的数据通信。在没有IANA地址的情况下,路由器通过IAPD地址前缀生成上行接口的ipv6地址,解决了路由器访问广域网的问题,为终端设备和广域网之间实现数据的通信。
在一些实施例中,在步骤S306中,DHCPv6服务器向路由器发送IANA地址和IAPD地址前缀,则路由器检测到接收到了IAPD地址前缀,即使路由器接收到IANA地址,路由器也可以根据IAPD地址前缀生成上行接口(WAN口)的ipv6地址,即将扩展的64bit的PD前缀+64bit的接口ID,接口ID为路由器上行接口的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。
在一些实施例中,基于情况一的系统架构,终端设备若没有接收到路由器分配的ipv6地 址,可以向路由器获取IAPD地址前缀,然后终端设备基于该IAPD地址前缀生成自身的ipv6地址,即将扩展的64bit的PD前缀+64bit的接口ID,接口ID为终端设备连接局域网的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。
在一些实施例中,路由器接收到IAPD地址前缀,在局域网中广播该IAPD地址前缀,终端设备接收到该IAPD地址前缀,生成自身的ipv6地址。其中该ipv6地址可以基于IAPD地址前缀和终端设备的接口ID生成。其中,终端设备基于IAPD地址前缀生成ipv6地址的方式可以参考上述路由器基于IAPD地址前缀生成ipv6地址的方式,此处不再赘述。
在本申请实施例中,在终端设备和DHCPv6服务器之间存在网络设备(例如路由器)的情况下,路由器通过获取IAPD地址前缀向终端设备分配ipv6地址,并且通过IAPD地址前缀获取上行接口的ipv6地址,即使路由器没有获取到DHCPv6服务器发送的IANA地址,也可以为终端设备和广域网之间实现数据的通信。
针对于上述情况二,终端设备和DHCPv6服务器之间不存在网络设备(例如路由器),DHCPv6服务器直接为终端设备提供ipv6地址。如图6所示,该方法包括:
步骤S401、终端设备向DHCPv6服务器发送RS报文。
步骤S402、DHCPv6服务器接收到RS报文后,基于该RS报文向终端设备发送RA报文。
终端设备接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置M标识的值为0,步骤S403、终端设备使用无状态地址配置方式获取地址信息。
终端设备接收到RA报文后,若该RA报文中指示使用地址自动配置,并且地址配置M标识的值为1,步骤S404、终端设备使用有状态地址配置方式获取地址信息。
其中,上述终端设备在步骤S401-步骤S404执行的动作可以参考路由器在上述步骤S101-步骤S104执行的动作,此处不再赘述。
步骤S405、终端设备向DHCPv6服务器发送配置请求,请求IANA地址和IAPD地址前缀。
在一些实施例中,步骤S205可替换为终端设备向DHCPv6服务器发送配置请求,请求IANA地址或IAPD地址前缀。
步骤S406、DHCPv6服务器基于接收到的配置请求,向终端设备发送IAPD地址前缀。
步骤S407、终端设备基于IAPD地址前缀生成ipv6地址,将该ipv6地址作为自身的ipv6地址。
终端设备接收到DHCPv6服务器发送的IAPD地址前缀,且没有接收到IANA地址,此时抓取到终端设备接收到的数据包,可以看出终端设备接收到的数据包中包含IAPD地址前缀,没有IANA地址。
终端设备根据IAPD地址前缀生成ipv6地址。具体的,如果IAPD地址前缀的长度小于64bit,则将其扩展为64bit,扩展的方式例如可以为尾部填0;如果IAPD地址前缀的长度为64bit,则不需扩展。然后基于64bit的IAPD地址前缀生成IPv6地址,生成方式例如包括:新扩展的64bit的PD前缀+64bit的接口ID。接口ID为终端设备连接DHCPv6服务器的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。可以检测到的是,终端设备的IPv6地址的地址前缀和终端设备获取到的IAPD地址前缀匹配。在一些实施例中,终端设备获取到的IAPD地址前缀为M位,则终端设备的IPv6地址的前M位与该获取到的IAPD地址前缀相同。这里,终端设备根据IAPD地址前缀生成的ipv6地址也可称为第四ipv6地址。
在一些实施例中,生成方式还可以是,终端设备获取的IAPD地址前缀的长度为M位, 且预设的长度配置为N位时,其中,M、N为整数,且M小于N。将获取的IAPD地址前缀通过补0的方式扩展为N位掩码的IAPD地址前缀,作为扩展后的IAPD地址前缀。然后,对扩展后的N位掩码的IAPD地址前缀的N位掩码的第N位的值设置为1作为地址池中的最小地址前缀,对扩展后的N位掩码的IAPD地址前缀的N位掩码中的最后N-M位的值都设置为1作为地址池中的最大地址前缀,生成IAPD地址池。例如,N为64,M为60,则将60位IAPD地址前缀在尾部补0,扩展为64位,即第61位-第64位为0。然后将该64位的IAPD地址前缀中的第64位的值设置为1,作为地址池中的最小地址前缀;将该64位的IAPD地址前缀中的第61位-第64位的值都设置为1,作为地址池中的最大地址前缀。新扩展的64bit的IAPD地址前缀可以是该最小地址前缀至最大地址前缀中的一个地址前缀。然后将该新扩展的64bit的IAPD地址前缀+64bit的接口ID。接口ID为路由器上行接口的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。可以检测到的是,终端设备使用的IPv6地址的地址前缀和终端设备获取到的IAPD地址前缀匹配。
其中,终端设备还可以通过其他方式利用IAPD地址前缀生成IPv6地址,本申请实施例对此不作限制。
在一些实施方式中,在步骤S306中,终端设备接收到DHCPv6服务器发送的IANA地址和IAPD地址前缀,终端设备检测到接收到了IAPD地址前缀,即使终端设备接收到IANA地址,终端设备也可以根据IAPD地址前缀生成上行接口WAN口的ipv6地址,即将扩展的64bit的PD前缀+64bit的接口ID,接口ID为终端设备连接局域网的接口ID,其中,接口ID可以按EUI-64规范根据接口MAC地址生成。
在本申请实施例中,终端设备和DHCPv6服务器之间不存在网络设备(例如路由器)的情况下,终端设备可以通过IAPD地址前缀生成ipv6地址并作为自身的ipv6地址,基于该ipv6地址实现终端设备访问广域网。即使终端设备没有获取到DHCPv6服务器发送的IANA地址,也可以实现终端设备访问广域网。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。

Claims (10)

  1. IPv6地址生成方法,其特征在于,应用于网络设备,所述网络设备的上行接口与DHCPv6服务器进行数据通信,所述网络设备的下行接口与终端设备进行数据通信,所述方法包括:
    所述网络设备向所述DHCPv6服务器发送配置请求;
    所述网络设备接收到所述DHCPv6服务器基于所述配置请求向所述网络设备发送的IAPD地址前缀;
    所述网络设备基于接收到的所述IAPD地址前缀,为所述终端设备配置第一IPv6地址,为所述网络设备的下行接口配置第二IPv6地址,以及为所述网络设备的上行接口配置第三IPv6地址;所述第三IPv6地址与所述IAPD地址前缀匹配;所述第一IPv6地址和所述第二IPv6地址用于实现所述网络设备和所述终端设备之间的通信,所述第三IPv6地址用于所述网络设备访问广域网。
  2. 根据权利要求1所述的方法,其特征在于,所述网络设备向所述DHCPv6服务器发送配置请求,之前还包括:
    所述网络设备向所述DHCPv6服务器发送RS报文;
    所述网络设备接收到所述DHCPv6服务器基于所述RS报文向所述网络设备发送的RA报文,所述RA报文指示所述网络设备向所述DHCPv6服务器发送所述配置请求以获取地址信息。
  3. 根据权利要求1或2所述的方法,其特征在于,所述网络设备基于接收到的所述IAPD地址前缀为所述网络设备的上行接口配置第三IPv6地址,之前还包括:
    所述网络设备接收到所述DHCPv6服务器基于所述配置请求向所述网络设备发送的IANA地址;
    所述网络设备基于接收到的所述IAPD地址前缀为所述网络设备的上行接口配置第三IPv6地址,包括:
    所述网络设备基于接收到的所述IANA地址和所述IAPD地址前缀,选择所述IAPD地址前缀为所述网络设备的上行接口配置所述第三IPv6地址。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述IAPD地址前缀的长度为M位,所述网络设备基于接收到的所述IAPD地址前缀为所述网络设备的上行接口配置第三IPv6地址,包括:
    当所述M小于N时,所述网络设备将所述M位的IAPD地址前缀扩展为N位的IAPD地址前缀,所述N为预设数值,所述M和所述N均为正整数;
    所述网络设备通过将所述N位的IAPD地址前缀加上所述网络设备的上行接口的接口ID,构成所述第三IPv6地址;
    所述网络设备将所述第三IPv6地址作为所述网络设备的上行接口的网络地址;或者,
    当所述M等于所述N时,所述网络设备将所述M位的IAPD地址前缀加上所述网络设备的上行接口的接口ID,构成所述第三IPv6地址,所述N为预设数值,所述M和所述N均为正整数;
    所述网络设备将所述第三IPv6地址作为所述网络设备的上行接口的网络地址。
  5. 一种IPv6地址生成方法,其特征在于,所述方法包括:
    所述终端设备向DHCPv6服务器发送配置请求;
    所述终端设备接收到所述DHCPv6服务器基于所述配置请求向所述终端设备发送的IAPD地址前缀;
    所述终端设备基于接收到的所述IAPD地址前缀,为所述终端设备配置IPv6地址,所述IPv6地址与所述IAPD地址前缀匹配,所述IPv6地址用于所述终端设备访问广域网。
  6. 根据权利要求5所述的方法,其特征在于,所述终端设备向DHCPv6服务器发送配置请求,之前还包括:
    所述终端设备向所述DHCPv6服务器发送RS报文;
    所述终端设备接收到所述DHCPv6服务器基于所述RS报文向所述终端设备发送的RA报文,所述RA报文指示所述终端设备向所述DHCPv6服务器发送所述配置请求以获取地址信息。
  7. 根据权利要求5或6所述的方法,其特征在于,所述终端设备基于接收到的所述IAPD地址前缀,为所述终端设备配置IPv6地址,之前还包括:
    所述终端设备接收到所述DHCPv6服务器基于所述配置请求向所述终端设备发送的IANA地址;
    所述终端设备基于接收到的所述IAPD地址前缀,为所述终端设备配置IPv6地址,包括:
    所述终端设备基于接收到的所述IANA地址和所述IAPD地址前缀,选择所述IAPD地址前缀为所述终端设备配置IPv6地址。
  8. 根据权利要求5-7任一项所述的方法,其特征在于,所述IAPD地址前缀的长度为M位,所述终端设备基于接收到的所述IAPD地址前缀,为所述终端设备配置IPv6地址,包括:
    当所述M小于N时,所述终端设备将所述M位的IAPD地址前缀扩展为N位的IAPD地址前缀,所述N为预设数值,所述M和所述N均为正整数;
    所述终端设备通过将所述N位的IAPD地址前缀加上所述终端设备的接口ID,构成所述IPv6地址;
    所述终端设备将所述IPv6地址作为所述终端设备的网络地址;或者,
    当所述M等于所述N时,所述终端设备通过将所述M位的IAPD地址前缀加上所述终端设备的接口ID,构成所述IPv6地址,所述N为预设数值,所述M和所述N均为正整数;
    所述终端设备将所述IPv6地址作为所述终端设备的网络地址。
  9. 一种电子设备,其特征在于,包括:一个或多个处理器、一个或多个存储器;所述一个或多个存储器分别与所述一个或多个处理器耦合;所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令在所述处理器上运行时,使得所述电子设备执行如权利要求1-4所述的方法或权利要求5-8所述的方法。
  10. 一种计算机可读介质,用于存储一个或多个程序,其中所述一个或多个程序被配置为被所述一个或多个处理器执行,所述一个或多个程序包括指令,所述指令用于执行如权利要求1-4所述的方法或权利要求5-8所述的方法。
PCT/CN2022/076316 2021-02-24 2022-02-15 一种IPv6地址生成方法及相关装置 WO2022179410A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110206724.1A CN114979075A (zh) 2021-02-24 2021-02-24 一种IPv6地址生成方法及相关装置
CN202110206724.1 2021-02-24

Publications (1)

Publication Number Publication Date
WO2022179410A1 true WO2022179410A1 (zh) 2022-09-01

Family

ID=82972994

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/076316 WO2022179410A1 (zh) 2021-02-24 2022-02-15 一种IPv6地址生成方法及相关装置

Country Status (2)

Country Link
CN (1) CN114979075A (zh)
WO (1) WO2022179410A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115767510A (zh) * 2022-11-16 2023-03-07 烽火通信科技股份有限公司 一种ipv6自适应组网方法、系统及PD客户端

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101984636A (zh) * 2010-10-25 2011-03-09 华为技术有限公司 一种前缀分配方法、装置和系统
CN102340452A (zh) * 2011-10-14 2012-02-01 中兴通讯股份有限公司 一种基于单个IPv6地址前缀实现路由传输的方法和无线设备
US20140355609A1 (en) * 2013-05-31 2014-12-04 Cisco Technology, Inc Routing aggregation and prefix delegation
CN104243454A (zh) * 2014-08-28 2014-12-24 杭州华三通信技术有限公司 一种IPv6报文过滤方法和设备
CN111586197A (zh) * 2020-04-23 2020-08-25 中国信息通信研究院 一种地址前缀的再次分发方法和装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8681695B1 (en) * 2009-10-14 2014-03-25 Juniper Networks, Inc. Single address prefix allocation within computer networks
CN102497456A (zh) * 2011-12-06 2012-06-13 太仓市同维电子有限公司 基于dhcp协议实现客户端地址自动生成的系统及方法
CN108848100B (zh) * 2018-06-27 2020-10-20 清华大学 一种有状态IPv6地址生成方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101984636A (zh) * 2010-10-25 2011-03-09 华为技术有限公司 一种前缀分配方法、装置和系统
CN102340452A (zh) * 2011-10-14 2012-02-01 中兴通讯股份有限公司 一种基于单个IPv6地址前缀实现路由传输的方法和无线设备
US20140355609A1 (en) * 2013-05-31 2014-12-04 Cisco Technology, Inc Routing aggregation and prefix delegation
CN104243454A (zh) * 2014-08-28 2014-12-24 杭州华三通信技术有限公司 一种IPv6报文过滤方法和设备
CN111586197A (zh) * 2020-04-23 2020-08-25 中国信息通信研究院 一种地址前缀的再次分发方法和装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115767510A (zh) * 2022-11-16 2023-03-07 烽火通信科技股份有限公司 一种ipv6自适应组网方法、系统及PD客户端
CN115767510B (zh) * 2022-11-16 2024-05-28 烽火通信科技股份有限公司 一种ipv6自适应组网方法、系统及PD客户端

Also Published As

Publication number Publication date
CN114979075A (zh) 2022-08-30

Similar Documents

Publication Publication Date Title
US10516647B2 (en) Method for establishing data connection on mobile network, mobile network, and policy control entity
US20230023571A1 (en) Service processing method for proximity service, device, and system
KR101376829B1 (ko) Ip 주소 할당을 위한 방법 및 장치
KR20190120345A (ko) 서비스 품질 제어 방법 및 그 장치, smf, upf, ue, pcf 및 an
KR20210156310A (ko) 세션 관리 방법 및 장치
KR20170048607A (ko) 네트워크에 액세스하는 시스템 및 방법
EP3128718A1 (en) Service discovery method and electronic device
CN106576119B (zh) 向Wi-Fi客户端委派前缀的方法和设备
CN114342332B (zh) 一种通信方法、装置及系统
US20220210118A1 (en) Nat traversal method, device, and system
US20140211801A1 (en) Multiple media access control (mac) address resolution vertical travel
CN113014483A (zh) 一种多路径传输的方法及设备
JP2017005747A (ja) プリフィクスの割当て及び通知又は委任を容易にするための方法及び装置
WO2021027858A1 (zh) Rlc信道确定方法和装置
WO2019183903A1 (zh) 用于传输数据的方法和终端设备
JP2023521621A (ja) エッジネットワーク管理サーバの発見のための方法、装置、及びシステム
WO2022179410A1 (zh) 一种IPv6地址生成方法及相关装置
CN113923186A (zh) Ipv6网络通信方法、装置及系统
US20150319132A1 (en) Method, terminal, and server for providing communication service
EP2700254B1 (en) Apparatus and method for transmitting and receiving ip information in a wireless communication network
EP4145906A1 (en) Non-ip type data transmission processing method, device and apparatus, and medium
WO2017206575A1 (zh) 通信协议接入的方法、装置及系统
WO2013178164A1 (zh) IPv6域名服务器DNS地址分配、获取方法及装置
US10798054B2 (en) IP address allocation method in D2D communication and user equipment
WO2022048441A1 (zh) 应用数据的传输方法、系统及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22758775

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22758775

Country of ref document: EP

Kind code of ref document: A1