{"id":401,"date":"2019-05-02T17:24:13","date_gmt":"2019-05-02T16:24:13","guid":{"rendered":"http:\/\/pruszewicz.com\/wordpress\/?p=401"},"modified":"2019-05-06T09:53:10","modified_gmt":"2019-05-06T08:53:10","slug":"quick-linux-wifihotspot","status":"publish","type":"post","link":"http:\/\/pruszewicz.com\/wordpress\/quick-linux-wifihotspot\/","title":{"rendered":"quick linux wifihotspot"},"content":{"rendered":"<p>To launch a basic wifi hotspot you need: iwconfig, iptables, dnsmasq, hostapd on your Linux box. Install it. Enable it (systemct enable).<\/p>\n<p>To search what package a file belongs to, help youself an use:<\/p>\n<pre><code>apt-filesearch\u00a0package<\/code><\/pre>\n<p>or<\/p>\n<pre><code>pacman -Fys package<\/code><\/pre>\n<p>Check if your system is compatibile with hostap, use iwconfig to list interfaces.<\/p>\n<pre>\r\n<code>\r\n$ iwconfig\r\nwlan0     IEEE 802.11  ESSID:off\/any\r\n          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm\r\n          Retry short limit:7   RTS thr=2347 B   Fragment thr:off\r\n          Power Management:on\r\n\r\neth0      no wireless extensions.\r\n\r\nlo        no wireless extensions.\r\n<\/code>\r\n<\/pre>\n<p>Edit or create desired files.<\/p>\n<p>For dnsmasq use your internal adress space.<\/p>\n<pre><code>#\r\n# \/etc\/dnsmasq\/dnsmasq.conf\r\n#\r\ndhcp-range=192.168.1.64,192.168.1.128,12h<\/code><\/pre>\n<p>For Debian edit \/etc\/default\/dnsmasq and add following:<\/p>\n<pre><code>DAEMON_CONF=\"\/etc\/hostapd\/hostapd.conf\"<\/code><\/pre>\n<p>For hostpad, change parameters for interface (interface), name of your wifi network (ssid), wifimode (hw_mode), channel (channel), password (wpa_passphrase), and use or not isolation (ap_isolate), hide your wifi or not (ignore_broadcast_ssid).<\/p>\n<pre><code>#\r\n# \/etc\/hostapd\/hostapd.conf\r\n#\r\ninterface=wlan0\r\ndriver=nl80211\r\nhw_mode=g\r\n#ieee80211n=0\r\n#ieee80211n=1\r\nchannel=4\r\nssid=private\r\n\r\nauth_algs=1\r\nwpa=2\r\nwpa_key_mgmt=WPA-PSK\r\nwpa_pairwise=TKIP\r\nrsn_pairwise=CCMP\r\nwpa_passphrase=12345678\r\n\r\n\r\n#ap_isolate=1\r\nignore_broadcast_ssid=0<\/code><\/pre>\n<p>Create script to run hotsopt and internet sharing, define yours external and internal interfaces (EXTIF, INTIF) and make it executable.<\/p>\n<pre><code>#\r\n# masq.sh\r\n#\r\n#!\/bin\/sh\r\nEXTIF=eth0\r\nINTIF=wlan0\r\necho killing processes if something is using wifi interface\r\nairmon-ng check kill\r\nip a a dev $INTIF 192.168.1.254\/24\r\nip l set dev $INTIF up\r\necho '(re)starting dnsmasq'\r\nsystemctl restart dnsmasq\r\necho '(re)starting hostpad'\r\nsystemctl restart hostapd\r\necho flushing...\r\niptables -F\r\niptables -X\r\niptables -t nat -F\r\niptables -t nat -X\r\niptables -t mangle -F\r\niptables -t mangle -X\r\niptables -P INPUT ACCEPT\r\niptables -P FORWARD ACCEPT\r\niptables -P OUTPUT ACCEPT\r\necho setting ip_forward...\r\necho 1 > \/proc\/sys\/net\/ipv4\/ip_forward\r\n#echo loading modules...\r\n#modprobe ipt_MASQUERADE\r\necho configuring NAT...\r\niptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE\r\niptables -A FORWARD -i $EXTIF -o $INTIF -m state --state RELATED,ESTABLISHED -j ACCEPT\r\niptables -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT<\/code><\/pre>\n<p>Troubleshooting:<\/p>\n<pre><code>hostapd -d \/etc\/hostapd\/hostapd.conf<\/code><\/pre>\n<p>Of course you can do everything your own way. It is just an outline of how to run basic Acces Point.<br \/>\nI&#8217;m using it on my RaspberryPi.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To launch a basic wifi hotspot you need: iwconfig, iptables, dnsmasq, hostapd on your Linux box. Install it. Enable it (systemct enable). To search what package a file belongs to, help youself an use: apt-filesearch\u00a0package or pacman -Fys package Check &hellip; <a href=\"http:\/\/pruszewicz.com\/wordpress\/quick-linux-wifihotspot\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,60],"tags":[],"class_list":["post-401","post","type-post","status-publish","format-standard","hentry","category-linux","category-wi-fi"],"_links":{"self":[{"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/posts\/401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/comments?post=401"}],"version-history":[{"count":22,"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/posts\/401\/revisions"}],"predecessor-version":[{"id":427,"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/posts\/401\/revisions\/427"}],"wp:attachment":[{"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/media?parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/categories?post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pruszewicz.com\/wordpress\/wp-json\/wp\/v2\/tags?post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}