1

I have 3 devices on a local network. A router, a smart meter, and a raspberry pi (Raspbian Jessie). The router has an IP address of 192.168.1.1, the smart meter is set to have a static address,

IP Address: 192.168.1.153
Subnet Mask: 255.255.255.0
Gateway: 192.168.1.1
Primary DNS Server: 192.168.1.1
Secondary DNS Server: 192.168.1.1

The pi has a reservation in the router for its mac address. The pi is also set to have a static address by editing the /etc/dhcpcd.conf to include,

interface eth0

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

Reference

But the smart meter ends up assigning new ip addresses and reassigning the pi's address. Sometimes placing devices on the same ip address. This is problematic when the rpi has the same address as my phone/computer or when the rpi's address is shifted and doesn't appear in the attached devices section of the router's interface.

Picture of Assigned Phone IP by Smart Meter

How is this possible/how is the smart meter doing this? How can I stop it or force the pi's address not to change?

Update: I think the answer here is to block incoming DHCP offers on the raspberry pi from the smart meter using iptables. Restricting this by MAC address. I just haven't found the correct form yet.

jmb2341
  • 13
  • 3
  • Make and model of smart meter would be useful :) – Kinnectus Jul 16 '16 at 21:37
  • And *how* do you know that's what's doing it? – MAP Jul 17 '16 at 07:00
  • @Big Chris The smart meter is an off brand product so the documentation is lacking. However the main microcontroller is a [PIC 18F97J60](http://www.microchip.com/wwwproducts/en/en026439). This has an Ethernet controller on it. This is described on page 217 of the [datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/39762f.pdf). – jmb2341 Jul 17 '16 at 10:11
  • @MAP If you look at the [Picture of Assigned Phone IP](http://i.stack.imgur.com/Mdhak.png) it shows my phone was assigned an IP address by 192.168.1.153 not 192.168.1.1. 192.168.1.153 is the address of the smart meter on the network. – jmb2341 Jul 17 '16 at 10:13
  • Router is a Netgear [WNR1000v3](https://www.netgear.com/support/product/WNR1000v3#ProductDataSheet) with [User Manual](http://www.downloads.netgear.com/files/GDC/WNR1000V3/WNR1000v3h2_UM_21OCT2010.pdf) – jmb2341 Jul 17 '16 at 15:31
  • It almost sounds like you have more than one DHCP server on the network. In my younger years, I managed to "take down" a building at work by accidentally configuring a rogue DHCP server. See if this is the case and if it is, decide which one you want and turn off the others. – kronenpj Jul 17 '16 at 16:00

1 Answers1

0

According to the screenshot of your phone. Your smart meter acts as a DHCP server. If it is not expected, you may disable the DHCP server on it. If you can't, then remove it from the network.

I think the answer here is to block incoming DHCP offers on the raspberry pi from the smart meter using iptables. Restricting this by MAC address. I just haven't found the correct form yet.

This is just a workaround. To resolve this issue, as I have mentioned above, you should disable the DHCP server on the smart meter. Otherwise, you should remove it.

Even though you are able to block the DHCP offer on raspberry pi, but if you add any new device on the same subnet, the smart meter will still be able to affect the DHCP process on the new device.

Steven Lee - MSFT
  • 923
  • 1
  • 5
  • 10
  • The command will be something like this: `/sbin/iptables -A INPUT -p tcp --source-port 67 -m mac --mac-source 00:0F:EA:54:32:10 -j ACCEPT` Change the address of `mac-source` to be that of the power meter. But Steven Lee is absolutely correct, this is a temporary measure and any other device on this subnet will suffer the same fate as the Raspberry Pi. – kronenpj Jul 18 '16 at 22:40
  • @kronenpj Thanks for the line and the anecdote. I recognize shutting off the rogue DHCP server or removing it would be the best but in my case this is not possible. I ended up using the line, `iptables -A INPUT -p udp --dport 67:68 --sport 67:68 -m mac --mac-source -j DROP` and putting it into a crontab @reboot. @kronenpj 's line looks like it would work too. – jmb2341 Jul 19 '16 at 19:01
  • Some helpful links, [MAC Filtering](http://www.cyberciti.biz/tips/iptables-mac-address-filtering.html), [2 DHCP Servers On The Same Network](http://superuser.com/questions/809589/running-two-dhcp-servers-in-the-same-network/809609#809609), [Pi stuck in a DHCP loop](http://raspberrypi.stackexchange.com/questions/31528/pi-stuck-in-a-dhcp-loop) – jmb2341 Jul 19 '16 at 19:07