User:Zeb/install

From ArchWiki

Install guide

My PC

i7 6700K Skylake

RAM: Corsair Vengeance LPX 16GB (2x8GB) DDR4 DRAM 3000MHz C15 (CMK16GX4M2B3000C15R)

Boot install medium

Boot 2023.01.01 install image on USB disk. Use nomodeset in kernel options (end of line starting with linux if characters are too small for a 4K screen. At prompt:

 loadkeys uk
Note: Installation in UEFI mode. In UEFI settings (DEL at boot) choose CSM→Boot device control→UEFI only. Then to boot, enter UEFI (press DEL) then F7, F8 and choose USB key to boot

Connect to the Internet at install

We need a connection that works with the installer. The EDIMAX AC1200 USB (802.11ac) adapter requires a compiled module (rtl8812au) from the AUR, and therefore cannot be used during initial install. We need to use an adapter that works out of the box within the installer, either of:

  • wired Ethernet. This is the fastest and easiest way as it requires no further config.
  • a WiFi adapter that works with the kernel used in the installer, such as an Intel AX200 PCIe or an EDIMAX EW-7318USg (802.11n) USB adapter. This will require activating the WiFi connection via iwctl:
[iwd]# device list
[iwd]# station wlan0 scan
[iwd]# station wlan0 get-networks
[iwd]# station wlan0 connect SSID

Verify IP address and internet connection with e.g. ip addr and ping www.google.com.

Basic install

Verify time:

 timedatectl status

Drive partitioning:

  • Warning: First time only
    Configure NVMe SSD drive with an ESP:
 # gdisk /dev/nvme0n1
 n +512M EF00
 n +48G 8300
 n -40G 8300 <- reserved space for SSD overprovisioning
 w
 mkfs.fat -F 32 /dev/nvme0n1p1
 mkfs.ext4 /dev/nvme0n1p2
 mkfs.ext4 /dev/nvme0n1p3
 mount /dev/nvme0n1p2 /mnt
 mkdir /mnt/boot
 mkdir /mnt/home
 mount /dev/nvme0n1p3 /mnt/home
 mount /dev/nvme0n1p1 /mnt/boot
  • (If reinstalling) Do not reformat /home!
 mkfs.fat -F32 /dev/nvme0n1p1
 mkfs.ext4 /dev/nvme0n1p2
 mount /dev/nvme0n1p2 /mnt
 mkdir /mnt/boot
 mkdir /mnt/home
 mount /dev/nvme0n1p3 /mnt/home
 mount /dev/nvme0n1p1 /mnt/boot

Install base system:

 pacstrap -K /mnt base base-devel linux linux-firmware

I'll configure swap later.

Generate fstab.

Note: At this stage, it is possible (but optional) to mount the drives to help with fstab generation:
 mount /dev/sda2 -m /mnt/mnt/sda2
 mount /dev/sda3 -m /mnt/mnt/sda3
 mount /dev/sdb1 -m /mnt/mnt/sdb1
 mount /dev/sdb2 -m /mnt/mnt/sdb2
 mount /dev/sdc1 -m /mnt/mnt/bigdata
 mount /dev/sdd1 -m /mnt/mnt/bigdata2
 genfstab -U /mnt >> /mnt/etc/fstab
 arch-chroot /mnt
 ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
 hwclock --systohc

Install an editor

pacman -S nano

Uncomment en_GB.UTF-8 UTF-8, fr_FR.UTF-8 UTF8 and other needed localizations in /etc/locale.gen, and generate them with:

 locale-gen
 echo LANG=fr_FR.UTF-8 > /etc/locale.conf
 echo KEYMAP=uk > /etc/vconsole.conf

Edit and add:

/etc/vconsole.conf
...
FONT=lat1-16
FONT_MAP=
 echo arch > /etc/hostname

Add a matching line to /etc/hosts:

 127.0.1.1	arch.localdomain	arch
 pacman -Suy
 pacman -S iwd dialog
 pacman -S intel-ucode
 mkinitcpio -P

Ignore warning missing modules aic914xx and wd719x [1]

Change root password:

 passwd

Install boot loader. We use UEFI with systemd-boot:

 bootctl --path=/boot install

Edit loader config file and entries:

/boot/loader/loader.conf
default arch
timeout 8
editor  1
/boot/loader/entries/arch.conf
title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options root=PARTUUID=39b93785-4039-4cde-9a22-c84b6313ae4c rw nomodeset
Note: PARTUUID ca be found with
 $ ls -l /dev/disk/by-partuuid/
 total 0
 lrwxrwxrwx 1 root root 15  8 janv. 07:18 39b93785-4039-4cde-9a22-c84b6313ae4c -> ../../nvme0n1p2

Exit and reboot:

 exit
 umount -R /mnt
 reboot

Reboot

Login as root. Create user eric:

 useradd -m -G wheel,input -s /bin/bash eric
 passwd eric

Configure /etc/sudoers: uncomment %wheel sudo access with no password.

Adjusting fstab

To external drive partitions, add to their fstab arguments:

 ,nofail,x-systemd.device-timeout=1

Network and internet in console

Use the same working interface than the one used for install. For wired Ethernet use systemd-networkd or for WiFI use iwctl and systemd-networkd depending on the adapter. Before using iwctl, activate iwd:

systemctl enable iwd
systemctl start iwd
systemctl enable systemd-networkd
systemctl start systemd-networkd
systemd enable systemd-resolved
systemd start systemd-resolved

and create file:

/etc/systemd/network/25-wireless.network
[Match]
Name=wlan0

[Network]
DHCP=yes
IgnoreCarrierLoss=3s

Verify IP address and internet connection with e.g. ip addr and ping www.google.com.

Note: systemd-networkd is used here to activate network in command line mode, i.e. assign an IP address when using iwctl. When using later NetworkManager, we will need to deactivate it to avoid having both network managers active at the same time, leading to connection issues. Alternatively, we could have either:

WiFi

AX200 PCIe adapter

Works out of the box. To avoid disconnections/perf losses:

/etc/modprobe.d/ax200-iwl.conf
options iwlwifi 11n_disable=0
options iwlwifi power_save=0
options iwlmvm power_scheme=1

and reboot.

EDIMAX USB AC1200 adapter

Using wired Ethernet or the 802.11n WiFi USB adapter used previously, install the 8812au drivers:

 yay -S rtl88xxau-aircrack-dkms-git

Plug in the EDIMAX USB AC1200 adapter. Activate using NetworkManager (e.g. under KDE). Do not use other daemons such as systemd-networkd and NetworkManager at the same time! See Network_configuration#Network_managers and Wireless_network_configuration.

Pacman

Edit /etc/pacman.conf and uncomment multilib section.

Install yay:

 pacman -S git
 git clone https://aur.archlinux.org/yay.git
 cd yay
 makepkg -si

Find best mirrors

 pacman -S reflector
 reflector -l 30 --sort rate --save /etc/pacman.d/mirrorlist
 pacman -S pkgfile
 pkgfile --update

Useful helper functions

 yay -S pkgtools
 yay -S pacman-contrib vim
 yay -S systemd-boot-pacman-hook
 yay -S plocate
 yay -S bash-completion

makepkg

Create directory /mnt/bigdata2/tmp/makepkg

/etc/makepkg.conf
...
CFLAGS="-march=native -O2 ..."
CXXFLAGS="${CFLAGS}"
...
MAKEFLAGS="-j$(nproc)"
...
BUILDDIR=/mnt/bigdata2/tmp/makepkg
...
Note: Remove -mtune when using -march=native.

Swap and swappiness

 fallocate -l 8G /mnt/sdb1/swapfile
 chmod 600 /mnt/sdb1/swapfile
 mkswap /mnt/sdb1/swapfile
 swapon /mnt/sdb1/swapfile

Finally, edit /etc/fstab to add an entry for the swap file:

 /mnt/sdb1/swapfile none swap defaults 0 0

Create and edit:

/etc/sysctl.d/99-sysctl.conf
vm.swappiness=1
vm.vfs_cache_pressure=50

Wayland / XWayland / Xorg / NVIDIA

Note: Obsolete depuis Plasma 6 / Wayland. Envisager Wayland + Xwayland (ce dernier pour les dependances Xorg)

We use nvidia-dkms se that we can automatically support the linux-ck kernel later.

 pacman -S linux-headers
 pacman -S nvidia-dkms xorg-apps nvidia-settings lib32-nvidia-utils lib32-libvdpau

Choose all xorg-apps. Reboot to use nvidia driver.

Note: Very important! To get Full extended HDMI color range, the setting must be enabled on the TV. On a Samsung 4K TV, navigate the tv setting menu and select: General -> Gestionnaire de Périphériques Externes -> Signal d'entrée - Étendre -> HDMI (numéro de l'entrée où le PC est connecté). S'assurer que l'option est active. Il faut le refaire à chaque fois que le cable HDMI est débranché.

