Dual ipv6 / ipv4 stack on localhost

I have an ipv4 server that accepts connections only through localhost (using INADDR_LOOPBACK). I would like to convert this server to a dual ipv6 / ipv4 stack. However, use in6addr_loopbackonly allows connections to ::1.

I found that I can accept ipv4 and ipv6 connections at the same time using in6addr_any, but since this also allows connections from anywhere, this is not useful for my particular case.

Is it possible to bind localhost ( ::1) and ipv4 localhost ( 127.0.0.1) to ipv6 at the same time ?

+3
source share
2 answers

AFAIK, this is not possible.

, , INADDR_LOOPBACK in6addr_loopback. , (, , epoll ..).

, , , . in6addr_any.

  • , 127.0.0.1 :: 1, . IP- ( / , ), , .
  • IP- , IP- . , , Linux iptables. , , .
+3

, , ? ?

-3

Source: https://habr.com/ru/post/1733094/


All Articles