Configure SDN NAT Internet Gateway Server - UpCloud
10 Jan 2022 #linuxFor this to work, disable “source IP filtering” on the private (SDN) interface of the gateway machine.

1. Gateway machine
Useful packages
apt update && apt install iptables net-toolsIP forwarding
echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf
sysctl -pNAT rule (replace with your private subnet)
ip route
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADEPersist rules
apt install iptables-persistent
#iptables-save > /etc/iptables/rules.v42. Backend machine
Routes (replace IPs with yours)
ip route
ip route add 169.254.169.254 via 192.168.1.1 dev eth0;
ip route replace default via 192.168.1.2Make persistent
Edit /etc/network/interfaces (or use netplan on newer Debian):
auto eth0
iface eth0 inet static
address 192.168.1.3
gateway 192.168.1.2