Tuesday, May 22, 2012

Create AD-HOC in debian on virtualbox when host internet sharing is disabled

For some reason my Windows Internet Sharing is disabled by system administrator, yet I still want to use ad-hoc for my mobile devices. So I decided to use virutalbox + linux to create a wireless ad-hoc server.

I chosed debian net installation disk because it is small & clean, I dont need any GUI evironment so I choosed a minimum installation with ssh server, added a port forward on port 22 in virtualbox so I can putty to 127.0.0.1 22 to access the virtual machine.

You need to install your wireless card driver on linux, this progress is pain, you can either download the linux driver from official website or check if it is ndiswrapper supported from http://sourceforge.net/apps/mediawiki/ndiswrapper/index.php?title=Category:WORKS

You will need to add the default module into the /etc/modprobe.d/blacklist.conf & loaded the module to /etc/modules after installation. I received a RTL8188CUS wireless card, it is tiny & luckly the official website provides the download of the driver for linux.

you prbably need to install build-essential & some packages first.

apt-get install build-essentialapt-get install dnsmasq wireless-tools

Edit /etc/sysctl.conf
unmment the line

net.ipv4.ip_forward=1

Edit your /etc/network/interfaces

auto wlan0iface wlan0 inet staticaddress 192.168.0.2netmask 255.255.255.0wireless-essid test_essidwireless-mode ad-hocwireless-key 1234567890 #this is a WEP password, for WPA please check herewireless-channel 11

Edit /etc/dnsmasq.conf

dhcp-range 192.168.0.3,192.168.0.150,12h
echo 1 > /proc/sys/net/ipv4/ip_forwardiptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE/etc/init.d/networking restartservice dnsmasq restart

Now try to connect the device to the ad-hoc, wireless on the fly

No comments:

Post a Comment