Answer the question
In order to leave comments, you need to log in
Iptables rules for captive portal?
There is a wifi router on the wealan, I can’t realize such a moment as wrapping all traffic so that it goes to the authorization page that will be on the server (it also acts as dhcp), the wealan is spinning on the enp4s0 interface, from another interface that looks in the direction of the provider, I was able to open a pass thanks to such commands.
echo "net.ipv4.ip_forward=1" » /etc/sysctl.con
iptables -t nat -A POSTROUTING -o enp2s0 -j MASQUERADE
Answer the question
In order to leave comments, you need to log in
iptables:
*nat
-A PREROUTING -d 10.100.0.220/32 -p tcp -m tcp --dport 80 -j ACCEPT
-A PREROUTING -p tcp -m tcp --dport 80 -m set ! --match-set mac-allowed src -j DNAT --to-destination 10.100.0.220
*filter
-A FORWARD -i vlan1+ -j macallowed
-A macallowed -d DNS-сервер -p udp -m udp --dport 53 -j ACCEPT
-A macallowed -m set --match-set mac-allowed src -j ACCEPT
-A macallowed -j DROP
create mac-allowed hash:mac hashsize 1024 maxelem 65536
add mac-allowed A0:4E:A7:55:44:33
header('HTTP/1.1 511 Network Authentication Required', TRUE, 511);
header("Location: http://10.100.0.220/portal/index.php?step=1");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question