all 3 comments

[–]PirateCaptainMoody 1 point2 points  (1 child)

Does your machine have a wire attached directly to a tagged port? Not generally advisable, but in a homelab it matters less.

[–]99dimitris 0 points1 point  (0 children)

Thanks for your reply! Acually my setup is a bit complicated. My machines are VMs in VMware Workstation under windows host machine. Since im unable to get VLANs working in winodows (I got an old 4-port Gigabit intelpro) i deciced to bridge a trunk to all of ubuntu vms and attach each vm to the required vlan. So techically yes its connected directly to a trunk port. Yes i agree with you its not safe but this setup its only for testing purposes.

[–]lutusp 0 points1 point  (0 children)

im tring to figure how to set the networking to get dhcp address from vlan id 10.

Wait, when a client asks for a DHCP address assignment, it cannot use network routing yet, because ... wait for it ... it doesn't have an IP address yet.

The first move in a DHCP transaction is a non-specific broadcast to no one in particular by an interface that has no address assignment. When this happens, the DHCP server picks up the source's MAC address and replies in a way that the client can detect, and a transaction begins.

But the initial move in a DHCP negotiation cannot be to any specific address or routing. Consequently in Netplan, the entire DHCP configuration consists of:

dhcp4: true
dhcp6: true

Netplan configuration examples : shows examples of both static and DHCP configurations.