Procházet zdrojové kódy

Merge pull request #327 from eyakubovich/outer-masq

Masquerade host to flannel traffic.
Eugene Yakubovich před 9 roky
rodič
revize
a5e1177ea8
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      network/ipmasq.go

+ 3 - 1
network/ipmasq.go

@@ -40,8 +40,10 @@ func setupIPMasq(ipn ip.IP4Net) error {
 		{"FLANNEL", "-d", ipn.String(), "-j", "ACCEPT"},
 		// NAT if it's not multicast traffic
 		{"FLANNEL", "!", "-d", "224.0.0.0/4", "-j", "MASQUERADE"},
-		// This rule will take everything coming from overlay and sent it to FLANNEL chain
+		// This rule will take everything coming from overlay and send it to FLANNEL chain
 		{"POSTROUTING", "-s", ipn.String(), "-j", "FLANNEL"},
+		// Masquerade anything headed towards flannel from the host
+		{"POSTROUTING", "!", "-s", ipn.String(), "-d", ipn.String(), "-j", "MASQUERADE"},
 	}
 
 	for _, rule := range rules {