Menu

How to use Python and netplan to configure static IP addresses
πŸ“°

How to use Python and netplan to configure static IP addresses

DEV Community: opensourceΒ·Kim JarvisΒ·1 day ago
#PNX2NZXk
#devtoopensource#devto#dev#netplan#reemote
Long article (8017 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Netplan is the network configuration layer Ubuntu and several other distributions ship by default. Its state is a handful of YAML files under /etc/netplan : each file describes devices β€” Ethernet links, Wi-Fi interfaces, VLANs, bridges, bonds β€” with addresses, routes, name servers and DHCP behaviour. A generator merges those files and hands the result to systemd-networkd or to NetworkManager, and the netplan command line exposes the merge ( netplan get ), the render ( netplan generate ), the activation ( netplan apply ) and a self-reverting variant of it ( netplan try ).

Reemote is a pure-Python configuration-management library. Instead of a domain-specific language, you write an ordinary Python generator that yields operations against a host, gather typed facts from the target, and await a two-phase run that previews the whole plan before it changes anything. The netplan module is written in that spirit: it owns the drop-in files and the netplan CLI calls, and nothing else.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.