0

I got a new router, and my raspberry pi keeps adding the old IP to my system everyday. I have tried assigning a static ip, flushing the interface, making sure that the old ip is in none of the files, but everyday it adds the old route back. I use my pi as a pihole, so my wifi goes down everyday until I remove the old route. Can anyone help me out?

  • keeps adding the old IP to my system - what do you mean exactly? – abolotnov Oct 9 at 5:23
  • 3
    Please edit your question and post the contents of /etc/network/interfaces and /etc/dhcpcd.conf (without the comment lines). – Dougie Oct 9 at 7:13
  • @abolotnov Everyday, it adds the old IP address (192.168.1.x) to the route table as the default even though I have the new IP (192.168.50.x) set as the default. This causes it to try to use the old IP, crashing my network because I use my pi as a pihole. – redamberfish Oct 9 at 14:14
-2

Your question is not clear, however, you can add ifconfig eth0 192.168.1.X netmask 255.255.255.0 up to the rc.local. This file is located to /etc, So, do the following:

1.sudo nano /etc/rc.local.
2. Add ifconfig eth0 192.168.1.X netmask 255.255.255.0 up to /etc/rc.local. Note that add this command between fi and exit 0 and X is the IP's host id.
3. sudo reboot.

You can also add ifconfig eth0 192.168.56.X netmask 255.255.255.0 down to disable the unusable IP.

The rc.local script runs on each startup.

  • So I should add the working IP to rc.local? – redamberfish Oct 9 at 16:10
  • Yes, And also disable the unusable IP. – M. Rostami Oct 9 at 16:11
  • That broke it completely. It broke the dhcpcd service and I had to reset that. – redamberfish Oct 9 at 17:05
  • Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it. – Ingo Oct 9 at 23:45

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.