1

I've been trying to nail down the WiFi on my pi. In short its frustratingly unreliable when it starts up. I'm want it to be on a static IP and to

Currently I have a monitor hooked up to the pi for debugging this. eth0 is unplugged. This is the behavior currently:

  • Boot
  • ping router: Destination Host Unreachable
  • Run sudo ifdown eth0
  • now the wifi works, but with dhcp ip, not static ip(sometimes it is, sometimes not)

I've finally refined the problem down to the idea that the eth0 interface is interfering with wlan0 or there's a routing problem. I just don't understand how. I'm still new to linux networking.

If anyone can point me in the right direction, I'd appreciate it :) Thank you in advance


The setup:

/etc/network/interfaces

auto eth0
allow-hotplug eth0
#iface eth0 inet manual
iface eth0 inet static
        address 192.168.2.211
        netmask 255.255.255.0
        gateway 192.168.2.1

audo wlan0
allow-hotplug wlan0
iface wlan0 inet manual
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface home inet manual
        address 192.168.2.212
        netmask 255.255.255.0
        gateway 192.168.2.1

wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="myssid"
        scan_ssid=1
        key_mgmt=WPA-PSK
        proto=RSN
        psk="************"
#       pairwise=CCMP
#       auth_alg=OPEN
        id_str="home"
}

Route table right after boot with route -n

Kernel IP routing table
Destination    Gateway      Genmask          Flags Metric  Ref  Use Iface
0.0.0.0        192.168.2.1  0.0.0.0          UG    0       0      0 eth0
0.0.0.0        192.168.2.1  0.0.0.0          UG    303     0      0 wlan0
192.168.2.0    192.168.2.1  255.255.255.0    UG    0       0      0 eth0
192.168.2.0    192.168.2.1  255.255.255.0    UG    303     0      0 wlan0

I know the Wireless is connected both at boot and after ifdown eth0

pi@octopi ~ $ iwconfig ; ifconfig
wlan0     IEEE 802.11bgn  ESSID:"myssid"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.432 GHz  Access Point: 00:11:22:33:44:55
          Bit Rate:150 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=81/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


eth0      Link encap:Ethernet  HWaddr b8:27:eb:35:43:0f
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          ...
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          ...


wlan0     Link encap:Ethernet  HWaddr 74:da:38:83:a8:b0
          inet addr:192.168.2.102  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1234 errors:0 dropped:93 overruns:0 frame:0
          TX packets:347 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:192425 (187.9 KiB)  TX bytes:85591 (83.5 KiB)

Note: My static ip is outside the dhcp pool.

  • Is audo wlan0 in your interfaces file a typo? – clk Jul 17 '16 at 19:40
  • Technicaly yes. (You have know idea how many times I've scanned through that file looking for stupid things like that) – Cyberzoid Jul 17 '16 at 19:47
  • Unfortunately That was not the issue. Just fixed it and ran though the test. Same exact behavior. – Cyberzoid Jul 17 '16 at 19:48
  • Does changing manual to static in iface wlan0 inet manual and iface home inet manual do anything? – clk Jul 17 '16 at 19:54
  • If tried changing them before. Just now with static/static wifi just doesnt configure. Now with manual/static the ip is now on the static ip; however the eth0 issue is still there. I can only connect, or ping after ifdown eth0 – Cyberzoid Jul 17 '16 at 20:02
0

Each interface is supposed to have different IP addresses as they are different networks, unless you issue configurations to bridge them; in normal conditions they cannot both belong to 192.168.2.0/24.

So I do advise creating a br0 (bridge interface), that will represent both interfaces, and giving only a single address to that virtual interface; in that way you can gave both interfaces defined with the same IP address.

Be aware ethernet when connected, by default, has routing precedence over wifi.

auto eth0
allow-hotplug eth0
iface eth0 inet manual
    bridge_stp off


auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    bridge_stp off

auto br0
iface br0 inet static
bridge_ports eth0 wlan0
    address 192.168.2.211
    netmask 255.255.255.0
    gateway 192.168.2.1
    bridge_stp off
  • Awesome, kinda 3 steps forward and 1 step back. I have full networking at boot. However I'm no longer getting the static ip only the dhcp ip. Running ifconfig I only see eth0, lo, & wlan0. no br0. not sure if thats normal for a bridge. – Cyberzoid Jul 17 '16 at 20:37
  • It is pretty normal for a bridge. What is the output of ps ax | grep dhc – Rui F Ribeiro Jul 17 '16 at 23:13
  • Its (hand typed) Ss 0:00 /sbin/dhcpcd S+ 0:00 grep --color=auto dhc I've been looking up bridging tutorials here and here but cant seem to get it to setup. – Cyberzoid Jul 18 '16 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.