Using a Realtek 802.11n dongle with Unipi



  • Setting up some Unipi's to talk to a central (HA/scalable) server here. Since wired as well as wireless connection to the unipis was required, we got a few Realtek wifi dongles. Follows a braindump to recall it later and free for anyone else to use.

    Lets get the kernel modules first:

    wget http://www.mendrugox.net/downloads/20 -O raspi
    scp -r raspi pi@192.168.2.222:~
    
    

    SSH into the RPi and to load the module

    sudo su
    cd raspi
    sudo cp *.ko /lib/modules/3.12.28+/kernel/drivers/net/wireless/
    sudo cp *.bin /lib/firmware/rtlwifi/
    sudo depmod -a
    sudo echo 8188eu >> /etc/modules
    sudo modprobe 8188eu
    
    

    Now, we want the RPi to acquire a fixed IP (192.168.2.222) when connected to LAN and use the GW 192.168.0.1 and we also want the RPi to lease an IP from DHCP when wifi dongle is connected to it. To do this, we want to change /etc/network/interfaces accordingly:

    sudo echo '
    auto lo
    
    iface lo inet loopback
    iface eth0 inet static
    address 192.168.2.222
    netmask 255.255.255.0
    gateway 192.168.0.1
    
    allow-hotplug wlan0
    auto wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    ' > /etc/network/interfaces 
    
    

    We need to setup wpa supplicant. Assuming your wifi has the ssid "MYSSID" and password "YOUSHALLPASS", then

    sudo wpa_passphrase MYSSID YOUSHALLPASS
    
    

    whcih reutrns

    network={
            ssid="MYSSID"
            #psk="YOUSHALLPASS"
            psk=74d000273e94452d31a3e0ec32d87b8ac52dd3e31f1448a41b8d98ea99abafa0
    }
    
    

    which you need to put into your wpa_supplicant.conf. The complete conf file looks like this

    sudo echo '
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    
    network={
            ssid="MYSSID"
            #psk="YOUSHALLPASS"
            psk=74d000273e94452d31a3e0ec32d87b8ac52dd3e31f1448a41b8d98ea99abafa0
            key_mgmt=WPA-PSK
            pairwise=CCMP
            auth_alg=OPEN
    }
    ' >  /etc/wpa_supplicant/wpa_supplicant.conf
    
    

    To prevent the dongle to go to sleep whenever you don't need it, disable power management:

    sudo echo '
    # Disable power management
    options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
    ' > /etc/modprobe.d/8188eu.conf
    
    

    If you still get random disconnects, get closer to your AP (that actually helped, the dongle is crap when it comes to signal strength). Hope this helps.



  • Setting up some Unipi's to talk to a central (HA/scalable) server here. Since wired as well as wireless connection to the unipis was required, we got a few Realtek wifi dongles. Follows a braindump to recall it later and free for anyone else to use.

    Lets get the kernel modules first:

    wget http://www.mendrugox.net/downloads/20 -O raspi
    scp -r raspi pi@192.168.2.222:~
    
    

    SSH into the RPi and to load the module

    sudo su
    cd raspi
    sudo cp *.ko /lib/modules/3.12.28+/kernel/drivers/net/wireless/
    sudo cp *.bin /lib/firmware/rtlwifi/
    sudo depmod -a
    sudo echo 8188eu >> /etc/modules
    sudo modprobe 8188eu
    
    

    Now, we want the RPi to acquire a fixed IP (192.168.2.222) when connected to LAN and use the GW 192.168.0.1 and we also want the RPi to lease an IP from DHCP when wifi dongle is connected to it. To do this, we want to change /etc/network/interfaces accordingly:

    sudo echo '
    auto lo
    
    iface lo inet loopback
    iface eth0 inet static
    address 192.168.2.222
    netmask 255.255.255.0
    gateway 192.168.0.1
    
    allow-hotplug wlan0
    auto wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    ' > /etc/network/interfaces 
    
    

    We need to setup wpa supplicant. Assuming your wifi has the ssid "MYSSID" and password "YOUSHALLPASS", then

    sudo wpa_passphrase MYSSID YOUSHALLPASS
    
    

    whcih reutrns

    network={
            ssid="MYSSID"
            #psk="YOUSHALLPASS"
            psk=74d000273e94452d31a3e0ec32d87b8ac52dd3e31f1448a41b8d98ea99abafa0
    }
    
    

    which you need to put into your wpa_supplicant.conf. The complete conf file looks like this

    sudo echo '
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    
    network={
            ssid="MYSSID"
            #psk="YOUSHALLPASS"
            psk=74d000273e94452d31a3e0ec32d87b8ac52dd3e31f1448a41b8d98ea99abafa0
            key_mgmt=WPA-PSK
            pairwise=CCMP
            auth_alg=OPEN
    }
    ' >  /etc/wpa_supplicant/wpa_supplicant.conf
    
    

    To prevent the dongle to go to sleep whenever you don't need it, disable power management:

    sudo echo '
    # Disable power management
    options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
    ' > /etc/modprobe.d/8188eu.conf
    
    

    If you still get random disconnects, get closer to your AP (that actually helped, the dongle is crap when it comes to signal strength). Hope this helps.