change IP for Container don't work

snboris

Member
Dec 19, 2021
14
0
6
57
Hello everyone...

I have created a second container from the backup of a container (which has the fixed IP 192.168.178.212).

I gave it the fixed IP 192.168.178.213 (192.168.178.213/24) in the settings (Network).

Then started it. (I stopped the one with 212 beforehand)
When I go to the console of the new container, an ip addr still shows me 192.168.178.212.
Why is that?
Even removing the Nic in the network settings and creating a new one (where a new MAC is generated) did not help.


1734710187632.png

The container can also only be pinged with the 212 or addressed from outside.



What am I doing wrong?

Where is the IP still stored?



(the 213 is not yet assigned in the Fritzbox)
 
Last edited:
Like I said in the German thread. Check whats the current IP of the container within the OS:

Bash:
ip -c -br a

If this is still the case, which likely is since you're able to ping it on 212, you have to do a new DHCP request. You can try to use the dhclient command.
 
i think, i found a solution:

is search for the (wrong) ip with grep -rl "192.168.178.212" / and found the file /etc/netplan/00-my-network.yaml
i change this with new IP, reboot.. an voila
 
Ah, nice! Your container is using netplan? IIRC my Ubuntu images do not.

But yeah, if you have issues with IP related issues, its always a good practice to check /etc/netplan/*.