Then optimise nvidia settings:

/etc/X11/xorg.conf.d/20-nvidia.conf
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
    Option         "ForceFullCompositionPipeline" "off"
    Option         "AllowIndirectGLXProtocol" "off"
    Option         "TripleBuffer" "on"
EndSection
Note: ForceFullCompositionPipeline is off because it leads to issues with Steam/Proton (as of nvidia driver 535).

Reboot.

Optimise SSD

  • tmpfs

Nothing to do: automatically in RAM with systemd.

  • I/O scheduler

To change the default scheduler, see Improving_performance#Changing_I/O_scheduler. As recommended in the wiki, create file:

/etc/udev/rules.d/60-ioschedulers.rules
# HDD
ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"

# SSD
ACTION=="add|change", KERNEL=="sd[a-z]*|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

# NVMe SSD
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"

Changes should occur upon next boot. To check success of the new rule:

$ cat /sys/block/sdX/queue/scheduler  # where X is the device in question
  • enable periodic TRIM
 systemctl enable fstrim.timer
 systemctl start fstrim.timer
  • profile-sync-daemon
 yay -S profile-sync-daemon

Configure it for browsers (Firefox, Chrome, etc).

 yay -S google-chrome firefox firefox-i10n-fr

Select pipewire-jack, wireplumber, noto-fonts

 psd

