1

I cannot find a way to start network interfaces with proper config after I changed config files (eg dhcpcd.conf). The only way I found to take the new config into account is to reboot. There must be a more elegant way. Though, service networking restart + systemctl restart dhcpcd.service + ip link set ethx down/up, don't work.

Update with info from comment:
To explain more, I change static ip declarations and don't want to reboot just for that.

  • 1
    sudo systemctl restart dhcpcd.service usually works. You should explain in detail what you want to modify. – Ingo Nov 15 '19 at 17:46
  • That's what I tought too, but it doesn't work. To explain more, I change static ip declarations and don't want to reboot just for that. Raspbian is strangely bundled, but it is a very cheap solution, cannot complain. – cr1ptal Nov 15 '19 at 18:22
  • 1
    What configuration files are you amending? – Dougie Nov 24 '19 at 7:36
  • service networking restart is long deprecated. Could you edit your question to make the commands you run more visible, add the error messages (or whatever it is you see that makes you say the commands don't work) and include the exact config changes. – Dmitry Grigoryev Dec 3 '19 at 12:56
2

If you only want to change the static ip address on an interface you can just do it with ip address in two steps, for example:

rpi ~$ sudo ip address del 192.168.0.1/24 dev eth0
rpi ~$ sudo ip address add 192.168.0.2/24 dev eth0

ip address has also options change and replace but these will not modify the ip address, but only the flags of an existing ip address. For further information about this look at understanding “ip addr change” and “ip addr replace” commands.

You can also use systemd-networkd. There you have many options to configure interfaces. I can confirm that can change interface setup without reboot. How to use systemd-networkd you can look at Howto migrate from networking to systemd-networkd with dynamic failover.

| improve this answer | |
  • thank you, interesting. Otherwise, I didn't find a way to restart networking in Rasbian Strech. All common commands do nothing, or nothing good. Next time I will try ARM Arch. – cr1ptal Nov 17 '19 at 22:44
  • @cr1ptal Before trying ARM Arch I suggest to try systemd-networkd before, because Raspbian is best supported on Raspberry Pi with most know how on this site. I have updated the answer with the last paragraph. – Ingo Nov 17 '19 at 23:09
  • raspberrypi.stackexchange.com/users/79866/ingo ty very much for your tip :-) – cr1ptal Nov 18 '19 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.