1

I can't update an IP address from DHCP to static. I changed the /etc/network/interfaces file and I rebooted the system but IP still is the same as the one that DHCP gave me before.

I changed /etc/network/interfaces to:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.205
netmask 255.255.255.0
gateway 192.168.1.1

I got this error in syslog when I executed /etc/init.d/networking restart:

Aug 30 08:17:01 raspberrypi CRON[1337]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Aug 30 08:34:22 raspberrypi systemd[1]: Stopping LSB: Raise network interfaces....
Aug 30 08:34:22 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Tue Aug 30 08:34:52 2016 [try http://www.rsyslog.com/e/2007 ]
Aug 30 08:34:22 raspberrypi networking[1407]: Deconfiguring network interfaces...done.
Aug 30 08:34:22 raspberrypi systemd[1]: Starting LSB: Raise network interfaces....
Aug 30 08:34:22 raspberrypi networking[1428]: Configuring network interfaces.../etc/network/if-pre-up.d/iptables: 2: /etc/network/if-pre-up.d/iptables: /sbin/iptable-restore: not found
Aug 30 08:34:22 raspberrypi networking[1428]: run-parts: /etc/network/if-pre-up.d/iptables exited with return code 127
Aug 30 08:34:22 raspberrypi networking[1428]: ifup: pre-up script failed.
Aug 30 08:34:22 raspberrypi networking[1428]: failed.
Aug 30 08:34:22 raspberrypi systemd[1]: Started LSB: Raise network interfaces..
raspberry-pi3

uname -a gives:

Linux raspberrypi 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux

And /etc/os-release contains:

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

I tried to execute the script /sbin/ifup, result:

root@raspberrypi:/sbin# ./ifup  -a
/etc/network/if-pre-up.d/iptables: 2: /etc/network/if-pre-up.d/iptables: /sbin/iptable-restore: not found
run-parts: /etc/network/if-pre-up.d/iptables exited with return code 127
./ifup: pre-ifup script failed.
techraf
  • 4,353
  • 10
  • 32
  • 43
Miren
  • 111
  • 1
  • 4

4 Answers4

1

If you are really determined to do it this way you need to disable the DHCP client daemon and switch to standard Debian networking:

sudo systemctl disable dhcpcd
sudo systemctl enable networking
Milliways
  • 62,573
  • 32
  • 113
  • 225
0

Looks like the way we set the static ip has changed. There is a post here in the link which talks about static ip. Please look at the answer from steve(Answer 2).

Raspberry seems to ignore static ip setting

Refer the post: Connecting Raspberry Pi (running Raspbian) to open WiFi using only the command line for more details.

Varad A G
  • 850
  • 6
  • 18
0

The best soluition that I have come across is this one. Solved my requirement for static addresses for both eth0 and wlan0 on my Rpi3

dhcpcd vs /etc/network/interfaces

good luck, ianm

Cheetah7
  • 11
  • 1
0

You can edit the dhcpd.conf file to set a static ip in Raspbian Jessie. This is how I changed mine.

sudo nano /etc/dhcpcd.conf

Go to the end of the file and edit the following based on your needs.

    interface eth0

    static ip_address=192.168.1.200/24
    static routers=192.168.1.1
    static domain_name_servers=192.168.1.1

    interface wlan0

    static ip_address=192.168.1.200/24
    static routers=192.168.1.1
    static domain_name_servers=192.168.1.1
screenslaver
  • 91
  • 1
  • 1
  • 7