Forward ports over hostapd?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm running this project for creating access points which is built on top of hostapd
.
Running this works as expected, my ethernet connection is available as wifi:
sudo create_ap wlan0 eth0 wifiname
I was hoping that port 80 on my host machine would automatically be exposed to the client but it isn't.
How can I create a hostapd
hotspot that exposes port 80? I'm thinking I might need to use iptables
or dnsmasq
but I'm not sure.
I'm using the project linked as a starting point but my main goal is to broadcast a port over a wifi-hot spot.
Update: I found that by default the host is available at IP 192.168.12.1
. I'm now looking for a way to forward all (or at minimum localhost) traffic on the hotspot to this IP.
But I still need to be able to resolve other domains on the host itself.
iptables nat dnsmasq wifi-hotspot hostapd
add a comment |Â
up vote
1
down vote
favorite
I'm running this project for creating access points which is built on top of hostapd
.
Running this works as expected, my ethernet connection is available as wifi:
sudo create_ap wlan0 eth0 wifiname
I was hoping that port 80 on my host machine would automatically be exposed to the client but it isn't.
How can I create a hostapd
hotspot that exposes port 80? I'm thinking I might need to use iptables
or dnsmasq
but I'm not sure.
I'm using the project linked as a starting point but my main goal is to broadcast a port over a wifi-hot spot.
Update: I found that by default the host is available at IP 192.168.12.1
. I'm now looking for a way to forward all (or at minimum localhost) traffic on the hotspot to this IP.
But I still need to be able to resolve other domains on the host itself.
iptables nat dnsmasq wifi-hotspot hostapd
1
You must bind the port to appropriate device (presumablywlan0
). If you need it open oneth0
too -iptables
/nftables
is your answer.
â Narà «nasK
Oct 20 '17 at 13:39
I just tried your script and it worked fine. I created hotspot on my laptop and connected my phone to it. Started a server on443
. In phone, openinghttps://192.168.12.1
worked as expected.
â Arpit Agarwal
Oct 28 '17 at 19:43
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm running this project for creating access points which is built on top of hostapd
.
Running this works as expected, my ethernet connection is available as wifi:
sudo create_ap wlan0 eth0 wifiname
I was hoping that port 80 on my host machine would automatically be exposed to the client but it isn't.
How can I create a hostapd
hotspot that exposes port 80? I'm thinking I might need to use iptables
or dnsmasq
but I'm not sure.
I'm using the project linked as a starting point but my main goal is to broadcast a port over a wifi-hot spot.
Update: I found that by default the host is available at IP 192.168.12.1
. I'm now looking for a way to forward all (or at minimum localhost) traffic on the hotspot to this IP.
But I still need to be able to resolve other domains on the host itself.
iptables nat dnsmasq wifi-hotspot hostapd
I'm running this project for creating access points which is built on top of hostapd
.
Running this works as expected, my ethernet connection is available as wifi:
sudo create_ap wlan0 eth0 wifiname
I was hoping that port 80 on my host machine would automatically be exposed to the client but it isn't.
How can I create a hostapd
hotspot that exposes port 80? I'm thinking I might need to use iptables
or dnsmasq
but I'm not sure.
I'm using the project linked as a starting point but my main goal is to broadcast a port over a wifi-hot spot.
Update: I found that by default the host is available at IP 192.168.12.1
. I'm now looking for a way to forward all (or at minimum localhost) traffic on the hotspot to this IP.
But I still need to be able to resolve other domains on the host itself.
iptables nat dnsmasq wifi-hotspot hostapd
edited Oct 24 '17 at 13:43
asked Oct 20 '17 at 13:31
Philip Kirkbride
2,2972470
2,2972470
1
You must bind the port to appropriate device (presumablywlan0
). If you need it open oneth0
too -iptables
/nftables
is your answer.
â Narà «nasK
Oct 20 '17 at 13:39
I just tried your script and it worked fine. I created hotspot on my laptop and connected my phone to it. Started a server on443
. In phone, openinghttps://192.168.12.1
worked as expected.
â Arpit Agarwal
Oct 28 '17 at 19:43
add a comment |Â
1
You must bind the port to appropriate device (presumablywlan0
). If you need it open oneth0
too -iptables
/nftables
is your answer.
â Narà «nasK
Oct 20 '17 at 13:39
I just tried your script and it worked fine. I created hotspot on my laptop and connected my phone to it. Started a server on443
. In phone, openinghttps://192.168.12.1
worked as expected.
â Arpit Agarwal
Oct 28 '17 at 19:43
1
1
You must bind the port to appropriate device (presumably
wlan0
). If you need it open on eth0
too - iptables
/ nftables
is your answer.â Narà «nasK
Oct 20 '17 at 13:39
You must bind the port to appropriate device (presumably
wlan0
). If you need it open on eth0
too - iptables
/ nftables
is your answer.â Narà «nasK
Oct 20 '17 at 13:39
I just tried your script and it worked fine. I created hotspot on my laptop and connected my phone to it. Started a server on
443
. In phone, opening https://192.168.12.1
worked as expected.â Arpit Agarwal
Oct 28 '17 at 19:43
I just tried your script and it worked fine. I created hotspot on my laptop and connected my phone to it. Started a server on
443
. In phone, opening https://192.168.12.1
worked as expected.â Arpit Agarwal
Oct 28 '17 at 19:43
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
You cannot do that via hostapd because port 80 is at Layer4 of ISO/OSI stack, APs work at Layer2. So you need to identify your IP connected via WIFI and work with IPTABLES for that IP
add a comment |Â
up vote
0
down vote
accepted
I was able to get the behavior I wanted using dnsmasq
. Originally I was confused because I was adding the following to the default dnsmasq.conf
location:
address=/#/192.168.12.1
It should forward all traffic to the IP 192.168.12.1
but I found it wasn't working.
Later on while running top
with the program running I found that create_ap
had called dnsmasq
but with a custom dnsmasq.conf
in a /tmp/
folder.
Reading through the source I found this snippet:
MTU=$(get_mtu $INTERNET_IFACE)
[[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,$MTU" >> $CONFDIR/dnsmasq.conf
[[ $ETC_HOSTS -eq 0 ]] && echo no-hosts >> $CONFDIR/dnsmasq.conf
[[ -n "$ADDN_HOSTS" ]] && echo "addn-hosts=$ADDN_HOSTS" >> $CONFDIR/dnsmasq.conf
if [[ "$SHARE_METHOD" == "none" && "$REDIRECT_TO_LOCALHOST" == "1" ]]; then
cat << EOF >> $CONFDIR/dnsmasq.conf
address=/#/$GATEWAY
Inside that statement I added the following line to add my configuration to the temporary dnsmasq file:
echo "address=/#/$GATEWAY" >> $CONFDIR/dnsmasq.conf
After adding that any http
address on the AP was forwarding to 192.168.12.1
the browser automatically assumes port 80 when one isn't provided so that became a non-issue.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You cannot do that via hostapd because port 80 is at Layer4 of ISO/OSI stack, APs work at Layer2. So you need to identify your IP connected via WIFI and work with IPTABLES for that IP
add a comment |Â
up vote
0
down vote
You cannot do that via hostapd because port 80 is at Layer4 of ISO/OSI stack, APs work at Layer2. So you need to identify your IP connected via WIFI and work with IPTABLES for that IP
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You cannot do that via hostapd because port 80 is at Layer4 of ISO/OSI stack, APs work at Layer2. So you need to identify your IP connected via WIFI and work with IPTABLES for that IP
You cannot do that via hostapd because port 80 is at Layer4 of ISO/OSI stack, APs work at Layer2. So you need to identify your IP connected via WIFI and work with IPTABLES for that IP
answered Oct 27 '17 at 15:35
Federi
44311229
44311229
add a comment |Â
add a comment |Â
up vote
0
down vote
accepted
I was able to get the behavior I wanted using dnsmasq
. Originally I was confused because I was adding the following to the default dnsmasq.conf
location:
address=/#/192.168.12.1
It should forward all traffic to the IP 192.168.12.1
but I found it wasn't working.
Later on while running top
with the program running I found that create_ap
had called dnsmasq
but with a custom dnsmasq.conf
in a /tmp/
folder.
Reading through the source I found this snippet:
MTU=$(get_mtu $INTERNET_IFACE)
[[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,$MTU" >> $CONFDIR/dnsmasq.conf
[[ $ETC_HOSTS -eq 0 ]] && echo no-hosts >> $CONFDIR/dnsmasq.conf
[[ -n "$ADDN_HOSTS" ]] && echo "addn-hosts=$ADDN_HOSTS" >> $CONFDIR/dnsmasq.conf
if [[ "$SHARE_METHOD" == "none" && "$REDIRECT_TO_LOCALHOST" == "1" ]]; then
cat << EOF >> $CONFDIR/dnsmasq.conf
address=/#/$GATEWAY
Inside that statement I added the following line to add my configuration to the temporary dnsmasq file:
echo "address=/#/$GATEWAY" >> $CONFDIR/dnsmasq.conf
After adding that any http
address on the AP was forwarding to 192.168.12.1
the browser automatically assumes port 80 when one isn't provided so that became a non-issue.
add a comment |Â
up vote
0
down vote
accepted
I was able to get the behavior I wanted using dnsmasq
. Originally I was confused because I was adding the following to the default dnsmasq.conf
location:
address=/#/192.168.12.1
It should forward all traffic to the IP 192.168.12.1
but I found it wasn't working.
Later on while running top
with the program running I found that create_ap
had called dnsmasq
but with a custom dnsmasq.conf
in a /tmp/
folder.
Reading through the source I found this snippet:
MTU=$(get_mtu $INTERNET_IFACE)
[[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,$MTU" >> $CONFDIR/dnsmasq.conf
[[ $ETC_HOSTS -eq 0 ]] && echo no-hosts >> $CONFDIR/dnsmasq.conf
[[ -n "$ADDN_HOSTS" ]] && echo "addn-hosts=$ADDN_HOSTS" >> $CONFDIR/dnsmasq.conf
if [[ "$SHARE_METHOD" == "none" && "$REDIRECT_TO_LOCALHOST" == "1" ]]; then
cat << EOF >> $CONFDIR/dnsmasq.conf
address=/#/$GATEWAY
Inside that statement I added the following line to add my configuration to the temporary dnsmasq file:
echo "address=/#/$GATEWAY" >> $CONFDIR/dnsmasq.conf
After adding that any http
address on the AP was forwarding to 192.168.12.1
the browser automatically assumes port 80 when one isn't provided so that became a non-issue.
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I was able to get the behavior I wanted using dnsmasq
. Originally I was confused because I was adding the following to the default dnsmasq.conf
location:
address=/#/192.168.12.1
It should forward all traffic to the IP 192.168.12.1
but I found it wasn't working.
Later on while running top
with the program running I found that create_ap
had called dnsmasq
but with a custom dnsmasq.conf
in a /tmp/
folder.
Reading through the source I found this snippet:
MTU=$(get_mtu $INTERNET_IFACE)
[[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,$MTU" >> $CONFDIR/dnsmasq.conf
[[ $ETC_HOSTS -eq 0 ]] && echo no-hosts >> $CONFDIR/dnsmasq.conf
[[ -n "$ADDN_HOSTS" ]] && echo "addn-hosts=$ADDN_HOSTS" >> $CONFDIR/dnsmasq.conf
if [[ "$SHARE_METHOD" == "none" && "$REDIRECT_TO_LOCALHOST" == "1" ]]; then
cat << EOF >> $CONFDIR/dnsmasq.conf
address=/#/$GATEWAY
Inside that statement I added the following line to add my configuration to the temporary dnsmasq file:
echo "address=/#/$GATEWAY" >> $CONFDIR/dnsmasq.conf
After adding that any http
address on the AP was forwarding to 192.168.12.1
the browser automatically assumes port 80 when one isn't provided so that became a non-issue.
I was able to get the behavior I wanted using dnsmasq
. Originally I was confused because I was adding the following to the default dnsmasq.conf
location:
address=/#/192.168.12.1
It should forward all traffic to the IP 192.168.12.1
but I found it wasn't working.
Later on while running top
with the program running I found that create_ap
had called dnsmasq
but with a custom dnsmasq.conf
in a /tmp/
folder.
Reading through the source I found this snippet:
MTU=$(get_mtu $INTERNET_IFACE)
[[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,$MTU" >> $CONFDIR/dnsmasq.conf
[[ $ETC_HOSTS -eq 0 ]] && echo no-hosts >> $CONFDIR/dnsmasq.conf
[[ -n "$ADDN_HOSTS" ]] && echo "addn-hosts=$ADDN_HOSTS" >> $CONFDIR/dnsmasq.conf
if [[ "$SHARE_METHOD" == "none" && "$REDIRECT_TO_LOCALHOST" == "1" ]]; then
cat << EOF >> $CONFDIR/dnsmasq.conf
address=/#/$GATEWAY
Inside that statement I added the following line to add my configuration to the temporary dnsmasq file:
echo "address=/#/$GATEWAY" >> $CONFDIR/dnsmasq.conf
After adding that any http
address on the AP was forwarding to 192.168.12.1
the browser automatically assumes port 80 when one isn't provided so that became a non-issue.
answered Dec 1 '17 at 15:23
Philip Kirkbride
2,2972470
2,2972470
add a comment |Â
add a comment |Â
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%2f399343%2fforward-ports-over-hostapd%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
1
You must bind the port to appropriate device (presumably
wlan0
). If you need it open oneth0
too -iptables
/nftables
is your answer.â Narà «nasK
Oct 20 '17 at 13:39
I just tried your script and it worked fine. I created hotspot on my laptop and connected my phone to it. Started a server on
443
. In phone, openinghttps://192.168.12.1
worked as expected.â Arpit Agarwal
Oct 28 '17 at 19:43