PDA

View Full Version : Kali linux as wifi repeater



imabuvu
2013-04-12, 21:29
Does anyone know how i could set up Kali as a wifi repeater for my smartphone ?

sincera
2013-04-12, 21:54
you want to bridge your eth0 to wlan0 to create a wifi access point yes?

charonsecurity
2013-04-13, 02:57
There are several ways to go about this. Though I think you will need two wireless interfaces.
I found a good link that might point you in the right direction, I hope it helps:)
https://www.linuxquestions.org/questions/linux-wireless-networking-41/can-i-turn-my-ubuntu-or-debian-box-into-a-wireless-repeater-881510/

Vulpi
2013-04-13, 03:10
This can be done easily with airbase-ng, but I don't think it can be encrypted. This means you will be running an open network, from an unfamiliar OS, as root: perhaps not the best idea!

Darkestshadow
2013-04-14, 09:19
I use connectify for windows, don't think they have a linux version though


www.connectify.me

imabuvu
2013-04-15, 02:48
How would i set that up - my operating system on my laptop is kali linux and i want to repeat the signal from my laptop to my iphone to improve iphone signal strenghth

Neonsavior
2013-04-16, 18:09
I used udhcpd and hostapd with two wireless interfaces to create a Wireless AP for other devices to connect to and share my computers stronger wireless connection. I used Kali linux on the raspberry pi but it should work with other flavors too.

Change all the interfaces mentioned below to whatever you need. I used wlan1 for an internet connection and wlan0 to host the AP but substitute your own setup or this wont work.

I used wpa_supplicant wireless extensions to connect to a WPA AP from the command line. You can skip this part if you are going to use a network manager, but otherwise you need to create a profile for the network you are connecting to in /etc/wpa_supplicant.conf

network={
ssid="ap's_ssid"
psk="password"
}

or if there isn't a password use
key_mgmt=NONE instead of psk="password"

apt-get install Hostapd and Udhcpd. Once they are installed we need to configure both. Starting with udchpd.


Declare your subnet in /etc/udhcpd.conf add the following lines to the end of the file and comment out the matching lines...or just alter the originals.

start 192.168.42.2 #default: 192.168.0.20
end 192.168.42.20 #default: 192.168.0.254
opt dns 8.8.8.8 4.2.2.2
option subnet 255.255.255.0
opt router 192.168.42.1


And while in /etc/udhcpd.conf configure udhcpd to use the interface you intend to host your Access-point with.

# The interface that udhcpd will use

interface wlan0 #default: eth0

Edit /etc/default/udhcpd and comment out this line:

#DHCPD_ENABLED="no"


Now we are done configuring udhcpd we need to set up Hostapd. Edit
/etc/hostapd/hostapd.conf* and create a profile for your Access-point. I'm posting my settings as a guide but change the settings to meet your needs:


interface=wlan0
ssid=Linksys
channel=11
macaddr_acl=0
auth_algs=1
wpa=2
ignore_broadcast_ssid=0
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Edit /etc/default/hostapd and add the following line:
DAEMON_CONF="/etc/hostapd/hostapd.conf"


Now edit /etc/sysctl.conf and enable forwarding by uncommenting this line:

net.ipv4.ip_forward=1



I wrote a script to automate the rest of the process. It connects to the wireless access point. Creates your AP usng hostapd and the dhcp server and finally configures iptables and the bridge.* This is my current set-up but you will need to edit to work for you. The echoes and sleep* were put in for troubleshooting and can probably be changed or removed.




#!/bin/sh

echo "* STOPPING SERVICES *"
service hostapd stop
service udhcpd stop


echo "* MANAGING INTERFACES *"
ifconfig wlan1 down
ifconfig wlan0 down
sleep 2

echo "* CONNECTING TO WIRELESS AP *"
wpa_supplicant -B -iwlan1 -c/etc/wpa_supplicant.conf -Dwext

echo "* STARTING DHCP AND OBTAINING IP ADDRESS *"
sleep 5
dhclient wlan1
sleep 5

echo "* SETTING UP ROUTES *"

sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
sudo iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT
sleep 5
ifconfig wlan0 192.168.42.1

echo "* STARTING ACCESS-POINT *"

killall -9 dhclient
service hostapd start
service udhcpd start