Setting a static IP for Arch Linux on Raspberry PI

This is something that has been bothering me for the last months. I tried it in several different ways but none of them solved my problem. No matter the changes I made, after rebooting the Pi it always got both and static and dynamic IPs…

After all these months I finally found the solution, yay! 😀

This magic was hidden in the comments section of this blog. (kudos to Tchelovek)

As of today (23/03/2015) installing Archlinux on a Raspberry Pi (B+ / 2) does not use dhcpcd at all, instead systemd-networkd is used.To change from DHCP to static IP editing /etc/systemd/network/eth0.network is required.
By default it contains
[Match]
Name=eth0
[Network]
DHCP=bothOne needs to modify it to
[Match]
Name=eth0
[Network]
#DHCP=both
DNS=192.168.178.1
Address=192.168.178.22
Gateway=192.168.178.1(change IPs as required)
Review at https://wiki.archlinux.org/index.php/Systemd-networkd#Basic_DHCP_network
Tchelovek

Turns out the newest versions of Arch use systemd-network, so in order to set up a static IP for eth0 you need to edit this file…

# vi /etc/systemd/network/eth0.network

… and add something like…

[Match]
Name=eth0

[Network]
DNS=192.168.1.1
Address=192.168.1.XXX
Gateway=192.168.1.1

Before finishing don’t forget to disable dhcp and netctl services. You won’t need them anymore.

# systemctl disable dhcpcd@eth0.service
# systemctl disable netctl

After rebooting, the Pi should get the IP specified on eth0.network

Cheers!

Daniel.

Anuncios

Acerca de dafero

Mi nombre es Daniel Fernández, Graduado en Ingeniería Informática. En el caso de querer ponerse en contacto conmigo podéis hacerlo a través de al dirección: daferoES en Gmail.com o a través de Twitter https://twitter.com/dafero
Esta entrada fue publicada en Uncategorized. Guarda el enlace permanente.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s