Edit psd.conf if required.

 $ psd
 # systemctl --user start psd
 # systemctl --user enable psd
  • tools for NVMe drive:
 yay -S nvme-cli
  • enable smart monitoring
 # systemctl start smartd.service
 # systemctl enable smartd.service

Optimise HDD

This is specific to ST4000DM000 HDD, which is known for its cycle frenziness:

/etc/udev/rules.d/50-hdparm.rules
# set the Advanced Power Management feature for the ST4000DM000 HDD
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sdd", RUN+="/usr/bin/hdparm -B 254 -S 0 /dev/sdd"

KDE

 pacman -S sddm
 pacman -S plasma-meta
 systemctl enable sddm
 systemctl start sddm

In KDE:

  • Sur 4K TV, augmenter Echelle Globale a 200% (Affichage et Écran).
  • Then in plasma, go to System Settings → Startup → SDDM and change theme to Breeze (or Brise if in French). Then Apply Plasma settings (button at bottom). Configure SDDM auto-login.
  • KMix config: deselect start at Plasma startup.
  • Set regionalisation and input languages.
  • For GTK2 and 3 appearance, choose Breeze.
  • Demarrage et arret → Session d bureau → Option a la deconnexion par defaut → Eteindre l'ordinateur.
 pacman -S kde-applications-meta

Choose 1) pyside2, 1) cronie, 38) tesseract-data-fra

 pacman -S kde-l10n-fr

Modernise Audio:

 yay -S pipewire-pulse

This will remove and replace pulseaudio, this is normal. In KDE, open Volume audio and chose as output: HDMI and Profile stereo or 5.1 (depending on hardware).

To have nm applet in KDE:

Note: Install of plasma-nm may not be necessary, please check.
yay -S plasma-nm
sudo systemctl enable NetworkManager

Enable the experimental iwd backend with:

/etc/NetworkManager/conf.d/wifi_backend.conf
[device]
wifi.backend=iwd

and disable iwd service (NetworkManager will manage it itself):

sudo systemctl disable iwd.service
sudo systemctl stop wpa_supplicant
sudo systemctl disable wpa_supplicant
sudo systemctl start NetworkManager

