Static IP seems to be overwritten by something..

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

Static IP seems to be overwritten by something..

Postby homunculus » Thu Jan 30, 2014 7:41 am

Hi again,

I have another basic question. I just want to set up a static IP address for my Pi to work with a router I have limited access to. (I'm allowed to use 192.168.1.7) I followed the directions on this page:

https://wiki.archlinux.org/index.php/Network_Configuration

under the section entitled Manual connection at boot using systemd. That seemed to be exactly what I wanted to do so I followed it step by step. Initially it seems to work. But on subsequent reboots it looks like it *sometimes* gets assigned another IP address (the next available one handed out by the router).

Here is exactly what I entered:

$this->bbcode_second_pass_code('', '
systemctl disable dhcpcd@eth0.service
systemctl status dhcpcd.service
(verify that it's disabled)

nano /etc/conf.d/network@eth0

(with the following content)

address=192.168.1.7
netmask=24
broadcast=192.168.1.255
gateway=192.168.1.1

(and saved)

nano /etc/systemd/system/network@.service

(with the following content)

[Unit]
Description=Network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network@%i

ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i
ExecStart=/usr/bin/ip route add default via ${gateway}

ExecStop=/usr/bin/ip addr flush dev %i
ExecStop=/usr/bin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

systemctl enable network@eth0.service
systemctl start network@eth0.service

(and saved)

reboot
')

I'd like to get this systemd method working (assuming that this is indeed the correct, recommended way of doing things). Am I missing anything? This is fresh install of arch - is there something running in the background that attempts to retrieve an IP address from the router? If there is an error being logged somewhere I'm afraid I don't even know where to look. Any help would be appreciated.

Thank you!
homunculus
 
Posts: 5
Joined: Sat Jul 06, 2013 3:37 am

Re: Static IP seems to be overwritten by something..

Postby pepedog » Thu Jan 30, 2014 9:01 am

None of that
https://wiki.archlinux.org/index.php/Netctl
Just edit /etc/netctl/eth0
Make sure it's the only file there
Network is enabled with systemctl enable netctl-ifplugd@eth0 (eth0 refers to all files in /etc/netctl where Interface=eth0, not a filename)
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Static IP seems to be overwritten by something..

Postby homunculus » Thu Jan 30, 2014 5:19 pm

Thank you for that. That was a lot more straight-forward.
homunculus
 
Posts: 5
Joined: Sat Jul 06, 2013 3:37 am


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 4 guests