pkg/mesh: enable outgoing NAT to WAN

This commit enables NAT-ing packets outgoing to the WAN from both the
Pod subnet as well as from peers. This means that Pods can access the
Internet and that peers can use the Kilo mesh as a gateway to the
Internet.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
Lucas Servén Marín
2020-03-09 18:42:42 +01:00
parent 8908cf19cb
commit 7051b9fe29
3 changed files with 30 additions and 16 deletions

View File

@@ -273,21 +273,6 @@ func (c *Controller) CleanUp() error {
return c.deleteFromIndex(0, &c.rules)
}
// ForwardRules returns a set of iptables rules that are necessary
// when traffic must be forwarded for the overlay.
func ForwardRules(subnets ...*net.IPNet) []Rule {
var rules []Rule
for _, subnet := range subnets {
s := subnet.String()
rules = append(rules, []Rule{
// Forward traffic to and from the overlay.
&rule{"filter", "FORWARD", []string{"-s", s, "-j", "ACCEPT"}},
&rule{"filter", "FORWARD", []string{"-d", s, "-j", "ACCEPT"}},
}...)
}
return rules
}
func nonBlockingSend(errors chan<- error, err error) {
select {
case errors <- err: