network_configuration

Network Configuration

A bug in the iproute2 package causes the ping command to be marked as non-executable, this can be solved by running chmod +x /usr/bin/ping (which marks it as executable) as root.

There's a chance you may already be connected to your network, you can test this by using the ping utility to try and reach a host.

$ ping yiffos.gay
PING yiffos.gay (132.145.102.36): 56 data bytes 
64 bytes from 132.145.102.36: icmp_seq=0 ttl=187 time=10.645 ms 
64 bytes from 132.145.102.36: icmp_seq=1 ttl=188 time=26.950 ms 
64 bytes from 132.145.102.36: icmp_seq=2 ttl=189 time=14.249 ms 
...

Remember, computers can be configured not to respond to ICMP pings and thus no reply will be sent. In this case, you can try another URL or IP.

yiffOS does not provide the legacy iwconfig package, as a result, iw is provided and will be used instead to connect to wireless networks.

The majority of yiffOS's Linux kernel configuration is very modular, meaning drivers are available as modules on your hard drive. udev will try to automatically load any modules for any devices that you may have installed in your system.

Some wireless chipsets will also require firmware, in addition to a driver. yiffOS provides the linux-firmware package for these cases. Note that other devices may require linux-firmware to fully function (like AMD graphics cards) and some may even require linux-firmware to boot at all (like Thinkpad laptops) so you may want to install it regardless if your wireless chipset needs it or not.

If udev doesn't automatically load the module on boot, you can load it manually by running modprobe <module name>. You can find a list of wireless drivers here.

To check if the device has been loaded by a driver, you can check the output of lspci -k (if you have pciutils installed) or lsusb-v (if you have usbutils installed). You can also check the output of ip link or iw dev to see if an interface was created, wireless network interfaces will usually start with the letter “w”.

These commands require you to run them with root permissions. Running them as a user might not throw errors, but they will also not produce the correct output either.

Get the interface name

To get the name of your wireless interface, you can run iw dev:

$ iw dev
phy#0 Interface wlp3s0 ifindex 3 wdev 0x1 addr 6c:88:14:b0:e0:b8 type managed txpower 0.00 dBm

The name of the interface will be located after the the word “Interface”. In that example: it is named wlp3s0.

To check the interface link status, you can use iw dev link.

$ iw dev <interface> link
Not connected.

Activate the interface (if required)

If you get an error like Operation not possible due to RF-kill, check to see if a hardware switch isn't mistakenly set to the off position.

Your card might require the kernel interface to be activated before it can be used in iw. ip link set <interface> up

To ensure the interface is now up, run ip link show. The UP in <…,UP> indicates if the interface is up, not the later state DOWN.

$ ip link show <interface>
3: wlp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 
    link/ether 6c:88:14:b0:e0:b8 brd ff:ff:ff:ff:ff:ff

Search for access points

If this command outputs Interface does not support scanning, then you are most likely missing firmware. In some cases, this can also be caused by running iw as a regular user.

Now that the interface is up, we can scan nearby access points with iw dev scan.

$ iw dev <interface> scan
BSS XX:XX:XX:XX:XX:XX(on wlp3s0) 
	TSF: 42496384 usec (0d, 00:00:42)
	freq: 2412 
	beacon interval: 100 TUs 
	capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431) 
	signal: -74.00 dBm 
	last seen: 2950 ms ago 
... 

There'll be a lot of output but the important entries to note are:

  • SSID: The network's name
  • Signal: This will be reported in the wireless power ratio (dBm) format from -100 to 0. The closer to 0, the better the signal.
  • Security:: The network's security is not directly reported, information blocks with the names RSN and WPS may give hints as to what authentication methods the network offers.

Connect to an access point

Depending on the type of encryption used by the access point, you'll need to provide a key to connect.

  • No Encryption
    • iw dev <interface> connect “<ssid>”
  • WEP
    • Using a hexadecimal or ASCII key.
      • iw dev <interface> connect “<ssid>” key 0:<key>
    • Using a hexadecimal or ASCII key, using a specific key.
      • iw dev <interface> connect “<ssid>” key d:<key number>:<key>
  • WPA
    • You'll need the package wpa_supplicant to connect to WPA/WPA2/WPA3 networks. This command must be run in an actual root shell (sudo -i). You'll also need to reboot and then enable the wpa_supplicant systemd service systemctl enable –now wpa_supplicant.service after installing.
      • wpa_supplicant -B -i <interface> -c <(wpa_passphrase “<ssid>” “<key>”)

You'll now be able to check if you have successfully connected by using iw dev link.

Coming soon…

NetworkManager aims to make network configuration as painless and automatic as possible, originally developed by Red Hat and now maintained by GNOME, it has been in active development for over 18 years. NetworkManager can handle a large variety of connections from Ethernet to PPP and mobile broadband, with extensions for various VPN protocols.

Installation and Usage

If you're coming from systemd-networkd, make sure you delete the systemd-networkd configuration files and disable the service using systemctl disable –now systemd-networkd.service before starting NetworkManager.

Install the networkmanager package using bulge i networkmanager. Once NetworkManager is installed, you can start the daemon by running systemctl enable –now NetworkManager.service. It should automatically connect to any “available connections” (like Ethernet) upon the service starting. Networks like WiFi networks will require configuration before NetworkManager will automatically connect to it.

If NetworkManager fails to start due to a missing file called libnss3.so, you will need to install nss.

Configuration

nmtui

If NetworkManager is running, you can use the NetworkManager TUI utility by running nmtui. From nmtui you'll be able to add new connections and edit existing connections, activate and deactivate connections (including connecting to WiFi networks), and edit the system's hostname.

If you aren't using any other DNS resolver (like dnsmasq), you may want to also enable systemd-resolved, you can do this by running systemctl enable –now systemd-resolved. If you ARE, you should disable it instead by running systemctl disable –now systemd-resolved.

In order to get the network device interface name, you can run ip a to get the information for all interfaces connected to your computer. Ethernet interfaces will commonly start with the letter “e” and wireless interfaces will commonly start with the letter “w”.

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 
    inet 127.0.0.1/8 scope host lo 
        valid_lft forever preferred_lft forever 
    inet6 ::1/128 scope host 
        valid_lft forever preferred_lft forever 
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 
    link/ether 3c:97:0e:a9:27:e6 brd ff:ff:ff:ff:ff:ff 
    inet 192.168.0.102/24 metric 1024 brd 192.168.0.255 scope global dynamic enp0s25
        valid_lft 4292454283sec preferred_lft 4292454283sec 
    inet6 fe80::3e97:eff:fea9:27e6/64 scope link
        valid_lft forever preferred_lft forever 
3: wlp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 
    link/ether 6c:88:14:b0:e0:b8 brd ff:ff:ff:ff:ff:ff
DHCP Configuration

In order to configure systemd-networkd as part of an IPv4 DHCP setup, you'll need to create a basic configuration file at /etc/systemd/network/10-<interface type>-dhcp.network.

/etc/systemd/network/10-<interface type>-dhcp.network

[Match] 
Name=<interface> 

[Network] 
DHCP=ipv4 

[DHCP] 
UseDomains=true
Static IP Configuration

If you'd like to have a static IP configuration, you can create a basic configuration file at /etc/systemd/network/10-<interface type>-static.network.

/etc/systemd/network/10-<interface type>-static.network

[Match]
Name=<interface>

[Network]
Address=<preferred ip address>
Gateway=<router gateway>
DNS=<DNS server ip>
Domains=<FQDN hostname>

After creating one of two configuration files, reboot your system.

  • network_configuration.txt
  • Last modified: 2023/08/11 22:55
  • by evie