banner
herman

herman

哈哈哈哈哈哈哈哈哈哈哈哈哈哈

Tips for accessing devices with only V6 from devices with only V4

As we all know, if the client is only enabled with IPV4 for special reasons, and the server is only enabled with IPV6 for special reasons, they cannot access each other.

For example, I cannot access my home NAS (which only has IPV6 on mobile broadband) using my work computer (which only has IPV4 on the company network).

Solution: Use a proxy.#

The premise is that your proxy server needs to be dual-stack (usually dual-stack). You can check by opening https://ip.zxinc.org/ipquery/.

Fun fact: (provided by the great master of the world)

In a dual-stack environment, whether a program chooses to use the IPv4 or IPv6 protocol is determined by the program itself, and the DNS server does not have the ability to control which protocol the program prioritizes.

Because DNS requests need to specify the type of query, IPv4 addresses are of type A, and IPv6 addresses are of type AAAA. There is no type that can query both IPv4 and IPv6 addresses at the same time.

Therefore, the program can only query both types of addresses and then choose which one to use based on its own logic. For most programs that use the BSD socket API, they will use getaddrinfo to resolve domain names and then try to connect in order. At this time, which protocol is prioritized is controlled by the system. The protocol that getaddrinfo puts in front will be prioritized by the program for connection.

There are also some programs with special designs, such as curl and various browsers, which have other logic. For example, they will first check the IPv6 address of the local machine. If it is a private network address, they will not use IPv6. If it is a public network address, they will simultaneously resolve IPv4 and IPv6 addresses, and then prioritize connecting to IPv6. If it has not successfully connected within a short period of time (such as 1 second), it will continue to try to connect to IPv4, and finally use the connection that was established first.

1702363756657.gif

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.