# NetworkManager # (August 2017) NetworkManager is a linux daemon that tries (with mixed success) to ease the configuration of network interfaces. ## Background ## In the past, NetworkManager had reliability problems, and failed to work well with bridges. As of 2017, NetworkManager may finally be safe to use. There's no compelling reason to switch to NetworkManager (except, possibly, for laptops), but there's no longer a strong reason to switch away from NetworkManager if it's already the system default. NetworkManager does not currently support some advanced features (e.g. network namespaces). Without NetworkManager, network configuration happens in manually edited config files, which are read by shell scripts. On RHEL6, for example, these included the files in `/etc/sysconfig/network-scripts/`, such as `ifcfg-eth0`, along with files like: - `/etc/hosts` to resolve names that won't get the desired answer from DNS - `/etc/resolv.conf` to set the IP address of the DNS server and the search domain - `/etc/sysconfig/network` sets global host and routing info for all interfaces See `/usr/share/doc/initscripts-*/sysconfig.txt`. Debian is similar, but interfaces are configured in the `/etc/network/interfaces` file instead of `/etc/sysconfig/network-scripts/`. See INTERFACES(5). ## NetworkManager ## NetworkManager setting are bundled in "connection profiles". One network device might be configured with a different connection profile depending on circumstances (e.g. a "work" or "home" profile). A connection profile includes numerous key/value settings, as described in NM-SETTINGS(5). NetworkManager stores its config in `/etc/NetworkManager/system-connections/`, but these files are not intended to be directly edited. Edit network connections with one of these tools: - nm-connection-editor (X11) - nmtui (curses) - nmcli, see `nmcli --help`, NMCLI(1), and NMCLI-EXAMPLES(7). See NETWORKMANAGER(8), NM-SETTINGS(5), and NETWORKMANAGER.CONF(5). ### Creating a Bridge with NetworkManger ### ``` # systemctl enable NetworkManager # systemctl start NetworkManager # nmcli connection show NAME UUID TYPE DEVICE Wired connection 1 7e5d9f48-5e60-4030-968e-946c67902528 802-3-ethernet enp0s31f6 # nmcli connection down 'Wired connection 1' # nmcli connection add type bridge ifname br0 # nmcli connection add type bridge-slave ifname enp0s31f6 master br0 # nmcli connection show bridge-br0 # nmcli connection modify bridge-br0 bridge.stp no # nmcli connection modify bridge-br0 ipv4.addresses 10.0.0.76/24 # nmcli connection modify bridge-br0 ipv4.gateway 10.0.0.1 # nmcli connection modify bridge-br0 ipv4.dns 10.0.0.1 +ipv4.dns 10.0.0.2 # nmcli connection modify bridge-br0 ipv4.method manual # nmcli connection modify bridge-br0 ipv4.dns-search example.com # systemctl restart NetworkManager ``` ## Links ## - https://paulgorman.org/technical/linux-redhat.txt - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Network_Interfaces.html - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-control.html - https://wiki.debian.org/NetworkConfiguration