tommy
2013-08-24 06:59 deepin
can someone help to how to create wifi hostpos in linux deepin, so my android device can connect to internet from hostpot in my laptop
You can create a script to achieve this function. I'm using it now. It is easy and works very well.
1. Open terminal and type:
- sudo apt-get install hostapd dnsmasq
- sudo service hostapd stop
- sudo service dnsmasq stop
- sudo update-rc.d hostapd disable
- sudo update-rc.d dnsmasq disable
- sudo gedit /etc/dnsmasq.conf
- # Bind to only one interface
- bind-interfaces
- # Choose interface for binding
- interface=wlan0
- # Specify range of IP addresses for DHCP leasses
- dhcp-range=192.168.150.2,192.168.150.10
- sudo gedit /etc/hostapd.conf
- # Define interface
- interface=wlan0
- # Select driver
- driver=nl80211
- # Set access point name
- ssid=myhotspot
- # Set access point harware mode to 802.11g
- hw_mode=g
- # Set WIFI channel (can be easily changed)
- channel=6
- # Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
- wpa=2
- wpa_passphrase=yourpassword
5. Create a script in you home directory, take start_hotspot.sh for example:
copy following content into it:
- #!/bin/bash
- # Start
- # Configure IP address for WLAN
- sudo ifconfig wlan0 192.168.150.1
- # Start DHCP/DNS server
- sudo service dnsmasq restart
- # Enable routing
- sudo sysctl net.ipv4.ip_forward=1
- # Enable NAT
- sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
- # Run access point daemon
- sudo hostapd /etc/hostapd.conf
- # Stop
- # Disable NAT
- sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
- # Disable routing
- sudo sysctl net.ipv4.ip_forward=0
- # Disable DHCP/DNS server
- sudo service dnsmasq stop
- sudo service hostapd stop
- sudo ./start_hotspot.sh
* Restarting DNS forwarder and DHCP server dnsmasq [ OK ]
/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
net.ipv4.ip_forward = 1
Configuration file: /etc/hostapd.conf
Failed to update rate sets in kernel module
Using interface wlan0 with hwaddr xxxxxxxxx and ssid 'myhotspot'
DONE!
Turn on your android WiFi, you'll find a new wifi named "myhotspot".
Reply Like 0 View the author