In the applet, set option "all users can connect to this network" and switch security to WPA3. To force using 5GHz canal instead of 2.4GHz, set BSSID as well.

Note: NetworkManager service interferes with netctl or systemd-networkd and makes the 5G adapter not working if NetworkManager is not configured yet. Stop NetworkManager if it has not been yet configured to be able to connect in console.

Once NetworkManager is used you should disable other network manager services:

# systemctl disable systemd-networkd.service
# systemctl disable systemd-networkd.socket

VPN

To configure VPN in plasma-nm:

 yay -S networkmanager-openvpn

and reboot.

For AirVPN:

yay -S eddie-ui nftables

Other packages

Video discs support

 yay -S libbdplus libdvdcss
 yay -S ttf-bitstream-vera
 yay -S ttf-liberation
 yay -S ttf-linux-libertine
 yay -S abs

NTFS read and write

yay -S ntfs-3g

Games - use steam-native and steam-native-runtime in case Steam crashes due to library conflicts.

 yay -S steam sc-controller-git
 yay -S steam-native-runtime
 yay -S proton-ge-custom-bin
 sudo usermod -a -G games eric

Sound with PlayOnLinux (e.g. Skyrim):

 yay -S playonlinux lib32-openal

MTP transfer (e.g. from Android phones)

yay -S android-udev

To fix disconnection issues (mostly). The most simple and likely useless example is disabling autosuspend for all USB devices:

/etc/udev/rules.d/51-usb_power_save.rules
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", ATTR{idProduct}=="9205", ATTR{power/autosuspend}="-1"

SSHFS to use dolphin with KDE Connect on a phone

  yay -S sshfs

lm_sensors

 yay -S lm_sensors

ASUS Maximus VIII Gene: need to modprobe nct6775?

As root:

 sensors-detect

Use default options.

Bluetooth

 yay -S bluez-firmware bluez-utils
 systemctl enable bluetooth
 systemctl start bluetooth

Xbox One controller

Install xpadneo driver

yay -S xpadneo-dkms-git

In case of pairing issues (e.g. loop connection/deconnection) edit:

/etc/bluetooth/main.conf
...
Privacy=device
...

See also https://github.com/bluez/bluez/issues/155 and https://github.com/atar-axis/xpadneo/issues/295

Preload

 yay -S preload
 sudo systemctl enable preload
 sudo systemctl start preload

NTP

 yay -S ntp
 sudo systemctl start ntpd
 sudo systemctl enable ntpd

WiFi revisited

Recently, plugging the EDIMAX USB AC1200 lead to the creation of interface wlp0s26f7u3 instead of enp0s26f7u3 (same than using the Edimax EW-7318USg). Disabling all of systemd-networkd and associated wpa_supplicant@ services and keeping NetworkManager service solves the problem entirely, but logging into KDE and entering the KWallet password is required.

Add linux-ck kernel (optional)

Note: Use of nvidia-dkms will allow automatic nvidia driver (re)compilation.
 yay -S linux-ck linux-ck-headers

Import keys signing the kernels (handled by yay)

Select either of:

 22. Intel Skylake (MSKYLAKE) (NEW)
 choice[1-24?]: 22

or

 24. optimizations autodetected by GCC (MNATIVE) (NEW)
 choice[1-24?]: 24
 Support for P6_NOPs on Intel chips (X86_P6_NOP) [N/y/?] (NEW) y

Edit boot entry:

/boot/loader/entries/arch-ck.conf
title   Arch Linux CK kernel
linux   /vmlinuz-linux-ck
initrd  /intel-ucode.img
initrd  /initramfs-linux-ck.img
options root=PARTUUID=39b93785-4039-4cde-9a22-c84b6313ae4c rw nomodeset

Reboot.

Annexes

System Maintenance

Pacman

 $ yay -Scc && sudo pkgfile --update && sudo pacman-key --refresh-keys
 # reflector -l 30 --sort rate --save /etc/pacman.d/mirrorlist

Systemd-boot

When new systemd is available, this is automatically taken care of with package systemd-boot-pacman-hook installed.

Otherwise, this needs to be done manually:

 # bootctl update
 # bootctl set-default arch-ck.conf

Firmware updates

