help! how to create hotspot wifi in linux deepin
Tofloor
poster avatar
yilang2007lw
deepin
2013-08-14 07:28
Author
Sorry for currently not support by deepin-system-settings network module, but you can install the origin network-manager-gnome package for tempory use. After install, you can just start it by typing nm-applet in gnome-terminal, then manage you hostspot connection by click the icon in system tray icon area.
Reply Favorite View the author
All Replies
tommy
deepin
2013-08-24 06:59
#1
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
Hi ,ultrahen
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:
  1. sudo apt-get install hostapd dnsmasq
Copy the Code
2.
  1. sudo service hostapd stop
  2. sudo service dnsmasq stop
  3. sudo update-rc.d hostapd disable
  4. sudo update-rc.d dnsmasq disable
Copy the Code
3. You need edit dnsmasq.conf
  1. sudo gedit /etc/dnsmasq.conf
Copy the Code
Then add following content to the end of dnsmasq.conf
  1. # Bind to only one interface
  2. bind-interfaces
  3. # Choose interface for binding
  4. interface=wlan0
  5. # Specify range of IP addresses for DHCP leasses
  6. dhcp-range=192.168.150.2,192.168.150.10
Copy the Code
4. Edit hostapd.conf
  1. sudo gedit /etc/hostapd.conf
Copy the Code
Add following content to hostapd.conf
  1. # Define interface
  2. interface=wlan0
  3. # Select driver
  4. driver=nl80211
  5. # Set access point name
  6. ssid=myhotspot
  7. # Set access point harware mode to 802.11g
  8. hw_mode=g
  9. # Set WIFI channel (can be easily changed)
  10. channel=6
  11. # Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
  12. wpa=2
  13. wpa_passphrase=yourpassword
Copy the Code
Note that: you have set a hotspot called myhotspot(see  line 6: ssid=myhotspot), the password is yourpassword(see line 13: wpa_passphrase=yourpassword), you can change the password to any string you want.

5. Create a script in you home directory, take start_hotspot.sh for example:
copy following  content into it:
  1. #!/bin/bash
  2. # Start
  3. # Configure IP address for WLAN
  4. sudo ifconfig wlan0 192.168.150.1
  5. # Start DHCP/DNS server
  6. sudo service dnsmasq restart
  7. # Enable routing
  8. sudo sysctl net.ipv4.ip_forward=1
  9. # Enable NAT
  10. sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
  11. # Run access point daemon
  12. sudo hostapd /etc/hostapd.conf
  13. # Stop
  14. # Disable NAT
  15. sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
  16. # Disable routing
  17. sudo sysctl net.ipv4.ip_forward=0
  18. # Disable DHCP/DNS server
  19. sudo service dnsmasq stop
  20. sudo service hostapd stop
Copy the Code
6.Save it and open a terminal:
  1. sudo ./start_hotspot.sh
Copy the Code
The output maybe like this:

* 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 View the author