Skip to content

Mercusys MW150US V2 ID 2c4e:0102

tux19730 edited this page Sep 7, 2020 · 20 revisions

After some trial and error my Mercusys MW150US V2 is working in a stable setup in AP mode with Kernel 3.8.0-19-generic i386.

Ubuntu 13.04 (GNU/Linux 3.8.0-19-generic i686) running in VirtualBox with 256MB RAM.

The driver version that i cloned from Iwfinger's repo is: v4.1.4_6773.20130222

Note that i used Iwfinger's hostapd version 0.8 that is included in the repository.

It worked but i had sometimes delays with connecting to the AP.

I was getting several entries in syslog from hostapd

    WPA: received EAPOL-Key 2/4 Pairwise with unexpected replay counter

And the phone toke multiple reconnection attemps to connect again.

Also only WPA-PSK was available with hostapd 0.8.

I switched to hostapd version 2.6 and a patch for rtl871xdrv driver support.

Thanks to pritambaral and his patch from here

    https://github.com/pritambaral/hostapd-rtl871xdrv

In this how to i used the driver and hostapd from Iwfingers repo.

So only WPA-PSK is available and connecting is delayed some times but working stable so far.

How to:

Get the Ubuntu iso from here http://old-releases.ubuntu.com/releases/13.04/ubuntu-13.04-server-i386.iso

Install minimal headless system in VirtualBox.

In VirtualBox as root, delete content of "/etc/apt/sources.list" and add the following:

################################

    deb http://old-releases.ubuntu.com/ubuntu/ raring main
    deb-src http://old-releases.ubuntu.com/ubuntu/ raring main
    deb http://old-releases.ubuntu.com/ubuntu/ raring-updates main
    deb-src http://old-releases.ubuntu.com/ubuntu/ raring-updates main
    deb http://old-releases.ubuntu.com/ubuntu/ raring universe
    deb-src http://old-releases.ubuntu.com/ubuntu/ raring universe
    deb http://old-releases.ubuntu.com/ubuntu/ raring-updates universe
    deb-src http://old-releases.ubuntu.com/ubuntu/ raring-updates universe
    deb http://old-releases.ubuntu.com/ubuntu raring-security main
    deb-src http://old-releases.ubuntu.com/ubuntu raring-security main
    deb http://old-releases.ubuntu.com/ubuntu raring-security universe
    deb-src http://old-releases.ubuntu.com/ubuntu raring-security universe

################################

    sudo su -
    cd
    apt-get update
    apt-get install linux-generic build-essential git wireless-tools dnsmasq
    git clone https://github.com/lwfinger/rtl8188eu
    cd rtl8188eu && make clean && make all && make install
    cd hostapd-0.8/hostapd
    cp -a defconfig .config
    make clean && make all && make install

On my host system (my laptop) i had to blacklist the Linux staging driver,

    rmmod r8188eu
    echo "blacklist r8188eu" > /etc/modprobe.d/50-blacklist-r8188eu.conf

Plugin your MW150US and attach it VirtualBox to the VM.

Check in VirtualBox how the Wlan interface is named.

Run

    modprobe 8188eu
    ip a

Or

    modprobe 8188eu
    iwconfig

My interface is "wlan0"

Edit "/etc/network/interfaces" and configure wlan0

################################

    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet dhcp

    auto wlan0
    iface wlan0 inet static
    address 192.168.0.1
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    post-up /usr/local/bin/hostapd.sh &
    pre-down /usr/bin/killall hostapd

################################

Create "/usr/local/etc/hostapd.conf" with the following content.

################################

    interface=wlan0
    ctrl_interface=/var/run/hostapd
    ssid=rtwap
    channel=10
    wpa=1
    wpa_passphrase=76543210
    uuid=12345678-9abc-def0-1234-56789abcdef0
    device_name=RTL8188EU
    manufacturer=Realtek
    model_name=RTW_SOFTAP
    model_number=WLAN_CU
    serial_number=12345
    device_type=6-0050F204-1
    os_version=01020300
    config_methods=label display push_button keypad
    driver=rtl871xdrv
    beacon_int=100
    hw_mode=g
    ieee80211n=1
    wme_enabled=1
    ht_capab=[SHORT-GI-20][SHORT-GI-40]
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=CCMP
    max_num_sta=8
    wpa_group_rekey=86400

################################

Create the script that does the magic when your VirtualBox VM starts.

    touch /usr/local/bin/hostapd.sh && chmod +x /usr/local/bin/hostapd.sh

This is the content of "/usr/local/bin/hostapd.sh"

################################

    #!/bin/bash

    /sbin/modprobe lib80211
    /sbin/modprobe cfg80211
    /usr/local/bin/hostapd -B /usr/local/etc/hostapd.conf >/dev/null 2>&1
    /usr/sbin/service dnsmasq restart >/dev/null 2>&1
    echo 1 > /proc/sys/net/ipv4/ip_forward
    /sbin/iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

################################

Configure "dnsmasq"

    touch /etc/dnsmasq.d/wlan0.conf

Content of "/etc/dnsmasq.d/wlan0.conf"

################################

    interface=wlan0
    domain=wlan0.local
    dhcp-range=192.168.0.50,192.168.0.150,12h
    dhcp-option=option:router,192.168.0.1
    dhcp-option=option:ntp-server,192.168.0.1
    # funny to see in /var/log/syslog what my phone is doing :)
    log-queries
    log-dhcp

################################

Remove package "resolvconf" from system

    apt-get autoremove resolvconf && apt-get purge resolvconf

add DNS server,

    echo "nameserver 192.168.89.1" > /etc/resolv.conf

Note that i have LXC containers on my system doing proxy, socks, VPN, DNS ... so my DNS server is 192.168.89.1

I have bridged my laptop, LXC containers and VirtualBox using a 192.168.89.0/24 subnet.

If you just want to provide Internet access with VirtualBox and the Wifi stick then no bridging is needed.

When you create the VirtualBox VM the default network setting is NAT so your VM will have Internet accesss through your hosts system (laptop).

In this case just add Google DNS servers in VirtualBox AP VM.

    echo "nameserver 8.8.8.8 8.8.4.4" > /etc/resolv.conf

Now reboot your VirtualBox VM and you should see a Wifi AP in your phone called "rtwap"

My AP VM RAM usage:

    root@hotspot ~ # free -m
         total       used       free     shared    buffers     cached
    Mem:           116         69         46          0         13         31
    -/+ buffers/cache:         23         92
    Swap:          475          0        475

You can also download my VirtualBox image so you just have to plugin your mw150us v2 wifi stick.

    ftp://pubftp.dyndns.org/ftp/Mw150usV2.tgz

SSID: MW150US

Wifi password: 87654321

Login: root

Password: Mw150usV2

AP IP from Wifi network: 192.168.0.1

Have fun!

Deshalb koennen Pinguine nicht fliegen.

Was nicht fliegt kann nicht abstuerzen!

Thank you Iwfinger for your time and work!

Clone this wiki locally