Setup static IP before installation on Arch Linux
The live system of Arch Linux uses systemd-networkd
for configuring network
connections. We will need to configure gateway, netmask and other information
there.
If I remember correctly the configuration file was inside
/etc/systemd/network/20-ethernet.network
. Just add the following configuration
in the [Network]
section and keep other sections as it is.
[Network] #DHCP=yes #MulticastDNS=yes Address=x.x.x.x/a Gateway=y.y.y.y DNS=z.z.z.z
Note the value of a
is basically the number of set bits (number of 1s) in the
netmask. For example, if the netmask is 255.255.255.240
(which in binary is
11111111.11111111.11111111.11110000) then the value of a
will be 28
(total of 28
1s in the binary equivalent).
Now we just need to restart the services.
sudo systemctl restart systemd-networkd.service systemd-networkd.socket
You can check the internet connection using the following command.
ping google.com
Sometimes the above command doesn’t work. In such a case, wait for a minute or two for the DNS to get recognized:
References used - systemd-networkd - Arch Wiki