Route all traffic from one container to diffrent container

Hi,

Is it possible to route/send all traffic from one container to another container? I would like to direct all traffic from the container “cloudflare” to the container “proxy”. The container “cloudflare” has Cloudflare tunnel running on it and I need it to send all traffic to the proxy server on “proxy” container. I assume this is possible NAT?

lxc list

+------------+---------+----------------------+------+-----------+-----------+
|    NAME    |  STATE  |         IPV4         | IPV6 |   TYPE    | SNAPSHOTS |
+------------+---------+----------------------+------+-----------+-----------+
| cloudflare | RUNNING | 10.233.48.175 (eth0) |      | CONTAINER | 0         |
+------------+---------+----------------------+------+-----------+-----------+
| proxy      | RUNNING | 10.233.48.76 (eth0)  |      | CONTAINER | 0         |
+------------+---------+----------------------+------+-----------+-----------+

lxc network info lxdbr0

Name: lxdbr0
MAC address: 00:16:3e:8a:2a:9e
MTU: 1500
State: up

Ips:
    inet  10.233.48.1
    inet6 fe80::216:3eff:fe8a:2a9e

lxc network info eth0

Name: eth0
MAC address: dc:a6:32:f5:3e:9a
MTU: 1500
State: up

Ips:
   inet  192.168.1.192
   inet6 fe80::dea6:32ff:fef5:3e9a

So TLDR send all tarfic from: 10.233.48.175 to 10.233.48.175

Thanks for your help…

I think you have a typo in your last line as the IPs are the same.

Do you mean you want to use the cloudflare container as the default gateway for the proxy container?

If so you could do this inside proxy:

ip r add default via 10.233.48.175 dev eth0

Then you would need to ensure IP forwarding is enabled inside the cloudflare container so it behaves as a router.

Dear @tomp and @bxdavies

It’s a personal thought, wouldn’t you find the answer through multicast?

Thank you.