Networking problems with custom container templates

spiritlhl

New Member
Apr 4, 2023
11
2
3
From https://www.reddit.com/r/homelab/comments/5xvfbf/how_to_proxmox_modify_a_ct_container_template/

This method is really fine for the first time, but it will be problematic in the long run because if I execute the reboot command inside the container, it will cause the container's network configuration to go to the container's default configuration before packaging instead of going to the PVE configuration, which will result in an intranet IP change.

I'm executing.

```
pct set CTID --delete net0
```

to delete the corresponding network configuration, but this doesn't seem to work.
For example, the container I'm using is a debian11 system, and after deletion there is still legacy configuration in /etc/network/interfaces within the container.
1708162168243.png


At this point I'm not sure how to fix it, it seems that I'm using the pct command to create and enter containers to modify templates causes certain one-time settings to no longer be enforced. My modified zst container file is no longer containerized to configure the network again.

Is there any command/method to force the network configuration file inside the container (in debian containers it's the /etc/network/interfaces file) to be synchronized with the configuration outside the container (the container network configuration as seen in pve's web)?
 
One idea for a solution, I'll have to recreate my container template, it seems that because I used eth0 as the net0 name in the first configuration, and the second time I imported the modified container file still using eth0 as the net0 name, the network configuration inside the container won't be refreshed automatically, I need to change the name of the net0 in the first configuration not to use eth0 in order to avoid the network not to be reloaded.
 
Troubleshooting reveals

pct exec $CTID -- touch /etc/network/.pve-ignore.interfaces

is not required, and after reboot, it will cause IPV4 changes on the intranet because of the residual files.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!