Even most Linux distribution supports automatic (DHCP) IP configuration, I think it is important for all Linux users to understand how to configure the IP address manually. On this tutorial, I am going to show you how to configure static IP address on Antergos Linux. There are two ways to configure static IP address on Antergos. The GUI mode (easy way) or via command line (needs more patient). But here, I will explain both of them.
Configure Static IP address using GUI mode
Open Network Manager via Settings. The following illustration will explain much better than my words. In this scenario, I am using 10.34.0.76 as my new static IP address, 10.34.0.5 as gateway and DNS server on the network. This configuration could be different based on your network configuration.
Configure Static IP address via command line
Ok, first thing first we need to open Terminal console and type the following command to see the detailed information about our network device.
ip addr
Output:
[dhani@antergos ~]$ ip addr
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:d1:bf:5f brd ff:ff:ff:ff:ff:ff
inet 10.34.0.76/24 brd 10.34.0.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::4c7:5669:326a:12d5/64 scope link
valid_lft forever preferred_lft forever
As you can see, there are two network shown by the command. lo and enp0s3. This network interface can be different on your system. I will only need to care about the enp0s3 device. Leave the lo as is.
Copy the sample static ethernet profile to profile directory with this command
sudo cp /etc/netctl/examples/ethernet-static /etc/netctl/enp0s3
Now edit the new profile
sudo nano /etc/netctl/enp0s3
Now change it to something like this below:
Description='A basic static ethernet connection'
Interface=enp0s3
Connection=ethernet
IP=static
Address=('10.34.0.55/24')
Gateway=('10.34.0.5')
DNS=('10.34.0.5' '8.8.8.8' '8.8.4.4')
Change the interface, address, gateway and DNS to match your current local network configuration. Once completed, save and exit.
Now start the profile manually
sudo netctl start enp0s3
Now enable it upon boot
sudo netctl enable enp0s3
Done.