Linux Netplan Networking
-
Show running config:
rweigel@NODEBB0704:~$ netplan get network: version: 2 ethernets: ens18: addresses: - "10.73.0.168/16" nameservers: addresses: - 10.73.0.1 gateway4: 10.73.0.1 dhcp4: false
Netplans are stored under "/etc/netplan/"
rweigel@NODEBB0704:~$ ls /etc/netplan/ 00-installer-config.yaml
rweigel@NODEBB0704:~$ cat /etc/netplan/00-installer-config.yaml # This is the network config written by 'subiquity' network: ethernets: ens18: dhcp4: no addresses: - 10.73.0.168/16 gateway4: 10.73.0.1 nameservers: addresses: [10.73.0.1] version: 2
Adding a netplan:
The numbering is important for netplan processing order.nano /etc/netplan/99-mysettings.yaml
Example Config;
network: ethernets: ens18: dhcp4: false dhcp6: false addresses: - 10.73.0.168/16 - fe80::921b:eff:fe3d:abcd/64 gateway4: 10.73.0.1 nameservers: addresses: - 10.73.0.1/16 - 8.8.8.8 routes: - to: 172.16.155.0/24 via 10.73.0.1 version: 2
Permissions need to be changed so the config is not accessible by others:
chmod 600 /etc/netplan/99-mysettings.yaml
Commit Netplan changes:
netplan try --timeout 30 netplan apply
Config Examples can be found under "/usr/share/doc/netplan/examples/"
rweigel@NODEBB0704:~$ ls /usr/share/doc/netplan/examples/ bonding_router.yaml bridge.yaml direct_connect_gateway_ipv6.yaml loopback_interface.yaml offload.yaml source_routing.yaml static_multiaddress.yaml vlan.yaml wireless.yaml bonding.yaml dhcp_wired8021x.yaml direct_connect_gateway.yaml modem.yaml openvswitch.yaml sriov_vlan.yaml static_singlenic_multiip_multigateway.yaml windows_dhcp_server.yaml wpa_enterprise.yaml bridge_vlan.yaml dhcp.yaml ipv6_tunnel.yaml network_manager.yaml route_metric.yaml sriov.yaml static.yaml wireguard.yaml rweigel@NODEBB0704:~$