Hi,
I have been trying to make a proxy device which is optimised proxying via NAT from the manual:
https://lxd.readthedocs.io/en/latest/containers/#type-proxy
snap 3.17
ubuntu 18.04 host
convert the DHCP assigned IP address to a static address
lxc config device override c1copy eth0 ipv4.address=10.250.231.11
add a device for NAT (ip address chnaged)
lxc config device add c1copy c1copyProxy proxy listen=tcp:IPaddress:7777 connect=tcp:10.250.231.11:5432 nat=true
device added, good.
lxc config device show c1copy:
c1copyProxy:
connect: tcp:10.250.231.11:5432
listen: tcp:IPaddress:7777
nat: “true”
type: proxy
and iptables -t nat -L shows lines added.
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp – anywhere (FQDN) tcp dpt:7777 /* generated for LXD container c1copy (c1copyProxy) */ to:10.250.231.11:5432
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DNAT tcp – anywhere (hostname) tcp dpt:7777 /* generated for LXD container c1copy (c1copyProxy) */ to:10.250.231.11:5432
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all – 10.250.231.0/24 !10.250.231.0/24 /* generated for LXD network lxdbr0 */
but ss-ltr shows no port 7777 listening and a full nmap scan shows no open port
lxc list c1copy
±-------±--------±---------------------±-----±-----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-------±--------±---------------------±-----±-----------±----------+
| c1copy | RUNNING | 10.250.231.11 (eth0) | | PERSISTENT | 863 |
±-------±--------±---------------------±-----±-----------±----------+`
But worse still left in this state soon the whole ip stack will go wrong: example; all file mounts break and then only pings to “some ip address”- one core router but not the other!, Name service resolution fails, SSH etc…
to fix this:
Ip l s ens160 down && ip link set ens160 up
restores the all the connections until about 3-4 hours? then it will go wrong again. Removing the c1copyProxy removes the networking failure from happening.
Am i doing this right? what do you need to help trouble shoot this?
Thankyou.