Tag Archive for wifi

mt7601U Wifi dongle telepítése Raspberry Pi2-re

Frissítünk GCC-4.7re:

apt-get install gcc-4.7
rm /usr/bin/gcc
ln -s /usr/bin/gcc-4.7 /usr/bin/gcc

letöltjük a driver forrást (https://github.com/porjo/mt7601):

mt7601-master vagy

git clone https://github.com/porjo/mt7601.git

majd

$ cd mt7601/src
$ make
$ mkdir -p /etc/Wireless/RT2870STA/
$ cp RT2870STA.dat /etc/Wireless/RT2870STA/
$ insmod os/linux/mt7601Usta.ko

majd config:

auto ra0
allow-hotplug ra0
iface ra0 inet dhcp
wpa-ssid "ENTER YOUR NETWORK SSID"
wpa-psk "ENTER YOUR NETWORK PASSWORD"

és próba:

ifup ra0

 

Wifi dongle driver fordítás

My wireless dongle is ath9k_htc driver needs. So download the backports package.

Unzip.

make clean

than

make defconfig-ath9k

than

make && make modules && make modules_install

Old:

Mert már eljátszottam párszor, de mindig elfelejtem:

3.0.36-os kernelnek jó a compat-2.6 (elérhető itt) is de pl. 3.10.7-nek már nem. ezért töltsük le csak a driver-t. link

ha megvan, akkocs csomagoljuk ki.

Majd válasszunk driver-t. (Én egy TP-LINK TL-WN422G v2 -et használok. drivere: ath9k_htc)

Belelépünk a kicsomagolt könyvtárba, majd:

./scripts/driver-select ath9k_htc

Ezek után:

make

majd feltesszük a lefordított driver-t:

make install

Ezt követően, elindítjuk a drivert:

modprobe ath9k_htc

Majd ne felejtsük el elindítani az eszközt és a hostapd-t:

/etc/init.d/net.wlan0 restart && /etc/init.d/hostapd restart

 

Wifi AP készítése

Procedure

apt-get install dhcp3-server hostapd

Modify /etc/hostapd/hostapd.conf and put the following

interface=wlan0
driver=nl80211
ssid=ronhks
hw_mode=g
channel=11
wpa=3
wpa_passphrase=<PASSWORD>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

 

The dhcpd.conf section in /etc/dhcp3/dhcpd.conf would have something like the following

subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.25 10.10.0.50;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}

Modify /etc/default/dhcp3-server

INTERFACES="wlan0"

Check what name your adapter got via iwconfig. You can change the name also and make it persistent via /etc/udev/rules.d/70-persistent-net.rules so that it always gets a single type of name. In our example we’re assuming wlan0, but it could be changed. Make necessary changes in your configuration too.

Configure the new interface

ifconfig wlan0 10.10.0.1

The above could also be done in a better way via the /etc/network/interfaces file, but didn’t try it out. In any case if you shutdown hostapd, the network interface (wlan0) loses its address, so need to put a script which assigns it again before hostapd is started. An example could be

iface wlan0 inet static
 address 10.10.0.1
 netmask 255.255.255.0

Restart the dhcp3-server. It should now be ready to serve addresses and is also bound to the network interface too.

Allow ip masquerading

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Now start hostapd and see the messages that it shows

hostapd -dd /etc/hostapd/hostapd.conf

Wait for a few seconds, it should show some probes being done by other wifi devices. If it shows, then probably you’re in good luck.

Now try to connect via your device to this access point. It should work.

To make this work on boot, can put the relevant config in /etc/default/hostapd

RUN_DAEMON="yes"
DAEMON_CONF="/etc/hostapd/hostapd.conf"
DAEMON_OPTS="-dd"

and also put the firewall rules in /etc/rc.local (make sure its executable).

Remember – if you shutdown your hostapd, the network card would lose its address. So you have to assign that again before starting hostapd. The usual practice would be

  • Stop hostapd
  • Stop dhcp server
  • Restart network (or rather ifup wlan0 / ifconfig wlan0 10.10.0.1 would do)
  • Restart dhcp server
  • Start hostapd

Miscellaneous

  1. You can check the wifi interfaces via
    iwconfig
  2. To set a wifi adapter into master mode, try the following. If it doesn’t work and shows an error that it’s not possible or something, fret not – use hostapd as that’ll do that in any case.
    iwconfig wlan0 mode Master
  3. Network Manager could create issues, though in my test environment – instead of using an ethernet interface, I used two wlan interfaces, one being controlled by Network Manager for internet access, and other for making it an access point.
  4. modprobe -r ath5k / modprobe -r rt2800usb etc. is to be used for unloading the modules.
  5. If you wish to proceed without using authentication so that you can test it easy, then put the following in /etc/hostapd/hostapd.conf
    interface=wlan0
    driver=nl80211
    ssid=MyAP
    hw_mode=g
    channel=11