# fwupdmgr refresh && fwupdmgr get-updates && fwupdmgr update

Other

 $ sudo updatedb

Storage devices and partitioning

With parted:

(parted) print devices                                                    
/dev/sda (1000GB)
/dev/sdb (512GB)
/dev/sdc (8002GB)
/dev/sdd (4001GB)
/dev/nvme0n1 (1000GB)

$ LANG=C sudo parted <<<'unit MiB print all'
GNU Parted 3.6
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit MiB print all                                               
Model: ATA HGST HTS721010A9 (scsi)
Disk /dev/sda: 953870MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start      End        Size       File system  Name  Flags
 1      1.00MiB    830989MiB  830988MiB  ext4
 2      830989MiB  953869MiB  122880MiB  ntfs               msftdata


Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sdb: 488386MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start     End        Size       File system  Name                 Flags
 1      1.00MiB   513MiB     512MiB                  BIOS boot partition  bios_grub
 2      513MiB    41473MiB   40960MiB   ext4         Linux filesystem
 3      41473MiB  439552MiB  398079MiB  ext4         Linux filesystem


Model: ATA ST8000DM004-2U91 (scsi)
Disk /dev/sdc: 7630885MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start    End         Size        File system  Name  Flags
 1      1.00MiB  7630885MiB  7630884MiB  ext4


Model: ATA ST4000DM000-1F21 (scsi)
Disk /dev/sdd: 3815448MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start    End         Size        File system  Name  Flags
 1      1.00MiB  3815447MiB  3815446MiB  ext4


Model: WD_BLACK SN850X 1000GB (nvme)
Disk /dev/nvme0n1: 953870MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start     End        Size       File system  Name                  Flags
 1      1.00MiB   513MiB     512MiB     fat32        EFI system partition  boot, esp
 2      513MiB    49665MiB   49152MiB   ext4         Linux filesystem
 3      49665MiB  912910MiB  863245MiB  ext4         Linux filesystem


With fdisk:

$ LANG=C sudo fdisk -l
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: HGST HTS721010A9
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 68B46F5C-4EAC-4F6B-A479-211AFB91CA82

Device          Start        End    Sectors   Size Type
/dev/sda1        2048 1701865471 1701863424 811.5G Linux filesystem
/dev/sda2  1701865472 1953523711  251658240   120G Microsoft basic data


Disk /dev/sdb: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 52D59049-F1D2-4C37-996A-A853A0E0C320

Device        Start       End   Sectors   Size Type
/dev/sdb1      2048   1050623   1048576   512M BIOS boot
/dev/sdb2   1050624  84936703  83886080    40G Linux filesystem
/dev/sdb3  84936704 900202495 815265792 388.7G Linux filesystem


Disk /dev/sdc: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: ST8000DM004-2U91
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 19C0390E-EFF1-4E96-AAC5-F3FA2C5C1F63

Device     Start         End     Sectors  Size Type
/dev/sdc1   2048 15628052479 15628050432  7.3T Linux filesystem


Disk /dev/sdd: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: ST4000DM000-1F21
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: FB170288-F674-4B77-AF34-8E3ED7A5B4B0

Device     Start        End    Sectors  Size Type
/dev/sdd1   2048 7814035455 7814033408  3.6T Linux filesystem


Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WD_BLACK SN850X 1000GB                  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3A1F7BCB-8948-4663-A892-DD30FA97BC38

Device             Start        End    Sectors  Size Type
/dev/nvme0n1p1      2048    1050623    1048576  512M EFI System
/dev/nvme0n1p2   1050624  101713919  100663296   48G Linux filesystem
/dev/nvme0n1p3 101713920 1869639054 1767925135  843G Linux filesystem

Final fstab

#
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p2
UUID=634cb2a0-8216-462f-a4aa-d56bdc23b9d0       /               ext4            rw,relatime     0 1

# /dev/nvme0n1p3
UUID=9f80776b-912f-4c56-9b87-8b1a4643d5ed       /home           ext4            rw,relatime     0 2

# /dev/nvme0n1p1
UUID=0F68-B318          /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2

# /dev/sda2
UUID=e07245b9-6a7a-442e-ad70-26e7a08bfd2f       /mnt/sda2       ext4            rw,relatime     0 2

