Setting Up an IP address in Arch Linux¶
In this article
Note
Network interfaces in Arch Linux are configured through the systemd-networkd system or the ip tool.
Configuring DHCP Using systemd-networkd¶
To configure automatic IP address acquisition via the DHCP protocol, follow these steps:
1. Preparation
Ensure that the systemd-networkd service is installed, enabled, and running. You can check this with the following command:
If the service is not enabled, run:
2. Creating a Configuration File
In the /etc/systemd/network/ directory, create a configuration file for the network interface. If the directory doesn't exist, create it manually:
Create a file, such as /etc/systemd/network/20-wired.network, and add the following configuration:
Note
Replace ens1 with your network interface name. You can find the interface name using the command ip link.
3. Restarting the Service
After making changes, restart systemd-networkd to apply the settings:
4. Checking the Connection
Ensure that the IP address was successfully acquired:
The command output should display a line containing the obtained IP address:

5. Troubleshooting
If the connection doesn't work:
-
Check the
systemd-networkdservice log for detailed error information: -
Make sure that the
resolvedconfiguration is set up correctly, and thesystemd-resolvedservice is running:Check the symbolic link to the
/etc/resolv.conffile:If the file isn't configured, create a link:
bash ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
Configuring a Static IP Address¶
Example configuration for a static IP address on the ens1 interface:
-
Create or modify the
/etc/systemd/network/20-wired.networkfile with the following content:[Match] Name=ens1 [Network] Address=192.168.1.100/24 Gateway=192.168.1.1 # Specify your gateway IP address DNS=8.8.8.8 8.8.4.4Address: Set the static IP address for your device. In this example,192.168.1.100is used.Gateway: Specify the IP address of your network gateway. This is usually the IP address of your router, e.g.,192.168.1.1.DNS: Specify DNS servers. In this example, public Google DNS servers are used.
-
Apply the settings by restarting the
systemd-networkdservice: -
Verify that the settings are applied correctly:
You should see the specified IP address in the list:

Attention
To ensure proper functionality of the DNS parameter, make sure systemd-resolved is enabled and running:
If necessary, configure /etc/resolv.conf as a symbolic link to systemd-resolved:
Applying the Configuration¶
After setting up the network, you can check its status using the command:
Or view routing parameters: For more information, refer to the official Arch Linux documentation.Some of the content on this page was created or translated using AI.