Creating an access point that connects to wifi
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am trying to develop an access point that can be used to 'headlessly' connect to wifi.
AP
I am setting up the access point using hostapd conf:
interface=wlan0
ssid=AP
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
adding to my /etc/hosts
192.168.1.1 nginx.ap.com
and to my dnsmasq
:
# Never forward addresses in the non-routed address spaces.
bogus-priv
#ãÂÂAdd other name servers here, with domain specs if they are forãÂÂnon-public domains.
server=/localnet/192.168.1.1
# Add local-only domains here, queries in these domains are answeredãÂÂfrom /etc/hosts or DHCP only.
local=/localnet/
# Make all host names resolve to the Raspberry Pi's IP address
address=/#/192.168.1.1
# Specify the interface that will listen for DHCP and DNS requests
interface=wlan0
# Set the domain for dnsmasq
domain=localnet
# Specify the range of IP addresses the DHCP server will lease out to devices, and the duration of the lease
dhcp-range=192.168.1.10,192.168.1.254,1h
# Specify the default route
dhcp-option=3,192.168.1.1
# Specify the DNS server address
dhcp-option=6,192.168.1.1
# Set the DHCP server to authoritative mode.
dhcp-authoritative
log-dhcp
log-queries
log-facility=/tmp/dnsmasq.log
and a LAMP server that listens for nginx.ap.com
this is not really working how I imagined as I had to customise the DNS on my mac so that it would use the pis and I only get access if I type http://nginx.ap.com
into the browser I was hoping I would get a pop up and all other domains would redirect to this.
networking
For my /etc/network/interfaces
:
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
I am now trying to come up with a script that the nginx web server can run using php to close the access point and connect to the wifi using a SSID and password from a HTML form.
I have the check to see if the SSID
exists in the network which works with this bash script:
if ! iwlist scan | grep ""$name"" &> /dev/null
then
echo "No such SSID - '$name'";
exit
fi
I now want to check if the password is correct and then to never use the access point again if there is a valid wifi.
So I run a simple cron like this:
if ! ping -c 2 8.8.8.8 &> /dev/null
then
service hostapd start
service dnsmasq start
else
service hostapd stop
service dnsmasq stop
fi
but this does not work properly as I will also need to control the /etc/network/interfaces
and refresh the network and to do that I have to boot the user off the AP thus destroying any possible feedback.
Is there a way to check whether a config works without disconnecting the access point? And any other tips would be greatly appreciated.
networking wifi wifi-hotspot access-point
add a comment |Â
up vote
0
down vote
favorite
I am trying to develop an access point that can be used to 'headlessly' connect to wifi.
AP
I am setting up the access point using hostapd conf:
interface=wlan0
ssid=AP
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
adding to my /etc/hosts
192.168.1.1 nginx.ap.com
and to my dnsmasq
:
# Never forward addresses in the non-routed address spaces.
bogus-priv
#ãÂÂAdd other name servers here, with domain specs if they are forãÂÂnon-public domains.
server=/localnet/192.168.1.1
# Add local-only domains here, queries in these domains are answeredãÂÂfrom /etc/hosts or DHCP only.
local=/localnet/
# Make all host names resolve to the Raspberry Pi's IP address
address=/#/192.168.1.1
# Specify the interface that will listen for DHCP and DNS requests
interface=wlan0
# Set the domain for dnsmasq
domain=localnet
# Specify the range of IP addresses the DHCP server will lease out to devices, and the duration of the lease
dhcp-range=192.168.1.10,192.168.1.254,1h
# Specify the default route
dhcp-option=3,192.168.1.1
# Specify the DNS server address
dhcp-option=6,192.168.1.1
# Set the DHCP server to authoritative mode.
dhcp-authoritative
log-dhcp
log-queries
log-facility=/tmp/dnsmasq.log
and a LAMP server that listens for nginx.ap.com
this is not really working how I imagined as I had to customise the DNS on my mac so that it would use the pis and I only get access if I type http://nginx.ap.com
into the browser I was hoping I would get a pop up and all other domains would redirect to this.
networking
For my /etc/network/interfaces
:
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
I am now trying to come up with a script that the nginx web server can run using php to close the access point and connect to the wifi using a SSID and password from a HTML form.
I have the check to see if the SSID
exists in the network which works with this bash script:
if ! iwlist scan | grep ""$name"" &> /dev/null
then
echo "No such SSID - '$name'";
exit
fi
I now want to check if the password is correct and then to never use the access point again if there is a valid wifi.
So I run a simple cron like this:
if ! ping -c 2 8.8.8.8 &> /dev/null
then
service hostapd start
service dnsmasq start
else
service hostapd stop
service dnsmasq stop
fi
but this does not work properly as I will also need to control the /etc/network/interfaces
and refresh the network and to do that I have to boot the user off the AP thus destroying any possible feedback.
Is there a way to check whether a config works without disconnecting the access point? And any other tips would be greatly appreciated.
networking wifi wifi-hotspot access-point
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to develop an access point that can be used to 'headlessly' connect to wifi.
AP
I am setting up the access point using hostapd conf:
interface=wlan0
ssid=AP
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
adding to my /etc/hosts
192.168.1.1 nginx.ap.com
and to my dnsmasq
:
# Never forward addresses in the non-routed address spaces.
bogus-priv
#ãÂÂAdd other name servers here, with domain specs if they are forãÂÂnon-public domains.
server=/localnet/192.168.1.1
# Add local-only domains here, queries in these domains are answeredãÂÂfrom /etc/hosts or DHCP only.
local=/localnet/
# Make all host names resolve to the Raspberry Pi's IP address
address=/#/192.168.1.1
# Specify the interface that will listen for DHCP and DNS requests
interface=wlan0
# Set the domain for dnsmasq
domain=localnet
# Specify the range of IP addresses the DHCP server will lease out to devices, and the duration of the lease
dhcp-range=192.168.1.10,192.168.1.254,1h
# Specify the default route
dhcp-option=3,192.168.1.1
# Specify the DNS server address
dhcp-option=6,192.168.1.1
# Set the DHCP server to authoritative mode.
dhcp-authoritative
log-dhcp
log-queries
log-facility=/tmp/dnsmasq.log
and a LAMP server that listens for nginx.ap.com
this is not really working how I imagined as I had to customise the DNS on my mac so that it would use the pis and I only get access if I type http://nginx.ap.com
into the browser I was hoping I would get a pop up and all other domains would redirect to this.
networking
For my /etc/network/interfaces
:
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
I am now trying to come up with a script that the nginx web server can run using php to close the access point and connect to the wifi using a SSID and password from a HTML form.
I have the check to see if the SSID
exists in the network which works with this bash script:
if ! iwlist scan | grep ""$name"" &> /dev/null
then
echo "No such SSID - '$name'";
exit
fi
I now want to check if the password is correct and then to never use the access point again if there is a valid wifi.
So I run a simple cron like this:
if ! ping -c 2 8.8.8.8 &> /dev/null
then
service hostapd start
service dnsmasq start
else
service hostapd stop
service dnsmasq stop
fi
but this does not work properly as I will also need to control the /etc/network/interfaces
and refresh the network and to do that I have to boot the user off the AP thus destroying any possible feedback.
Is there a way to check whether a config works without disconnecting the access point? And any other tips would be greatly appreciated.
networking wifi wifi-hotspot access-point
I am trying to develop an access point that can be used to 'headlessly' connect to wifi.
AP
I am setting up the access point using hostapd conf:
interface=wlan0
ssid=AP
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
adding to my /etc/hosts
192.168.1.1 nginx.ap.com
and to my dnsmasq
:
# Never forward addresses in the non-routed address spaces.
bogus-priv
#ãÂÂAdd other name servers here, with domain specs if they are forãÂÂnon-public domains.
server=/localnet/192.168.1.1
# Add local-only domains here, queries in these domains are answeredãÂÂfrom /etc/hosts or DHCP only.
local=/localnet/
# Make all host names resolve to the Raspberry Pi's IP address
address=/#/192.168.1.1
# Specify the interface that will listen for DHCP and DNS requests
interface=wlan0
# Set the domain for dnsmasq
domain=localnet
# Specify the range of IP addresses the DHCP server will lease out to devices, and the duration of the lease
dhcp-range=192.168.1.10,192.168.1.254,1h
# Specify the default route
dhcp-option=3,192.168.1.1
# Specify the DNS server address
dhcp-option=6,192.168.1.1
# Set the DHCP server to authoritative mode.
dhcp-authoritative
log-dhcp
log-queries
log-facility=/tmp/dnsmasq.log
and a LAMP server that listens for nginx.ap.com
this is not really working how I imagined as I had to customise the DNS on my mac so that it would use the pis and I only get access if I type http://nginx.ap.com
into the browser I was hoping I would get a pop up and all other domains would redirect to this.
networking
For my /etc/network/interfaces
:
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
I am now trying to come up with a script that the nginx web server can run using php to close the access point and connect to the wifi using a SSID and password from a HTML form.
I have the check to see if the SSID
exists in the network which works with this bash script:
if ! iwlist scan | grep ""$name"" &> /dev/null
then
echo "No such SSID - '$name'";
exit
fi
I now want to check if the password is correct and then to never use the access point again if there is a valid wifi.
So I run a simple cron like this:
if ! ping -c 2 8.8.8.8 &> /dev/null
then
service hostapd start
service dnsmasq start
else
service hostapd stop
service dnsmasq stop
fi
but this does not work properly as I will also need to control the /etc/network/interfaces
and refresh the network and to do that I have to boot the user off the AP thus destroying any possible feedback.
Is there a way to check whether a config works without disconnecting the access point? And any other tips would be greatly appreciated.
networking wifi wifi-hotspot access-point
edited Apr 3 at 12:20
asked Apr 2 at 23:03
maxisme
145111
145111
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435149%2fcreating-an-access-point-that-connects-to-wifi%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password