network_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
network_configuration [2023/02/21 07:19] evienetwork_configuration [2023/08/11 22:55] (current) – Move to bootnote evie
Line 1: Line 1:
 +====== Network Configuration ======
 +
 ===== Checking the connection =====  ===== Checking the connection ===== 
-**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.**+<bootnote warning> 
 +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. 
 +</bootnote> 
  
 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.  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. 
  
 <code> <code>
 +$ ping yiffos.gay
 PING yiffos.gay (132.145.102.36): 56 data bytes  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=0 ttl=187 time=10.645 ms 
Line 14: Line 20:
  
 ===== Wireless networking =====  ===== Wireless networking ===== 
-//yiffOS does not provide the legacy ''iwconfig'' package, as a result, ''iw'' is provided and will be used instead to connect to wireless networks./+<bootnote> 
 +yiffOS does not provide the legacy ''iwconfig'' package, as a result, ''iw'' is provided and will be used instead to connect to wireless networks. 
 +</bootnote> 
 + 
  
 ==== Device driver/firmware ====  ==== Device driver/firmware ==== 
Line 21: Line 30:
 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.  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 {{ic|modprobe <module name>}}. You can find a list of wireless drivers [[https://wireless.wiki.kernel.org/en/users/drivers|here]].+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 [[https://wireless.wiki.kernel.org/en/users/drivers|here]].
  
 ==== Checking device status ====  ==== Checking device status ==== 
Line 27: Line 36:
  
 ==== Connecting to a wireless network ====  ==== Connecting to a wireless network ==== 
-//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./+<bootnote> 
 +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. 
 +</bootnote> 
 + 
  
 === Get the interface name === === Get the interface name ===
Line 35: Line 47:
 phy#0 Interface wlp3s0 ifindex 3 wdev 0x1 addr 6c:88:14:b0:e0:b8 type managed txpower 0.00 dBm phy#0 Interface wlp3s0 ifindex 3 wdev 0x1 addr 6c:88:14:b0:e0:b8 type managed txpower 0.00 dBm
 </code>  </code> 
-The name of the interface will be located after the the word "Interface". In that example: it is named {{ic|wlp3s0}}==== Get the link status ===To check the interface link status, you can use {{ic|iw dev link}}{{hc|$ iw dev <interface> link|2= Not connected. }} ==== Activate the interface (if required) ==== {{Note|If you get an error like {{ic|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. {{ic|ip link set <interface> up}} To ensure the interface is now up, run {{ic|ip link show}}. The {{ic|UP}} in {{ic|<...,UP>}} indicates if the interface is up, not the later {{ic|state DOWN}}{{hc|$ ip link show <interface>|2= 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 ==== {{Note|If this command outputs {{ic|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 {{ic|iw dev scan}}{{hc|$ iw dev <interface> scan|2= 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 {{ic|RSN}} and {{ic|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''' ** {{bc|iw dev <interface> connect "<ssid>"}} * '''WEP''' ** Using a hexadecimal or ASCII key. *** {{bc|iw dev <interface> connect "<ssid>" key 0:<key>}} ** Using a hexadecimal or ASCII key, using a specific key. *** {{bc|iw dev <interface> connect "<ssid>" key d:<key number>:<key>}} * '''WPA''' ** You'll need the package {{Pkg|wpa_supplicant}} to connect to WPA/WPA2/WPA3 networks. This command must be run in an actual root shell ({{ic|sudo -i}}). You'll also need to reboot and then enable the wpa_supplicant systemd service {{ic|systemctl enable --now wpa_supplicant.service}} after installing. *** {{bc|wpa_supplicant -B -i <interface> -c <(wpa_passphrase "<ssid>" "<key>")}} You'll now be able to check if you have successfully connected by using {{ic|iw dev link}}{{bc|iw dev <interface> link}} == Network Management == === Comparison === {{Note|Coming soon...}} === NetworkManager === 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 ==== {{Warning|If you're coming from systemd-networkd, make sure you delete the systemd-networkd configuration files and disable the service using {{ic|sudo systemctl disable --now systemd-networkd.service}} before starting NetworkManager.}} Install the {{Pkg|networkmanager}} package using {{ic|bulge i networkmanager}}. Once NetworkManager is installed, you can start the daemon by running {{ic|sudo 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 {{ic|libnss3.so}}, you will need to install {{Pkg|nss}}==== Configuration ==== ===== nmtui ===== If NetworkManager is running, you can use the NetworkManager TUI utility by running {{ic|nmtui}}. From {{ic|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. === systemd-networkd === {{Tip|If you aren't using any other DNS resolver (like {{Pkg|dnsmasq}}), you may want to also enable {{ic|systemd-resolved}}, you can do this by running {{ic|sudo systemctl enable --now systemd-resolved}}. If you ARE, you should disable it instead by running {{ic|sudo systemctl disable --now systemd-resolved}}.}} In order to get the network device interface name, you can run {{ic|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"{{hc|$ ip a|2= 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 {{ic|/etc/systemd/network/10-<interface type>-dhcp.network}}{{hc|/etc/systemd/network/10-<interface type>-dhcp.network|2= [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 {{ic|/etc/systemd/network/10-<interface type>-static.network}}{{hc|/etc/systemd/network/10-<interface type>-static.network|2= [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.+The name of the interface will be located after the the word "Interface". In that example: it is named ''wlp3s0'' 
 + 
 +=== Get the link status ===  
 +To check the interface link status, you can use ''iw dev link''. 
 +<code> 
 +$ iw dev <interface> link 
 +Not connected. 
 +</code> 
 + 
 +=== Activate the interface (if required) ===  
 +<bootnote> 
 +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. 
 +</bootnote> 
 +  
 +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'' 
 +<code> 
 +$ 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 
 +</code> 
 + 
 +=== Search for access points ===  
 +<bootnote> 
 +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. 
 +</bootnote> 
 +  
 + 
 +Now that the interface is up, we can scan nearby access points with ''iw dev scan'' 
 +<code> 
 +$ 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  
 +...  
 +</code> 
 + 
 +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''. 
 + 
 +===== Network Management =====  
 + 
 +==== Comparison ====  
 +//Coming soon...// 
 + 
 +==== NetworkManager ====  
 +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 ===  
 +<bootnote warning> 
 +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. 
 +</bootnote> 
 + 
 + 
 +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.  
 + 
 +==== systemd-networkd ====  
 +<bootnote warning> 
 +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''. 
 +</bootnote> 
 +  
 + 
 +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" 
 + 
 +<code> 
 +$ 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 
 +</code> 
 + 
 +== 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'' 
 +<code> 
 +/etc/systemd/network/10-<interface type>-dhcp.network 
 + 
 +[Match]  
 +Name=<interface>  
 + 
 +[Network]  
 +DHCP=ipv4  
 + 
 +[DHCP]  
 +UseDomains=true 
 +</code> 
 + 
 +== 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'' 
 +<code> 
 +/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> 
 +</code> 
 + 
 +After creating one of two configuration files, reboot your system.
  • network_configuration.1676963976.txt.gz
  • Last modified: 2023/02/21 07:19
  • by evie