diff --git a/pkg/exchange/controller.go b/pkg/exchange/controller.go index 0cc3cb7d..f301fb20 100644 --- a/pkg/exchange/controller.go +++ b/pkg/exchange/controller.go @@ -49,8 +49,8 @@ sysctl net.ipv4.ip_forward=1 sysctl -w net.ipv4.conf.all.route_localnet=1 update-alternatives --set iptables /usr/sbin/iptables-legacy iptables -F -iptables -P INPUT ACCEPT || true -iptables -P FORWARD ACCEPT || true +iptables -P INPUT ACCEPT +iptables -P FORWARD ACCEPT iptables -t nat -A PREROUTING ! -p icmp -j DNAT --to $(LocalTunIP) iptables -t nat -A POSTROUTING ! -p icmp -j MASQUERADE iptables -t nat -A OUTPUT -o lo ! -p icmp -j DNAT --to-destination $(LocalTunIP) diff --git a/pkg/handler/remote.go b/pkg/handler/remote.go index cd0a334d..72f22bd7 100644 --- a/pkg/handler/remote.go +++ b/pkg/handler/remote.go @@ -126,8 +126,8 @@ func CreateOutboundPod(clientset *kubernetes.Clientset, namespace string, traffi sysctl net.ipv4.ip_forward=1 update-alternatives --set iptables /usr/sbin/iptables-legacy iptables -F -iptables -P INPUT ACCEPT || true -iptables -P FORWARD ACCEPT || true +iptables -P INPUT ACCEPT +iptables -P FORWARD ACCEPT iptables -t nat -A POSTROUTING -s ${CIDR} -o eth0 -j MASQUERADE kubevpn serve -L tcp://:10800 -L tun://:8422?net=${TrafficManagerIP} --debug=true`, },