I'm setting up a pi as a gateway using iptables.
Both wlan0 and eth0 have static IPS. All is well with iptables forwarding.
However, when I reboot, wlan0 sometimes fails to connect to the ssid (there is only one set up, using WEP). Using the UI tool connects it OK. As it's going to be headless this is not a practical option.
Similarly, if I disconnect and reconnect the ethernet cable, wlan0 will sometimes disconnect from the ssid.
Note the "sometimes" - it's about 50% of the time this happens.
Been playing around a bit with /etc/network/interfaces - current state is as follows (IPs are test bench only, will be changed for the real world!)
auto lo
#auto lo eth0 wlan0
iface lo inet loopback
#iface eth0 inet dhcp
iface eth0 inet static
address 10.1.1.1
network 10.1.1.0
netmask 255.255.255.192
broadcast 10.1.1.63
# gateway 10.1.1.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
iface default inet static
address 192.168.1.219
network 192.168.1.192
netmask 255.255.255.192
broadcast 192.168.1.255
gateway 192.168.1.193
- that doesn't explain to me why it sometimes connects, sometimes doesn't: when connected it's working exactly as expected at the IP level.
Here is wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Barn"
key_mgmt=NONE
auth_alg=OPEN
wep_key0=12345678901234567890123456
}
It almost feels like I need whatever the command-line is behind the "connect" button in the UI tool put into (say) rc.local to give it a kick--.