Static IP address - question about proper way of do this

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Static IP address - question about proper way of do this

Postby bl0ndynek » Sat Jan 10, 2015 2:16 pm

Hi,

I try setup static ip address as it is suggested on forum using netctl.
But after few try raspberry still obtain DHCP address (even after uninstall dhcpcd).
And I get error when try to enable profile with netctl.

I see that I can edit file /etc/systemd/network/eth0 and there replace DHCP=both with proper settings and this work.
Is this proper way of set static IP address and safe (will not be override on upgrade)?
bl0ndynek
 
Posts: 19
Joined: Sat Jan 10, 2015 1:58 pm

Re: Static IP address - question about proper way of do this

Postby krabat » Sun Jan 11, 2015 2:07 am

Recent Arch Linux ARM images have both systemd-networkd and systemd-resolved enabled by default. The former is featuring its own DHCP client which is why you still obtain a DHCP lease after uninstalling dhcpcd.
Modifying /etc/systemd/network/eth0 or using a different *.network file is all right as this file doesn't belong to any package and thus won't get overwritten by updates. See man systemd.network for details.
If you want to use netctl you first have to disable both services and turn /etc/resolv.conf into a file as it's handled as a symbolic link pointing at /run/systemd/resolve/resolv.conf by systemd-resolved, e. g.
$this->bbcode_second_pass_code('', '
# systemctl stop systemd-networkd.service && systemctl disable systemd-networkd.service
# systemctl stop systemd-resolved.service && systemctl disable systemd-resolved.service
# rm /etc/resolv.conf && touch /etc/resolv.conf
')(not sure whether the last 'touch...' is necessary but it won't hurt)
krabat
 
Posts: 57
Joined: Wed Jun 04, 2014 8:03 pm

Re: Static IP address - question about proper way of do this

Postby bl0ndynek » Sun Jan 11, 2015 2:35 am

Thank you for answer, I have to more questions:
Can I just replace systemd-networkd (with newctl) and leave systemd-resolved working? I do this and it's seems fine,but don't know if there could be any problems with this configuration in future.
Which in your opinion is better\cleaner way to set static IP address by modify /etc/systemd/network/eth0 or by netctl?
bl0ndynek
 
Posts: 19
Joined: Sat Jan 10, 2015 1:58 pm

Re: Static IP address - question about proper way of do this

Postby pepedog » Sun Jan 11, 2015 8:55 am

Netctl does its own resolving. I would go with that. You might have to delete the /etc/resolve.conf symlink
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 9 guests