material material:
Hostapd (can compile sbo use his slackbuild please get in slackbuilds.org)
A machine (laptop, netbuk or whatever it is that has been build in wireless adapter [all the portable computer's wifi bs bs dipake here]) that have the wireless adapter. [here I use my asus eeepc notbuk 1215P with slackware-current]
A client (all mobile devices that supports wifi) [here I am using 1 mm pieces and 1 piece nokia E63]
Direct concocting his potion:
1. Configuration HOSTAPD: Edit the file /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=MyHotspot
country_code=ID
hw_mode=g
channel=1
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=test2011
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Description :
ssid = MyHotspot: please MyHotSpot filled with the name as you like
wpa_passphrase = test2011: please change the password that you want it
ssid = MyHotspot: please MyHotSpot filled with the name as you like
wpa_passphrase = test2011: please change the password that you want it
# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#
option domain-name-servers 208.67.222.222, 208.67.220.220;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none; ddns-updates off;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.200 192.168.0.229;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}
2. Start and Stop Hotspot Service: Create a new file with the name rc.hotspot in /etc/rc.d
Please create and edit this file:
# Nano /etc/rc.d/rc.hotspot
# Nano /etc/rc.d/rc.hotspot
#!/bin/sh
# Script to start/stop a hostapd-based access point
# edited for slackware distro
# Symbols for needed programs
IPTABLES=/usr/sbin/iptables
IFCONFIG=/sbin/ifconfig
DHCPD=/usr/sbin/dhcpd
HOSTAPD=/usr/sbin/hostapd
# Symbols for internal and external interfaces
NET_INT=wlan0
NET_EXT=ppp0
# IP address for the AP
INT_ADDR=192.168.0.1
case "$1" in
start)
echo "Starting AP mode for $NET_INT at address $INT_ADDR"
# Disable packet forwarding
echo 0 > /proc/sys/net/ipv4/ip_forward
# Stop any existing hostapd and dhcpd daemons
killall hostapd
killall dhcpd
#Set up forwarding
$IPTABLES -t nat -A POSTROUTING -o $NET_EXT -j MASQUERADE
$IPTABLES -A FORWARD -i $NET_EXT -o $NET_INT -m state
--state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -i $NET_INT -o $NET_EXT -j ACCEPT
# Enable packet forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# Get the internal interface in the right state
$IFCONFIG $NET_INT down
$IFCONFIG $NET_INT up
$IFCONFIG $NET_INT $INT_ADDR
# dhcpd needs to have a leases file available - create it if needed
if [ ! -f /var/state/dhcp/dhcpd.leases ]; then
touch /var/state/dhcp/dhcpd.leases
fi
# Bring up the DHCP server
$DHCPD -cf /etc/dhcpd.conf $NET_INT
# Bring up hostapd
$HOSTAPD -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf
;;
stop)
echo "Stopping AP mode on $NET_INT"
# Stop hostapd and dhcpd daemons
kill -INT $(cat /var/run/hostapd.pid)
kill -INT $(cat /var/run/dhcpd.pid)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
Jika anda ingin saat booting slackware anda script ini aktif maka masukan ini di rc.local #nano /etc/rc.d/rc.local
# Start hotspot service
if [ -x /etc/rc.d/rc.hotspot ]; then
. /etc/rc.d/rc.hotspot start
fi
The next stage is to create an executable file into a way rc.hotspot
#chmod + x /etc/rc.d/rc.hotspot
If already please run your hotspot
# / etc / rc.d / rc.hotspot start
finished
#chmod + x /etc/rc.d/rc.hotspot
If already please run your hotspot
# / etc / rc.d / rc.hotspot start
finished
Tidak ada komentar:
Posting Komentar