Configure container to have the same IP address as the host

I am deploying a honeypot (Ubuntu 18.04) using LXD containers (Ubuntu 18.04, too).
I have the honeypot server at 192.168.1.22/24, which runs lxd container that provides SSH service.
I have configured it so that host’s tcp:22 traffic will be forwarded to the container’s tcp:22, where the SSH service runs.
It works just fine so far, however, to emulate the host as much as possible, I want ‘ifconfig/ip address’ command inside the container to return 192.168.1.22/24 (same as the actual host) as the configured IP address, while maintain functional network access (it needs to provide valid SSH service after all).
I have tried to hook up the container with the lxdbr0 bridge, and manipulating the lxdbr0 does not yield the desired result.
I thought this was possible by having the container at 192.168.1.22/24, then traffic from container will be NAT’d by lxdbr0, which then gets out from the host’s NIC. However, I have not been able to

  1. configure the lxdbr0 to have, say 192.168.2.2/24, and configure the container to have 192.168.1.22/24, because after I set lxdbr0 to 192.168.2.2/24, the container always keep 192.168.2.x/24 address. I wasn’t able to overwrite it.
  2. configure static nat on lxdbr0. I have not figured out how to do that at all.
    Any help is appreciated!

Hi!

I supposed you want the container the have some seemingly normal network settings but those would not work or are bogus. My first suggestion would be to do something like https://blog.simos.info/a-network-isolated-container-in-lxd/

If you really want the container to have the IP address of the host, you probably should use nested containers so that the inner container gets an IP address that happens to be that of the host. Here I would suggest to first create a LXD VM, then inside make nested LXD containers.

Out of interest what is the aim with emulating the host’s IP inside the container, what does that achieve?