Originally Posted by
timo2
Hey all,
At the moment I'm using only Ubuntu at my notebook and I'd to create a wireless network like
in Windows 7.
I used the command line and used the 'netsh wlan' command for it.
In Ubuntu I found a function to create a wireless network but with every try a Windows notebook
is throwing me out the following error: 'Wrong password'.
I tried it like this too:
http://www.howtogeek.com/116409/how-...-access-point/
But at my computer there are not that much options.
I'm running the newest Ubuntu version
You can't do it with Create Wireless on Network Manager. It's just creating an ad-hoc network. Android phones can't connect over ad-hoc network.
You must use hostapd to create an infrastructure wireless network (Access Point/AP mode). You need an AP-capable wireless adapter. Check your wireless capabilities by issuing
Code:
sudo iw list | more -d
If you find AP bellow supported modes, you can proceed to next step. Else, you need another wireless card.
Install hostapd to act as wireless access point daemon and dnsmasq as dhcp+dns server
Code:
sudo apt-get install hostapd dnsmasq
Then, configure hostapd to act as wireless access point. Make a configuration file /etc/hostapd/hostapd.conf to use with hostapd
Code:
interface=wlan0driver=nl80211
ssid=your_wifi_name_here
hw_mode=g
channel=1
# If your card supports n mode, make these two lines uncommented (remove # sign).
#wme_enabled=1
#ieee80211n=1
# If you want full wireless N speed, uncomment the line bellow
#ht_capab=[HT40+] [SHORT-GI-40]
macaddr_acl=0
auth_algs=1
wpa=2
wpa_passphrase=your_passphrase_here
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
And add the following line to /etc/network/interfaces to assign a static ip address on wlan0 (as gateway to other clients)
Code:
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
Configure dnsmasq to act as DHCP server on interface wlan0
file /etc/dnsmasq.conf (you can copy the original file elsewhere as backup and create a new one)
Code:
# The line bellow tells dnsmasq to assign ip address randomly between 192.168.1.150 and 192.168.1.160 (11 ip addresses)
# If you need more clients, modify as needed
dhcp-range=wlan0,192.168.1.150,192.168.1.160,2h
# The line bellow fixes a DHCP bug on Windows 7
dhcp-option=252,"\n"
Launch these commands in correct order to start your wifi.
Code:
sudo sysctl net.ipv4.ip_forward=1 #to enable ipv4 forwarding
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE #to enable routing through ppp0
sudo hostapd -B /etc/hostapd/hostapd.conf #to start hostapd in the background
sudo ifup wlan0 #to bring up wlan0 interface
sudo service dnsmasq restart #to restart dnsmasq with a new configuration
That's it! If you want to end your wifi session, issue these commands
Code:
sudo killall hostapd
sudo ip link set wlan0 down
sudo iptables -t nat -D POSTROUTING -o ppp0 -j MASQUERADE
sudo sysctl net.ipv4.ip_forward=0
Good luck.
Bookmarks