# /dev/sda3
UUID=c20a194f-5e65-458a-b502-5f4b9a7a819e       /mnt/sda3       ext4            rw,relatime     0 2

# /dev/sdb1
UUID=aea63989-3e6e-4b28-9a34-d8d670b5b802       /mnt/sdb1       ext4            rw,relatime     0 2

# /dev/sdb2
UUID=32D88D617B391DC2   /mnt/sdb2       ntfs            rw,nosuid,nodev,user_id=0,group_id=0,allow_other,blksize=4096   0 0

# /dev/sdc1
UUID=f5d9d8b7-31ed-434d-8f9a-69681ea65e39       /mnt/bigdata   ext4             rw,relatime     0 2

# /dev/sdd1
UUID=93d7f6a7-f718-47d8-8429-89b1647c93ec       /mnt/bigdata2   ext4            rw,relatime     0 2

# Swap
/mnt/sdb1/swapfile      none    swap    defaults        0 0

# tmpfs 12 Gi instead of default 8 Gi
# tmpfs   /tmp         tmpfs   rw,nodev,nosuid,size=12G          0  0

Setting up WiFi with systemd (obsolete)

Note: This is for information only. The preferred method (as above) uses NetworkManager which was painless with the 5GHz adapter.
Warning: Use only one network manager daemon at a time, they are mutually exclusive since several daemons running at the same time may lead to blocking interface activation. See Network_configuration#Network_managers. Before using other managers (e.g. netctl via wifi-setup) type:
 # systemctl stop NetworkManager
 ip link

indicates wireless interface is named wlp0s26f7u3.

 wpa_passphrase NETGEAR41 <password> > /etc/wpa_supplicant-wlp0s26f7u3.conf
 nano /etc/systemd/network/wireless.network
 [Match]
 Name=wlp0s26f7u3
 
 [Network]
 DHCP=ipv4
 systemctl start systemd-networkd
 systemctl start wpa_supplicant@wlp0s26f7u3

You can verify with dhcpcd that an IP is received (use ip -a to check).

To make it persistent:

 systemctl enable systemd-networkd
 systemctl enable wpa_supplicant@wlp0s26f7u3


Same example for the 5GHz adapter:

 ip link

indicates wireless interface is named enp0s26f7u3.

 wpa_passphrase NETGEAR41-5G <password> > /etc/wpa_supplicant-enp0s26f7u3.conf
 nano /etc/systemd/network/wireless5g.network
 [Match]
 Name=enp0s26f7u3
 
 [Network]
 DHCP=ipv4
 systemctl start systemd-networkd
 systemctl start wpa_supplicant@enp0s26f7u3

You can verify with dhcpcd that an IP is received (use ip -a to check).

To make it persistent:

 systemctl enable systemd-networkd
 systemctl enable wpa_supplicant@enp0s26f7u3

Add a subnet to connect a NAS directly to PC and share Wifi internet

/etc/sysctl.d/30-ipforward.conf
net.ipv4.ip_forward=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1

First time:

# cp /etc/iptables/empty.rules /etc/iptables/iptables.rules

Then start the iptables.service unit. As with other services, if you want iptables to be loaded automatically on boot, you must enable it.

iptables rules for IPv6 are, by default, stored in /etc/iptables/ip6tables.rules, which is read by ip6tables.service. You can start it the same way as above.

Create rules:

# iptables -t nat -A POSTROUTING -o wlp0s20f0u8u4 -j MASQUERADE
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i enp0s31f6 -o wlp0s20f0u8u4 -j ACCEPT

Save them to apply at boot:

# iptables-save > /etc/iptables/iptables.rules

Then create a class A network on the PC with

 static address 10.0.0.1 mask 255.0.0.0 gw 0.0.0.0

And configure NIC on NAS:

 static address 10.0.0.2 mask 255.0.0.0 gw 10.0.0.1 with DNS 192.168.1.1 or 8.8.8.8

See Internet sharing and iptables for more info.

To access class A from 192.168.1.x network, add a static route in the router R7000 config:

 destination 10.0.0.0/8 gw 192.168.1.107 (the IP of the PC), Metric 2.