Low Orbit Flux Logo 2 F

Ubuntu Networking

Which does GUI write to (netplan or network manager )??????

On Ubuntu, your system will be configured to use either NetworkManager or systemd-networkd depending on whether you are on a desktop or server based system. The Netplan tool is used to generate network configurations for either systemd-networkd or Network Manager.

NetworkManager Default network manager on Ubuntu Desktop
systemd-networkd Default network manager on Ubuntu Server
Netplan Default, middleman type tool that generates configs for NetworkManager or systemd-networkd

Ubuntu Networking - Netplan

NOTE - For any configuration example here you will need to substitute your own IP info and interface names.

For more info see these other two guides we’ve created:

Ubuntu Temporary

You can temporarily bring up and configure a temporary interface. This will not last after the system reboots. See the next section if you want a more permanent configuration.

Show information about your network interfaces:


ip a
sudo lshw -class network
sudo ethtool eth4

Set an IP address, bring the link up, and set a default gateway:


sudo ip addr add 10.102.66.200/24 dev enp0s25
ip link set dev enp0s25 up
ip link set dev enp0s25 down
sudo ip route add default via 10.102.66.1
ip route show

Set your DNS servers ( 8.8.8.8 and 8.8.4.4 are Google’s public DNS servers ):

/etc/resolv.conf
nameserver 8.8.8.8 nameserver 8.8.4.4

Purge all IP info from interface:


ip addr flush eth0    

Ubuntu DHCP - Netplan

You can use the following to configure DHCP for on Ubuntu Server. Note that the renderer is set to ‘networkd’. The configuration will look similar for Ubuntu Desktop except that the renderer will be set to use the Network Manager.

/etc/netplan/99_config.yaml
network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: true

Apply the Netplan configuration which will generate the actual configuration files:


sudo netplan apply

Ubuntu Static - Netplan

You can use the following to configure a static IP. Note that on Ubuntu Server the renderer will be set to networkd while on Ubuntu Desktop it will be set to the Network Manager.

/etc/netplan/99_config.yaml
network: version: 2 renderer: networkd ethernets: enp0s25: addresses: - 192.168.0.100/24 gateway4: 192.168.0.1 nameservers: search: [mydomain, example.com] addresses: [8.8.8.8, 8.8.4.4]

You can configure host to IP mappings in the hosts file like this:

/etc/hosts
127.0.0.1 localhost 127.0.1.1 ubuntu-server 10.0.0.11 server1 server1.example.com vpn 10.0.0.12 server2 server2.example.com mail

You can configure the method your system uses to search for DNS information with this file. The methods will be tried in order.

/etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4

nsswitch values:

files first tries to resolve static hostnames located in /etc/hosts.
mdns4_minimal attempts to resolve the name using Multicast DNS.
[NOTFOUND=return] means that any response of notfound by the preceding mdns4_minimal process should be treated as authoritative and that the system should not try to continue hunting for an answer.
dns represents a legacy unicast DNS query.
mdns4 represents a Multicast DNS query.

Ubuntu Netplan Bridge

You can use the following to configure a bridge interface using Netplan on Ubuntu. This can be useful for virtualization.

/etc/netplan/99_config.yaml
network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: no bridges: br0: dhcp4: yes interfaces: - enp3s0

Ubuntu - Network Manager

If you don’t have it, you can install, start, and enable NetworkManager like this:


sudo apt-get install network-manager
sudo apt-get install network-manager-gnome
sudo systemctl start NetworkManager
sudo systemctl enable NetworkManager

/etc/NetworkManager/system-connections Saved network connections

Remove entries from here so that network manager can configure them:


sudo nano /etc/network/interfaces

Stop and disable network managers:


sudo systemctl stop NetworkManager
sudo systemctl stop NetworkManager-wait-online
sudo systemctl stop NetworkManager-dispatcher
sudo systemctl stop network-manager
sudo systemctl disable NetworkManager
sudo systemctl disable NetworkManager-wait-online
sudo systemctl disable NetworkManager-dispatcher
sudo systemctl disable network-manager

This is the static configuration for my ethernet interface. It was generated by Netplan:

/etc/NetworkManager/system-connections/Wired\ connection\ 1.nmconnection
[connection] id=Wired connection 1 uuid=3d24c352-8f76-3413-b685-a24f5a733b3f type=ethernet autoconnect-priority=-999 interface-name=eno2 permissions= [ethernet] mac-address-blacklist= [ipv4] address1=192.168.3.22/24,192.168.3.1 dns=8.8.8.8;8.8.4.4; dns-search= ignore-auto-dns=true method=manual [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto [proxy]

This is my Wifi Interface. It was configured through a GUI. They key is apparently stored separately in a keyring.

/etc/NetworkManager/system-connections/TreeFrog_2.4.nmconnection
[connection] id=TreeFrog_2.4 uuid=d3780e74-7b18-4f43-a38d-a1587ef7e3b7 type=wifi interface-name=wlo1 permissions=user:user1:; [wifi] mac-address-blacklist= mode=infrastructure ssid=TreeFrog_2.4 [wifi-security] auth-alg=open key-mgmt=wpa-psk psk-flags=1 [ipv4] dns-search= method=auto [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto [proxy]

?????? How to add WIFI PSK in Network Manager config????? ( can be stored in gnome keyring )

Network Manger WIFI Ubuntu

Password/PSK is stored in this file if the interface is for everyone. Otherwise the password/PSK is stored in gnome keyring

/etc/NetworkManager/system-connections/TreeFrog_2.4.nmconnection
[connection] id=TreeFrog_2.4 uuid=d3780e74-7b18-4f43-a38d-a1587ef7e3b7 type=wifi interface-name=wlo1 permissions=user:user1:; [wifi] mac-address-blacklist= mode=infrastructure ssid=TreeFrog_2.4 [wifi-security] auth-alg=open key-mgmt=wpa-psk psk-flags=1 [ipv4] dns-search= method=auto [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto [proxy]

References