router.tf changes

Summary of the changes made to router.tf so that container 106 (k8s-router) acts as the NAT gateway for the isolated vmbr1 network and serves DHCP on eth1.

Requirements

Background

The Ubuntu 26.04 LXC template does not honour Proxmox’s static ip_config (there is no ifupdown, and the template’s netplan / systemd-networkd never reads it). The container therefore configures its own addresses with ip commands at every boot.

Also note: the bpg Proxmox provider applies an entrypoint change to an existing container in place, but entrypoint files are only written when the container is created. Changes to the entrypoint scripts/units therefore require a recreate:

tof--urteaaprplgpaelctye==p-prrroeoxfxmrmoeoxsx_h_v=vifirartltusuaeall_-_eaenunvtvioir-roaonpnmpmerenontvt_e_cco\onnttaaiinneerr..rroouutteerr\

Changes made

1. Container definition

2. Static network bootstrap — k8s-router-net.service

New one-shot unit (script staged by the entrypoint, run on every boot):

3. NAT + DHCP — k8s-router.service

One-shot unit that runs after the network is up:

4. Entrypoint

Writes and enables the two scripts and units:

Verification (live)

Router 106, GET /nodes/proxmox/lxc/106/interfaces:

eetthh0111902..1106.85.00..12/5204/24

DHCP lease from a scratch client on vmbr1:

rLDoEHuRRACnESSPdQPE_U_C1EmAL:SsCITgKEr_t=NeSy1TpEp0_lNe.DyT=1O50Nf1.Er0l5o.e0lm1a.e0s1a.e2s'5=3e101d0.0=.1.T121r030u..e5500r..o11u'2n,3ds6s=7e1)rveyeliraa=pd1sd0er.d=1=1030.s.5100..150.123msgtype=2(A(COKF)FER)

NAT from the same client: NAT_TCP_OK (TCP to 1.1.1.1:80 via masquerade).

Idempotency: tofu plan -refresh=false -target=proxmox_virtual_environment_container.router reports No changes.

Root cause of the “DHCP not answering” symptom

The router was correct from the start. The scratch test client built its BOOTP header with struct.pack('!BBBBIHHH', ...) — an extra H inserted 2 bytes and shifted the DHCP magic cookie to offset 238 and the client MAC by one byte. dnsmasq parsed those packets as BOOTP and ignored them:

ddnnssmmaassqq--ddhhccpp::tBaOgOsT:P(beotoht1p),0e0t:h010:02:00:00:00noaddressconfigured

Fixing the client header to '!BBBBIHH' produced an immediate full lease.

Cleanup

Note

Container 101 k8s-router (stopped) is an orphan duplicate of this router created before vm_id = 106 was pinned. It is not tracked by the current state and was left untouched.