I want to setup two containers (each with a static IP address) so that they can be used as a standard VPS. I am using Ubuntu 18.04 on host and for containers. Let’s say static IPs are: 22.214.171.124 and 126.96.36.199. On host I run:
“lxc network set lxdbr0 ipv4.routes 188.8.131.52/32, 184.108.40.206/32”
I disabled netplan by running “sudo apt install ifupdown”.
Inside each container I setup networking in /etc/network/interfaces like this:
iface eth0 inet dhcp
post-up ip -4 addr add dev eth0 220.127.116.11/32 preferred_lft 0
Result: Internet is working inside containers. I can connect to IP of containers from outside. The problem is that when a container connect to the internet, IP address of the host is used instead of IP of the container. How do I fix this? I want the container to use its own IP address when connecting outside.