Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IPVS for nating instead of iptables #1379

Closed
wants to merge 1 commit into from

Conversation

cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Aug 5, 2016

Using iptables for setting up nat rules has a nasty tendancy to conflict
with user-defined firewall rules, and tend to be invisible to tools like
UFW.
Meanwhile using ipvs for nat is fairly natural and does not require
mucking around in iptables rules.

The one thing we do need to continue using iptables for here is nating
against localhost, however this shouldn't intefere with user-defined
rules unless they are denying localhost (not likely)... and still much
better than having public interfaces here.

Fixes (after re-vendor) moby/moby#4737
Fixes (after re-vendor) moby/moby#22054
Closes #852

Signed-off-by: Brian Goff cpuguy83@gmail.com

@cpuguy83 cpuguy83 force-pushed the use_ipvs_not_iptables_nat branch 2 times, most recently from 08e99f6 to 96e608e Compare August 9, 2016 14:05
@cpuguy83
Copy link
Member Author

cpuguy83 commented Aug 9, 2016

@aboch How come this would fail on iptables --wait when trying to inject the DOCKER jump rule into PREROUTING?

@aboch
Copy link
Contributor

aboch commented Aug 13, 2016

@cpuguy83 The test has recently become flacky, we are aware of it. Will invest sometime to fix it after release.
My guess is that it cannot find the DOCKER chain becasue it is somehow executing on a different netns.

}
} else if Exists(Mangle, "PREROUTING", preroute...) && !enable {
if err := c.Prerouting(Mangle, Delete, preroute...); err != nil {
return fmt.Errorf("Failed to remove docker in PREROUTING nat chain: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nat -> mangle

@cpuguy83 cpuguy83 force-pushed the use_ipvs_not_iptables_nat branch 2 times, most recently from 770ac2c to 6bcf354 Compare November 5, 2016 18:55
Using iptables for setting up nat rules has a nasty tendancy to conflict
with user-defined firewall rules, and tend to be invisible to tools like
UFW.
Meanwhile using ipvs for nat is fairly natural and does not require
mucking around in iptables rules.

The one thing we do need to continue using iptables for here is nating
against localhost, however this shouldn't intefere with user-defined
rules unless they are denying localhost (not likely)... and still much
better than having public interfaces here.

Fixes (after re-vendor) moby/moby#4737
Fixes (after re-vendor)  moby/moby#22054

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@donnex
Copy link

donnex commented Mar 27, 2017

What is the current status of this issue?

I'm currently using a work around and inject my own iptables chain before the docker rules in order to firewall my traffic. This requires me to run a manual script every time the Docker engine is restarted or the machine is rebooted.

My understanding is that this issue fixes this? Maybe there is another way to deal with it currently?

@cpuguy83
Copy link
Member Author

@donnex There's some edge cases not dealt with here. It's also a pretty big change to how Docker handles port forwards which may break existing users.

I'm going to close this, but I think there's another solution to the issue you mentioned.

@cpuguy83 cpuguy83 closed this Mar 28, 2017
@cpuguy83 cpuguy83 deleted the use_ipvs_not_iptables_nat branch March 28, 2017 16:56
@donnex
Copy link

donnex commented Mar 29, 2017

@cpuguy83 Do you have any more information about a viable solution to my problem? I need to firewall traffic to my containers (exposed ports) and limit access by remote IP. I haven't found any solution other than my work-around with injecting firewall rules before the Docker chain.

@cpuguy83
Copy link
Member Author

I think the solution will be providing a way to inject rules before the docker chain.

@aboch
Copy link
Contributor

aboch commented Mar 29, 2017

I think the solution will be providing a way to inject rules before the docker chain.

Agree, similar to what #1675 does for the filter table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants