[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (web server) serving on both ipv6 and ipv4?
From: |
Dr. Arne Babenhauserheide |
Subject: |
Re: (web server) serving on both ipv6 and ipv4? |
Date: |
Wed, 19 Jan 2022 22:42:16 +0100 |
User-agent: |
mu4e 1.6.10; emacs 27.2 |
Chris Vine <vine35792468@gmail.com> writes:
> On Wed, 19 Jan 2022 13:44:13 +0000
> Chris Vine <vine35792468@gmail.com> wrote:
>> On Wed, 19 Jan 2022 13:07:33 +0000
>> Chris Vine <vine35792468@gmail.com> wrote:
>> [snip]
>> > As I understand it, with linux IPv6 sockets are dual stack capable, and
>> > in earlier kernel versions this was be enabled by default. I believe
>> > with current versions that is no longer the case, and that you have to
>> > specifically enable dual stack by turning off IPV6_V6ONLY using
>> > setsockopt before binding on the socket.
>> >
>> > Then, if receiving a IPv4 connection from address 1.2.3.4, this would be
>> > mapped as ::::ffff:1.2.3.4.
>> >
>> > I do not know about other OSes. I have half a memory that some earlier
>> > versions of windows did not support dual stack sockets (XP?).
>>
>> By the way I did use dual stack some years ago, and I cannot now
>> remember all the details, but I think I may have had to bind on
>> in6addr_any (which in dual stack would cover INADDR_ANY) or on ::1
>> (which would cover 127.0.0.1) to get dual stack to work. I suggest you
>> play around with it to see.
>>
>> One other correction: when I said there was a mapping to ::::ffff:
>> 1.2.3.4 I meant ::ffff:1.2.3.4.
>
> You have stimulated my interest and this is what I have found. First,
> in C the correct call in linux to do what you want to obtain a dual
> stack socket is to set the IPV6_V6ONLY option in the IPPROTO_IPV6 level
> to 0 (off). However neither IPV6_V6ONLY nor IPPROTO_IPV6 is defined in
> guile, so you have to enter the numeric values for your OS by hand. In
> linux this will do it in guile, but of course it is non-portable:
>
> (setsockopt [sock] 41 26 0)
>
> However, this only actually seems to accept a connection from a IPv4
> address if the socket binds to :: (which is in6addr_any, but
> the in6addr_any symbol also appears not to be defined in guile).
> Binding to ::1 (localhost) will not enable you to connect from
> 127.0.0.1 on my computer. Whether binding to :: and so permitting any
> interface to access the socket is OK for you depends on what your needs
> are. If not then it looks as if you are stuck with having two sockets,
> one for IPv4 and one for IPv6.
Thank you for all your info! I seem to have working ipv4 and ipv6 access
now!
I found that IPV6_V6EONLY is off by default in my system
cat /proc/sys/net/ipv6/bindv6only
But I’m now setting it anyway, because that default might change.
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de
signature.asc
Description: PGP signature