Static IP on Arch Linux

I was searching how to set static IP on Arch Linux Raspberry Pi.
Here is what I did.

1. Network Interface
Network interface is what connects the computer to the network. Traditionally this used to be eth0 or wlan0 for the first ethernet port and wireless adapter. With the new naming convention you may see different names.

Find the network interface name.

ip addr

In the output look for the name of the network interface you want to configure. In my case there is only a single ethernet port named enp1s0.

2: enp1s0: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 74:d4:35:5f:f6:60 brd ff:ff:ff:ff:ff:ff
inet brd scope global enp1s0
valid_lft forever preferred_lft forever
inet6 fe80::76d4:35ff:fe5f:f660/64 scope link
valid_lft forever preferred_lft forever

2. Gateway
Gateway is the IP of the router that connects to the internet. This is the same IP address you use to log in to your router configuration page. I had my router configured to use If you don’t know your gateway you can easily find out from command line.

Find the gateway address.

ip route

In the output the gateway will be on the first line.

default via dev enp1s0

3. Netmask
Netmask is used to subdivide a network into subnets or subnetworks. It is generally for simple networks. In slash notation it is written as /24

4. DNS
Domain Name System is what translates domain names into IP addresses that computers can understand. Since this happens for every request it should be as fast as possible. Public DNS servers are just fine but having a router act as a DNS server can give a minor advantage. I chose to use my router as a DNS server with Google Public DNS servers as backup. Primary DNS in this scenario is or the same as the gateway while secondary and tertiary DNS addresses are Google’s Public DNS and respectively.

5. Configure Static IP Address
Copy the sample static ethernet profile from examples directory to profiles directory.

cp /etc/netctl/examples/ethernet-static /etc/netctl/enp1s0

Replace enp1s0 with your actual network interface name or another name that describes the profile well.

Edit the newly copied profile to match your configuration.

sudo nano /etc/netctl/enp1s0

Change the Interface value from eth0 to your actual network interface name. Modify the Address value to the desired static IP address followed by the netmask written in slash notation. Swap out the Gateway value with your actual gateway address. Add a primary DNS address and optionally secondary and tertiary addresses.

Alternatively create a new file and copy the profile from below making changes as needed.

Description='A basic static ethernet connection'
DNS=('' '' '')

Start netctl profile manually.

sudo netctl start enp1s0

This is useful to verify the profile is working before enabling it.

Enable netctl profile to allow automatic start at boot time.

sudo netctl enable enp1s0

Δεν υπάρχουν σχόλια

Από το Blogger.