User Tools

Site Tools


сервис_captive_portal

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
сервис_captive_portal [2014/04/22 13:14]
val создано
сервис_captive_portal [2014/06/17 13:34] (current)
val
Line 1: Line 1:
 ====== Сервис Captive Portal ====== ====== Сервис Captive Portal ======
  
 +  * Captive Portal Using PHP and iptables Firewall on Linux ([[http://​aryo.info/​labs/​captive-portal-using-php-and-iptables.html]])
 +  * Using iptables and PHP to create a captive portal ([[http://​www.andybev.com/​index.php/​Using_iptables_and_PHP_to_create_a_captive_portal]])
 +
 +===== Linux(Ubuntu) =====
 +<​code>​
 +root@gate:​~#​ cat nat.sh
 +</​code><​code>​
 +iptables -t nat --flush
 +
 +iptables -t nat -A POSTROUTING -o eth1 -s 192.168.X.0/​24 -j MASQUERADE
 +
 +iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.X.1
 +
 +iptables -t nat -I PREROUTING -i eth0 -s 192.168.X.10 -j ACCEPT
 +
 +conntrack -F
 +</​code>​
 +
 +===== FreeBSD =====
 +<​code>​
 +gate# cat /​etc/​pf.conf
 +</​code><​code>​
 +rdr on em0 proto tcp from 192.168.X/​24 to any port 80 -> 127.0.0.1 port 80
 +
 +nat on em1 from 192.168.X/​24 to any -> 172.16.1.X
 +</​code>​
 +
 +===== Apache =====
 +
 +<​code>​
 +# cat index.php
 +</​code><​code>​
 +<​HTML>​
 +  <​HEAD>​
 +    <META HTTP-EQUIV="​Content-Type"​ CONTENT="​text/​html;​charset=UTF-8">​
 +  </​HEAD>​
 +  <​BODY>​
 +     ​Address of your computer: <?php echo $_SERVER['​REMOTE_ADDR'​];​ ?><​br>​
 +  </​BODY>​
 +</​HTML>​
 +</​code>​
сервис_captive_portal.1398158060.txt.gz · Last modified: 2014/04/22 13:14 by val