iptables block\/redirect to webserver<\/strong>:<\/p>\niptables -t nat -A wlan0_Unknown -p tcp --dport 80 -j DNAT --to-destination 192.168.24.1\r\n<\/code><\/pre>\nand then the webserver (nginx<\/code>) redirecting to the login page:<\/p>\n# For iOS\r\nif ($http_user_agent ~* (CaptiveNetworkSupport) ) {\r\n return 302 http:\/\/hotspot.localnet\/hotspot.html;\r\n}\r\n\r\n# For others\r\nlocation \/ {\r\n return 302 http:\/\/hotspot.localnet\/;\r\n}\r\n<\/code><\/pre>\niOS has to be difficult in that it needs the WISP settings. hotspot.html<\/code> contents are as follows:<\/p>\n<!--\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<WISPAccessGatewayParam xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http:\/\/www.wballiance.net\/wispr_2_0.xsd\">\r\n<Redirect>\r\n<MessageType>100<\/MessageType>\r\n<ResponseCode>0<\/ResponseCode>\r\n<VersionHigh>2.0<\/VersionHigh>\r\n<VersionLow>1.0<\/VersionLow>\r\n<AccessProcedure>1.0<\/AccessProcedure>\r\n<AccessLocation>Andrew Wippler is awesome<\/AccessLocation>\r\n<LocationName>MyOpenAP<\/LocationName>\r\n<LoginURL>http:\/\/hotspot.localnet\/<\/LoginURL>\r\n<\/Redirect>\r\n<\/WISPAccessGatewayParam>\r\n--><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"I originally authored this on Aug 16, 2016 at\u00a0http:\/\/unix.stackexchange.com. Considering my tutorial did not include an overview, I thought I would re-post it on my blog. To make a captive portal appear, you need to stop all internet traffic and provide a 302 redirectto the client’s browser. To do this, you need to have a […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[6],"tags":[42,43,50],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/posts\/488"}],"collection":[{"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/comments?post=488"}],"version-history":[{"count":1,"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/posts\/488\/revisions"}],"predecessor-version":[{"id":489,"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/posts\/488\/revisions\/489"}],"wp:attachment":[{"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/media?parent=488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/categories?post=488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andrewwippler.com\/wp-json\/wp\/v2\/tags?post=488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}