Estou tentando usar um raspberrypi (OS = raspbian 4.0.7) que eu tinha voando por aí, então pesquisei um pouco e tudo parece funcionar mais ou menos bem.
Estou usando o hostapd em combinação com um dongle wifi para oferecer um AccessPoint e dhcpd como servidor DHCP.
Passando pelos registros, encontrei algo estranho:
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
Por que isso está acontecendo? E como posso pará-lo?
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)
configuração do dhcpd:
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;
}
EDITAR:
/ 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
EDITAR
para tentar consertar este problema, alterei o wlan0 de static para dhcp em / etc / network / interfaces
isso resultou, após um reinício, na seguinte situação:
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
...
, revertido para estático, conforme exibido em / etc / network / interfaces