1

I am trying to set a static ip address. The static ip is outside of my home dhcp range. But even after reboot, I can connect to the old dhcp ip address. Why does this happen? Take a look at the ip during login and in the ouput of ifconfig:

login as: pi
pi@192.168.0.205's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jan  5 20:54:59 2016 from flucky-pc.lan

pi@druckerpi:~ $ ifconfig

eth0      Link encap:Ethernet  Hardware Adresse b8:27:eb:7b:45:2b
          inet Adresse:192.168.0.3  Bcast:192.168.0.255  Maske:255.255.255.0
          inet6-Adresse: fe80::ba27:ebff:fe7b:452b/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:11358 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1300 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000
          RX bytes:631413 (616.6 KiB)  TX bytes:133922 (130.7 KiB)

lo        Link encap:Lokale Schleife
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine
          UP LOOPBACK RUNNING  MTU:65536  Metrik:1
          RX packets:41 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0
          RX bytes:5671 (5.5 KiB)  TX bytes:5671 (5.5 KiB)

pi@druckerpi:~ $ cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1

#allow-hotplug wlan0
#iface wlan0 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#allow-hotplug wlan1
#iface wlan1 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
pi@druckerpi:~ $

Is there something I am missing? I DONT want to be able to connect to 192.168.0.205 and instead use the static ip 192.168.0.3 (as set in /etc/network/interfaces)

Milliways
  • 62,573
  • 32
  • 113
  • 225
feedc0de
  • 229
  • 2
  • 3
  • 9

2 Answers2

2

The method of setting a static IP has changed (this has rasied some questions and ire from the community, but it is what it is). Evidence of this can be seen in the comments of the /etc/network/interfaces file you included above, namely these two lines:

Please note that this file is written to be used with dhcpcd

For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf

To set up a static IP using the new dhcpd system edit your /etc/wpa_supplicant/wpa_supplicant.conf file so that it only contains the SSID and psk:

network={
  ssid="xxxxx"
  psk="xxxxxx"
}

and the static IP details are in the /etc/dhcpcd.conf file:

# Static IP configuration
interface eth0
static ip_address=192.168.0.3/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8 8.8.4.4

You will also have to edit your /etc/network/interfaces file so that the eth0 entry looks like this:

auto eth0
allow-hotplug eth0
iface eth0 inet manual

More info can be found in this forum thread. Despite the title of the thread it does include the details of the new setup as well as some of the anger this change has caused.

Sindbad
  • 3
  • 1
Steve Robillard
  • 34,988
  • 18
  • 106
  • 110
1

I assume that by now, your host computer ARP cache table no longer remember the 192.168.0.205 IP Address.

arp -in eth0

Will show you the association between IP and MAC addresses. Unless someone else reuse the same IP with a new MAC, the ARP protocol will keep it alive for some time. You can also clear that table, O/S dependent, with commands like:
Windows:

arp -d *  

Linux:

ip -s -s neigh flush all
fcm
  • 1,869
  • 2
  • 19
  • 30