From Mageia wiki
Jump to: navigation, search


Notepad.png
Please note!
This document, for Magaia version 6, contains some configuration that is not default for Mageia and can break your network

This document discusses the default network configuration of Mageia 6 more in detail, with a strong focus on wired network interfaces.

This document contains some advanced configuration, and in not meant for beginners.

Network Interface Names

Before going into the configuration, it's important to know more about the names of the network interfaces.

To identify the available network interfaces, execute the command:

ls /sys/class/net

or

ip link show

or

networkctl list

The naming of the interfaces is described in the Predictable Network Interface Names scheme. For more information visit:

The kernel is responsible for recognizing hardware, after that it will hand it over to systemd-udev and this process loads the necessary driver and names the network interface.
The following command will give you all the details:

udevadm info /sys/class/net/<device name>

The ip command

The ip command can give you more information about the device:

ip -d link show <device name>

And about the ip address that is configured on the interface:

ip address show dev <device name>

And shows the default gateway:

ip route show 0.0.0.0/0 

You can do many other things with the ip command, such as assigning an ip address to a network interface, add/change routes etc. But everything you'll do is not persistent across reboots.

That's why you need a Network Manager such as NetworkManager or systemd-networkd. Mageia 6 is using systemd-networkd by default.

network service

The network service is used to configure your network. If you configure your network via the Mageia Control Center, the configuration is saved in a /etc/sysconfig/network-scripts/ifcfg-<device name> file. These configuration files are parsed at boot-time via the network service (/etc/rc.d/init.d/network).

As an example of the content:

DEVICE=enp3s0f1
BOOTPROTO=dhcp
ONBOOT=yes

In the example above, the device name is enp3s0f1.

If you know what you are doing, you can also manually make changes in this file, or even create your own configuration files.

The good news about this configuration is that it is compatible with NetworkManager, just add:

NM_CONTROLLED=yes

However the network service is not very flexible and sometimes hard to configure in more complex environments.

systemd-networkd

You can also use another approach, using systemd-networkd configuration files.

Please note that this is not the Mageia standard configuration, but it will give you more options and flexibility.

The daemon is started by default. Check the status:

systemctl status systemd-networkd

Create the directory for systemd-networkd configuration files:

/bin/su -c "mkdir /etc/systemd/network"

And create a .network file, e.g. home.network.

[Match]
Name = enp3s0f1

[Network]
Description = Home Network
DHCP = yes

For more examples see: man 5 systemd.network. In my example, the interface name is enp3s0f1. Let's remove the old configuration:

/bin/su -c "rm /etc/sysconfig/network-scripts/ifcfg-enp3s0f1"

Restart systemd-networkd:

systemctl restart systemd-networkd

If you migrated everything (!) to systemd-networkd you can stop using the network service:

systemctl stop network
systemctl disable network
systemctl mask network
systemctl stop network-up
systemctl disable network-up

But: Use this option only if you really need the flexibility or you want to get more knowledge about systemd!!!

DNS

The network service updates /etc/resolv.conf. That file configures the nameserver for resolving and your search domain.

You can use the nslookup, dig or host utility to verify the resolving.

If you disabled the network service, you'll need to configure systemd-resolved.

The configuration is easy, if you don't receive the nameservers via DHCP, add a

DNS=

entry to the .network file

To use systemd-resolved, create a symbolic link:

/bin/su -c "ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf"

The service itself is started by default, check the status:

systemctl status systemd-resolved.service

Hostname

You can configure the hostname during the installation of Mageia. It will write the configuration to the file /etc/hostname

Alternatively you can use the hostname command.

First check the current name:

hostnamectl status

And change it with:

/bin/su -c "hostnamectl set-hostname <full qualified hostname>"

As an alternative, manahost is available, which is part of the manatools package.