Skip to content

Enable IPv6 NAT (Cleaner commits)#2023

Closed
wrridgwa wants to merge 2 commits into
moby:masterfrom
wrridgwa:25407-natIPv6_second
Closed

Enable IPv6 NAT (Cleaner commits)#2023
wrridgwa wants to merge 2 commits into
moby:masterfrom
wrridgwa:25407-natIPv6_second

Conversation

@wrridgwa

Copy link
Copy Markdown
Contributor

This pull request addresses this open issue moby/moby#25407
Previously when IPv6 was enabled on Docker, ip6tables weren't manipulated to do Port Forwarding and IP masquerading. This PR addresses that in a way similar to the IPv4 implementation.

Relies on the following Moby PR to bring the EnableIPv6 flag through to libnetwork: moby/moby#35252

When combined with the Docker pull request, the fix can be verified after starting a container in bridge mode with port forwarding and IPv6 enabled:

Compare the iptables -t nat -L command with the ip6tables -t nat -L command
Compare iptables -t filter -L command with ip6tables -t filter -L command
Ping6 from within a running container to an outside device.

Note: This is the same as #1992 but cleaner commits.

@codecov-io

codecov-io commented Nov 28, 2017

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@f7d2133). Click here to learn what that means.
The diff coverage is 37.13%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2023   +/-   ##
=========================================
  Coverage          ?   38.83%           
=========================================
  Files             ?      137           
  Lines             ?    27552           
  Branches          ?        0           
=========================================
  Hits              ?    10700           
  Misses            ?    15537           
  Partials          ?     1315
Impacted Files Coverage Δ
drivers/bridge/setup_firewalld.go 58.82% <0%> (ø)
resolver_unix.go 18.84% <0%> (ø)
service_linux.go 3.38% <0%> (ø)
drivers/overlay/encryption.go 0% <0%> (ø)
drivers/overlay/filter.go 0% <0%> (ø)
drivers/bridge/setup_ip_forwarding.go 40.62% <33.33%> (ø)
drivers/bridge/setup_ip_tables.go 47.81% <38.05%> (ø)
drivers/bridge/bridge.go 52.42% <40.74%> (ø)
iptables/iptables.go 54.21% <54.83%> (ø)
portmapper/mapper.go 75% <57.14%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7d2133...496b9cf. Read the comment docs.

@wrridgwa wrridgwa mentioned this pull request Nov 28, 2017
@morriswinkler

Copy link
Copy Markdown

I believe that is an important PR, could someone pls have a look at it.

