Debian – Wireless interface only reachable when ethernet cable plugged in

debianrealtekwifi

I'm facing a problem that's about to drive me crazy. I'm running a Debian Linux distribution and currently trying to establish a connection to my wireless network (WPA2 security, wpa_supplicant already installed). The wireless dongle connects to the network, but it only responds to pings and lets me connect through SSH from another computer when the ethernet cable is plugged in. It is still reachable via wireless connection after unplugging the ethernet connection, but it won't work until a connection to a wired network had been created. I'm not sure if anything's wrong with my configuration here…

Output of 'ifconfig wlan0':

wlan0     IEEE 802.11bgn  ESSID:"*censored*"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.457 GHz  Access Point: *censored*  
          Bit Rate:72.2 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=89/100  Signal level=58/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

Contents of /etc/network/interfaces

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
    address 192.168.178.130
    netmask 255.255.255.0

allow-hotplug wlan0
iface wlan0 inet static
    wpa-ssid "*censored*"
    wpa-key-mgmt WPA-PSK
    wpa-group TKIP CCMP
    wpa-psk *censored*
    address 192.168.178.131
    netmask 255.255.255.0
    gateway 192.168.178.1

Best Answer

You shouldn't use the same network address for wlan0 and eth0 (in your case 192.168.178.0/24), this will confuse your routing, and most likely network scripts too. If both interfaces are connected to the same network you should setup a network bond (Debian documentation here, example here)

# apt-get install ifenslave

then in /etc/network/interfaces

auto lo
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-ssid "*censored*"
    wpa-key-mgmt WPA-PSK
    wpa-group TKIP CCMP
    wpa-psk *censored*
    wpa-bridge bond0 # fixes mac address of outgoing packets so that they are consistent
    bond-master bond0
    bond-mode active-backup 
    bond-miimon 100 # checks link status every 100 msec
    bond-give-a-chance 10 # when wlan comes up wait up to 10 seconds for it to 

allow-hotplug bond0
iface bond0 inet static
    address 192.168.178.130
    netmask 255.255.255.0
    gateway 192.168.178.1
    bond-slaves eth0 # automatically brings up eth0 and slaves it to this bond
    bond-mode active-backup # uses primary if available, otherwise fallback to other
    bond-primary eth0 # priority to use eth0 when available
    bond-miimon 100
Related Question