Proposal: Allow specifying a default gateway for bridge networking#9381
Proposal: Allow specifying a default gateway for bridge networking#9381icecrime merged 1 commit intomoby:masterfrom
Conversation
7f85fa9 to
90a53e0
Compare
|
Heya, this needs documenting in both |
|
Sure. I'll update the PR with the documentation. Regarding the use case, we would like to run docker container with private IP adresses, but globally routable on our internal network, instead of the default private network allocated per docker host. We have tested the following options for the daemon: --fixed-cidr=10.5.194.128/28 --ip-forward=false --ip-masq=false --iptables=false The 10.5.194.128/28 is just an example of routable IP addresses on the integration network. Everything works fine (as long as you properly configure the docker0 bridge with a physical network device child), apart from the default gateway inside the container. This gateway is hard coded to be the hosts' IP address, which doesn't make sense in this case. |
90a53e0 to
ee2af6d
Compare
|
@SvenDowideit I modified the documentation, could you please take a look ? Thanks ! |
docs/sources/articles/networking.md
Outdated
ee2af6d to
8b31563
Compare
|
@lebauce In this case, you should either be setting |
|
@cpuguy83 please allow me to chime in, as I was the one who asked @lebauce to develop this feature. I'm not sure I understand what you propose though. Our goal is:
We just need to let the containers know that the default gateway for the large network is not the address allocated to the docker bridge, which this patch does. The pros of this approach are that the IP addresses "seen" by the containers are the same as the ones "seen" from the outside, which is important for applications that gossip (such as consul or cassandra). Also, we don't need to dynamically allocate ports, since each container has it's own globally routable address. And we don't need NATing at all. If there's a way to do this using |
|
please ping me if this is closed because there is some other way to achieve it - we should document it if there is :) |
docs/man/docker.1.md
Outdated
There was a problem hiding this comment.
Should be: "... this IP address..." or simply "...this address..."
There was a problem hiding this comment.
Fixed. I also noticed that the "be" was missing.
Thanks !
8b31563 to
38d4abe
Compare
|
@SvenDowideit If there's another, existing, way to achieve what was described above, I would be happy to use it. I'm not sure if you are waiting for input from me or @cpuguy83 :) |
|
@eolamey its a note only in case, as its something we don't want to lose the documentation for - even if we need to re-write it. |
|
This is good, i think we should do this. +1 |
|
@eolamey At first I'm glad that you using |
|
@lebauce Sorry for the crazy delay here: I'm pushing this to |
|
@icecrime @LK4D4 @crosbymichael I see IPv6 was added (as requested), so I think this can be reviewed (@lebauce, correct me if you weren't ready yet) |
|
@lebauce Sorry, it needs rebase again, and I promise we'll try to be reactive on review afterwards :-( |
86fefdb to
4b4d517
Compare
|
@icecrime Rebased, ready for review :) |
There was a problem hiding this comment.
Because they only manipulate net.IP and net.IPNet, I believe this code block (covering IPv6) and the one above (covering IPv4) can entirely be factored out in a function.
Not a blocker for merge considering that there's a death timer on this file anyway.
|
Thanks! Code LGTM (some duplication for IPv4 and IPv6 can be avoided, but I'm fine merging it nevertheless). |
|
LGTM moving to docs review |
|
Docs LGTM |
docs/sources/articles/networking.md
Outdated
There was a problem hiding this comment.
you mention eth0 twice in this sentence, but if i grok it right, the first time you're talking about the eth0 in the container, and the second one refers to the default network on the host.
on quite a few of my systems, I don't have an eth0 - RHEL seems to use some obfuscated device name.
So I would suggest making the first reference be explicit: eth0 in the container and the second could be changed to the host's default gateway
There was a problem hiding this comment.
I think both are taking about what gateway will be added to the eth0 interface in the container, the one from --default-gateway-v6 if specified, fe80::1 otherwise. Actually, the second reference to eth0 comes from the existing documentation. I'm not 100% though, as I don't know the IPv6 setup at all.
There was a problem hiding this comment.
Indeed. Both mentions of 'eth0' refer to the interface of the container. Removed the second reference to "eth0" and added "in the container".
Every new container will get an IPv6 address from the defined subnet. Further
a default route will be added on `eth0` in the container via the address
specified by the daemon option `--default-gateway-v6` if present, otherwise
via `fe80::1`:
4b4d517 to
7981b60
Compare
Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
7981b60 to
acb6127
Compare
|
@icecrime I moved the common code to the "requestDefaultGateway" method. Thanks for pointing out the code duplication |
|
Cool thanks! |
Proposal: Allow specifying a default gateway for bridge networking
No description provided.