Raspberry Pi Access Point How To
OBJECTIVE:
Raspberry Pi as an Access Point to route all DHCPD clients via (external server, outside my country)
INTRO:
I already have a server with SSH on port 443 ready for tunnel, and I do use it a lot via browser.
But how about if I want my android phone to use it as well, setting up Android Proxy system wide
requires rooting the phone and I do not want to do that. For easy of use they should only connect
to the wireless PI and go out from my server via tunnel/vpn/ssh
SETUP OPTIONS:
PRE-REQ:
Have an outside server with SSH
consider: eth0 (WLAN, our way to the internet) wlan0 (LAN, where clients will connect to)
1)hostapd (this make us become an Access Point)
/etc/hostapd/hostapd.conf
interface=wlan0
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ieee80211n=1 # 802.11n support
wmm_enabled=1 # QoS support
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
ssid=RAS
wpa_passphrase=raspberryGO
logger_syslog_level=2
2)dnsmasq (our very light and simple DHCP and DNS)
#Note: may need to check /etc/rc3.d/S03dnsmasq
/etc/dnsmasq.d/dnsmasq.conf
interface=wlan0 # Use the require wireless interface – usually wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
dhcp-option=3,192.168.4.1
dhcp-authoritative
server=8.8.8.8 #OR LOCAL DNS IF YOU HAVE
cache-size=10000
dhcp-leasefile=/var/lib/dnsmasq.leases
log-queries
log-dhcp
/etc/default/dnsmasq |grep -v “#”
ENABLED=1
CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
3)iptables (NAT)
/etc/sysctl.conf
net.ipv4.ip_forward=1
net.ipv6.conf.all.disable_ipv6=1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
4) DHCPCD (our DHCP client)
/etc/dhcpcd.conf
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
interface wlan0
static ip_address=192.168.4.1/24
denyinterfaces eth0
denyinterfaces wlan0
5) INTERFACE ( our network intefaces definitions)
/etc/network/interfaces
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet dhcp
# up route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.167.1 metric 1 # needed in my case only
# dns-nameservers 8.8.8.8
auto wlan0
iface wlan0 inet static
hostapd /etc/hostapd/hostapd.conf
address 192.168.4.1
netmask 255.255.255.0
Troubleshooting:
If you need to make WIFI Connect
ifconfig wlan0 down
iwconfig wlan0 mode managed
systemctl restart networking
iwconfig wlan0 essid RedmiFeli key s:1234567123124123das
/etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
]]>

Tags: , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *