Changing -o interface for SDN SNAT

dodobrow

New Member
Jun 21, 2024
1
0
1
Hi,

As visible below, when setting SNAT for a simple network type:

iface cu1vn
address 10.1.1.1/24
post-up iptables -t nat -A POSTROUTING -s '10.1.1.0/24' -o enp43s0.709 -j SNAT --to-source PUBLIC_IP
post-down iptables -t nat -D POSTROUTING -s '10.1.1.0/24' -o enp43s0.709 -j SNAT --to-source PUBLIC_IP
post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
bridge_ports none
bridge_stp off
bridge_fd 0
ip-forward on


-o interface is set automatically.


/etc/network/interfaces.d/sdn is populated automatically each time network daemon is reloaded


Is it possible to set it to a loopback interface?



Kind Regards,
Dominik
 
Last edited:
This is currently not possible, since it uses the default route for picking the interface for SNAT. You would have to create those rules manually instead with your desired interface.