Cara Membuat Hotspot di Linux Deepin (Debian)
1. Open terminal and type:
sudo apt-get install hostapd dnsmasq
2.
sudo service hostapd stop
sudo service dnsmasq stop
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable
3. You need edit dnsmasq.conf
sudo gedit /etc/dnsmasq.conf
Then add following content to the end of 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
4. Edit hostapd.conf
sudo gedit /etc/hostapd.conf
Add following content to 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
Note that: you have set a hotspot called myhotspot(seeline 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 followingcontent 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
6.Save it and open a terminal:
sudo ./start_hotspot.sh
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!
https://bbs.deepin.org/archiver/?tid-114960.html
sudo apt-get install hostapd dnsmasq
2.
sudo service hostapd stop
sudo service dnsmasq stop
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable
3. You need edit dnsmasq.conf
sudo gedit /etc/dnsmasq.conf
Then add following content to the end of 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
4. Edit hostapd.conf
sudo gedit /etc/hostapd.conf
Add following content to 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
Note that: you have set a hotspot called myhotspot(seeline 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 followingcontent 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
6.Save it and open a terminal:
sudo ./start_hotspot.sh
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!
https://bbs.deepin.org/archiver/?tid-114960.html
Comments
Post a Comment
-Berkomentarlah yang baik dan rapi.
-Menggunakan link aktif akan dihapus.