I'm trying to use an raspberrypi (OS=raspbian 4.0.7) I had flying around so I researched a little bit and everything seems to work more or less fine. I am using hostapd in combination with an wifi dongle to offer an AccessPoint and dhcpd as DHCP Server.
Going through the logs i found something strange:
Jul 1 21:34:37 raspberrypi dhcpd: DHCPDISCOVER from 00:e0:4c:18:fd:0c (raspberrypi) via wlan0
Jul 1 21:34:38 raspberrypi dhcpd: DHCPOFFER on 10.0.0.12 to 00:e0:4c:18:fd:0c (raspberrypi) via wlan0
Jul 1 21:35:41 raspberrypi dhcpd: DHCPDISCOVER from 00:e0:4c:18:fd:0c (raspberrypi) via wlan0
Jul 1 21:35:42 raspberrypi dhcpd: DHCPOFFER on 10.0.0.12 to 00:e0:4c:18:fd:0c (raspberrypi) via wlan0
Jul 1 21:36:45 raspberrypi dhcpd: DHCPDISCOVER from 00:e0:4c:18:fd:0c (raspberrypi) via wlan0
Jul 1 21:36:46 raspberrypi dhcpd: DHCPOFFER on 10.0.0.12 to 00:e0:4c:18:fd:0c (raspberrypi) via wlan0
Why is this happening? And how can I stop it?
ifconfig:
eth0 Link encap:Ethernet HWaddr b8:27:eb:cd:a0:b7
inet addr:195.169.228.44 Bcast:195.169.229.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7447 errors:0 dropped:21 overruns:0 frame:0
TX packets:2033 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1829496 (1.7 MiB) TX bytes:347081 (338.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:51 errors:0 dropped:0 overruns:0 frame:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3876 (3.7 KiB) TX bytes:3876 (3.7 KiB)
wlan0 Link encap:Ethernet HWaddr 00:e0:4c:18:fd:0c
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2703 errors:0 dropped:15 overruns:0 frame:0
TX packets:2713 errors:0 dropped:7 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:467746 (456.7 KiB) TX bytes:1434643 (1.3 MiB)
dhcpd config:
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.10 10.0.0.50;
option broadcast-address 10.0.0.255;
option routers 10.0.0.1;
option domain-name "marienbosch-network";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
EDIT:
/etc/network/interfaces:
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 195.169.228.44
netmask 255.255.254.0
gateway 195.169.229.254
auto wlan0
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
up iptables-restore < /etc/iptables.ipv4.nat
iptable:
*filter
:INPUT ACCEPT [525:53548]
:FORWARD ACCEPT [6:302]
:OUTPUT ACCEPT [105:11782]
-A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o eth0 -j ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT [373:47175]
:INPUT ACCEPT [99:10520]
:OUTPUT ACCEPT [34:2555]
:POSTROUTING ACCEPT [7:645]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
EDIT
in order to try fixing this issue, changed wlan0 from static to dhcp in /etc/network/interfaces
this resulted, after a restart, in the following situation:
Listening on LPF/wlan0/"mac address of wlan device"
Sending on LPF/wlan0/"mac address of wlan device"
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 20
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
No DHCP OFFERS received
...
, reverted back to static, as displayed under /etc/network/interfaces
sudo dhclient
from /etc/rc.local(to connect eth0 to get an ip address) and this was forcing wireless card(as sideffect) to ask for an ip to itself . I solved it usingsudo dhclient eth0
which made sure that only eth0 would be using dhcp client and not wlan0