如何自动检测专属门户

时间:2019-02-11 19:00:09

标签: apache iptables hotspot captiveportal

我正在使用CentOS 6的服务器上做一个热点,我想知道如何使Smarthphone自动识别强制门户,以重定向到登录名。 在我的防火墙中,我有以下规则:

iptables -t nat -A NET_DHCP -i eth1 -s 172.16.0.0/16 -p tcp --dport 80 -j DNAT --to 172.16.0.1:80

在Apache(httpd.conf)中:

<VirtualHost *:80>
        ErrorDocument 400 /var/www/dhcpauth/index.php
        ErrorDocument 404 /var/www/dhcpauth/index.php
        ServerPath /var/www/dhcpauth
        DocumentRoot /var/www/dhcpauth/
        <Directory /var/www/dhcpauth>
            AllowOverride All
            DirectoryIndex index.html index.html
            Options Indexes FollowSymLinks
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

在其他相关答案中,我找到了以下代码。它不能像我以前那样使用:

<!--
<?xml version="1.0" encoding="UTF-8"?>
<WISPAccessGatewayParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.wballiance.net/wispr_2_0.xsd">
<Redirect>
<MessageType>100</MessageType>
<ResponseCode>0</ResponseCode>
<VersionHigh>2.0</VersionHigh>
<VersionLow>1.0</VersionLow>
<AccessProcedure>1.0</AccessProcedure>
<AccessLocation>Andrew Wippler is awesome</AccessLocation>
<LocationName>MyOpenAP</LocationName>
<LoginURL>http://hotspot.localnet/</LoginURL>
</Redirect>
</WISPAccessGatewayParam>
-->

如果通过内部域或IP访问热点,则热点可以正常工作,但是当设备连接到网络中时,我希望看到消息“此网络需要身份验证”。有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

根据链接,我能够通过apache进行302重定向时进行侦察:

https://serverfault.com/questions/679393/captive-portal-popups-the-definitive-guide

应注意,在虚拟主机中,Apache的唯一选项应为FollowSymLinks Options,如:

Options FollowSymLinks