var (
defaultBindingIP = net.IPv4(0, 0, 0, 0)
defaultBindingIPV6 = net.ParseIP("::")
defaultBindingIPV6 = net.ParseIP("::1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change does the opposite of what the commit description says, changing the default from unspecified to localhost/loopback and not the other way around.

Comment thread drivers/bridge/bridge.go
logrus.Warn(err)
return err
}
if config.EnableIPv6 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this part has not been added to the existing setupIPForwarding function which does the same for IPv4.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have been considered/solved in #2572.

@andryyy

andryyy commented Feb 11, 2018

Copy link
Copy Markdown

Any news on this?

@wrridgwa

Copy link
Copy Markdown
Contributor Author

@andryyy I'm not sure how to put this more on the Docker radar to get this merged in. This is my first pull request with Docker/libnetwork.

@cpuguy83

Copy link
Copy Markdown
Member

ping @docker/core-libnetwork-maintainers

@wrridgwa

wrridgwa commented Mar 7, 2018

Copy link
Copy Markdown
Contributor Author

@cpuguy83 How do I ping @docker/core-libnetwork-maintainers?

@wrridgwa

Copy link
Copy Markdown
Contributor Author

@fcrisciani What is the procedure to getting a pull request looked at by Docker maintainers?

@fcrisciani

Copy link
Copy Markdown

@wrridgwa yes, thanks for the contribution and sorry if we don't have anyone yet following up on the review. The IPv6 support is definitely in the queue, but right now we don't have resources to dedicate directly to follow up. Be sure that remains in the radar, I hope to be able to come back soon on this and have a more defined plan to bring IPv6 support in parity with IPv4

@ghost

ghost commented Apr 20, 2018

Copy link
Copy Markdown

@fcrisciani please don't forget us folks not running an orchestrator! Not everyone is using docker in a huge cloud, even though I guess you're getting most of your funding by people who do...

@ctelfer

ctelfer commented Apr 20, 2018

Copy link
Copy Markdown
Contributor

Can't speak for @fcrisciani but for me, heard and very-much received. I definitely feel that IPv6 needs to be a first-class citizen. As Flavio was hinting, there are some deeper issues with IPv6 libnetwork support. These include the ways we handle preallocated networks and I suspect IPAM in general. Load balancing and port forwarding are clearly others. Hence the comment above about wanting a defined plan. Sorry for the silence thusfar.

@ghost

ghost commented Jun 19, 2018

Copy link
Copy Markdown

@ctelfer @fcrisciani what about getting this merged under some experimental option maybe? Until the other stuff you mention (load balancer etc) is figured out better.

@chris42

chris42 commented Sep 19, 2018

Copy link
Copy Markdown

Just figured, this is really needed in AWS setups. If you run docker on an IPv6 enabled EC2 instance, AWS right now only forwards traffic to that instance for single registered IPv6s.
Hence regular IPv6 with a delegated prefix is not possible. You have to activate NAT to have a sort of automatic setup and not put every IPv6 on your EC2 instance manually.

@HunterXuan

Copy link
Copy Markdown

any progress?

@wrridgwa

Copy link
Copy Markdown
Contributor Author

@HunterXuan I haven't heard anything from the Docker folks. I do need to resolve the conflicts that have been generated since this PR has been created.

@zejar

zejar commented May 27, 2019

Copy link
Copy Markdown

Any update?

@Chrislevi

Copy link
Copy Markdown

Did anyone managed to run IPv6 on docker swarm? Is it even possible? Anyone willing to share the hacks?

@kapiteined

kapiteined commented Jun 3, 2019 via email

Copy link
Copy Markdown

@Chrislevi

Copy link
Copy Markdown

As long as you don't publish ports, it works just fine. ( add "ipv6": true and fixed-cidr-v6 to /etc/docker/daemon.json ) I hope that publishing ports on the ingress network will be fixed soon too. ( issue #2293 ) Kind regards, Ed

On Sun, 2019-06-02 at 23:37 -0700, Chris Levi wrote: Did anyone managed to run IPv6 on docker swarm? Is it even possible? Anyone willing to share the hacks? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

I tried in any possible way, I hit a dead end.. my service isnt publishing but still no connectivty towards external ipv6 compononets. Asked @ moby slack channel bet yet to get any answers. would appriciate any help whatsoever. @kapiteined

@kapiteined

kapiteined commented Jun 4, 2019 via email

Copy link
Copy Markdown

@unixfox

unixfox commented Jun 4, 2019

Copy link
Copy Markdown

Maybe you could open a post on the Docker forums instead of posting in this pull request and being kinda off topic?

EDIT: And it's a known issue overlay network isn't compatible with IPv6.

@kapiteined

kapiteined commented Jun 4, 2019 via email

Copy link
Copy Markdown

@arkodg

arkodg commented Jul 11, 2019

Copy link
Copy Markdown
Contributor

@wrridgwa thanks for raising this PR , looks like @jbrunink has also raised a similar PR

We have been a little reluctant with IPv6 NAT, because IPv6 wasn't meant to be NATd, but due to limitations today such as a single IPv6 address from the cloud provider and the fact that we rely on NAT as a default firewall, I think such a feature is needed for desktop scenarios.

I'd recommend making sure that com.docker.network.bridge.enable_ip_masquerade is enabled by default for IPv4 address family and disabled by default for IPv6 family

Will start reviewing once the files have been rebased .

cc: @thaJeztah @mavenugo

@jbrunink

Copy link
Copy Markdown

Good to see some movement on this front!

I hope it is not office but I'd like to clarify that in my PR I've implemented it as such that you have both NAT and non-NAT behaviour based on the IPv6 address.

Any address allocated from the fd00::/8 (iirc) will be made a NAT rule for, anything else will just be filtered.

@HunterXuan

Copy link
Copy Markdown

What a pity that still no further progress.

@andryyy

andryyy commented May 17, 2020

Copy link
Copy Markdown

They must worry about something. It is indeed a huge change, I think.

Would be nice to hear from the team. :) I know you they are probably busy with 3189515 other things. Just curious about the downsides of adding it.

@ghost

ghost commented May 17, 2020

Copy link
Copy Markdown

I'm pretty disillusioned with docker's way of doing "collaboration" at this point. A different issue of mine for docker compose was closed even though there was obvious demand from others, even when I offered to implement it entirely myself, which was just met with dead silence. Great. Now here somebody put in all the effort where there is even more demand, and nobody appears to care. It seems like docker would rather have us use alternate runtimes that actually care about listening to developers.

Docker has to be one of the companies with the worst responses to people attempting to collaborate I have ever seen, and shame on them for it. 👎

(And yeah, I realize maybe others had a better experience. But this has been my subjective impression so far.)

@arkodg

arkodg commented May 18, 2020

Copy link
Copy Markdown
Contributor

@etc0de @andryyy @HunterXuan , would really appreciate it if you could carry forward this PR, I will sign up as a reviewer

@andryyy

andryyy commented May 18, 2020

Copy link
Copy Markdown

Nice. I wonder if we can get @wrridgwa back on the table. 😄 It's been 2 1/2 years.

@ghost

ghost commented Jun 20, 2020

Copy link
Copy Markdown

2,5 years later and this is still not default behavior. What's the hold-up?

arkodg added a commit that referenced this pull request Oct 29, 2020
@J0WI

J0WI commented Nov 25, 2020

Copy link
Copy Markdown

This has been merged in #2572.

@wrridgwa wrridgwa closed this Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.