This tutorial will walk you through the settings of Wi-Fi profile and static IP on wireless as well as wired networks on Arch Linux using netctl.
netctl is a utility that is provided in the base package in the arch and is responsible for managing the network connections and different modes of operations. It should be pre-installed.
Setting Up Profile with netctl
You can also install netctl by entering;
$ pacman -S netctl
You can see the details of netctl by entering
$ netctl or by
$ netctl --help;
Now you need to install a few dependencies that are necessary for running netctl. Install them by entering
$ pacman -S dhclient wpa_supplicant
Now your netctl utility is ready to be used. Configure your profile by entering the following command;
$ sudo nano /etc/netctl/ens33
Replace the ens33 with the name of your machine’s interface. You can find that by entering the following command;
$ ip link show
Similarly, replace the Wi-Fi Name with the name of Wi-Fi you are connecting to and My WiFi Password with its password.
If you want to set up your Wi-Fi profile using GUI, enter the following command;
$ sudo wifi-menu -o
A dialog box will pop up, showing you all the available Wi-Fi networks. You can choose the desired Network and authenticate to it using the Wi-Fi password/key.
Now your wifi profile has successfully been setup. Use the netctl commands to start, stop, enable, disable, and restore the profile.
Setting Up Static IP on Wi-Fi Profile
There may be some cases when the Wi-Fi doesn’t support the DHCP-client or DHCP is by default turned off. In that case, you can assign a static IP to your wi-fi profile. Remember to assign an IP in a valid subnet currently being used by the wi-fi. Giving a random static IP may not work.
Enter the following command;
$ nano /etc/netctl/name_of_static_profile
Remember to replace the Interface, Security, ESSID, Key, IP & Gateway details with details of your wi-fi connection. You can use default DNS provided to you, or you may use any Public DNS like Google, OpenDNS, Cloudflare, etc.
Setting Up Static IP on Wired Profile
It’s decidedly less likely that Wi-Fi uses a static IP scheme. However, static IPs are very common in Ethernet/Wired connections. Mega corporates often tend to disable DHCP to stop intruders from successful communications even if they have managed to connect to the network.
To assign a static IP to the wired profile, enter the following command;
$ sudo nano /etc/netctl/Name_of_wired_profile
After that, you have to configure the profile as per your needs using different options provided by netctl. You have to enable and start a profile. Remember to use sudo while setting up a profile else the changes may not affect.
netctl is a powerful utility that lets us play with our network profiles. All the netctl profiles are stored in the /etc/netctl/ directory. Similarly, it also provides us the capability to store our Wi-Fi keys/password in 256-bit pre-shared key.