Hi all,
I want to give internet access to our guest by limited time per day . The same MAC can access internet for two hours per same day.
What is easyest way to implement this by mikrotik ?
Regards,
Linas
/interface wireless
set [ find default-name=wlan1 ] arp=reply-only band=2ghz-b/g/n channel-width=\
20/40mhz-Ce disabled=no distance=indoors l2mtu=1600 mode=ap-bridge \
tx-power=4 tx-power-mode=all-rates-fixed
/ip pool
add name=WiFI ranges=192.168.10.10-192.168.10.100
/ip dhcp-server
add add-arp=yes address-pool=WiFI disabled=no interface=wlan1 lease-time=12h \
name=WiFi
/system logging action
set 3 src-address=0.0.0.0
/ip address
add address=192.168.10.1/24 interface=wlan1 network=192.168.10.0
/ip dhcp-client
add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \
interface=ether1
/ip dhcp-server network
add address=192.168.10.0/24 dns-server=8.8.8.8 gateway=192.168.10.1 netmask=\
24
/ip firewall filter
add action=add-src-to-address-list address-list=NewIp address-list-timeout=5m \
chain=forward out-interface=ether1 src-address=192.168.10.0/24 \
src-address-list=!TimeOut
add action=add-src-to-address-list address-list=TimeOut address-list-timeout=\
10m chain=forward out-interface=ether1 src-address=192.168.10.0/24
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1 src-address=\
192.168.10.0/24 src-address-list=NewIp
Can you please help me?Testing this configuration , seems to be working :
General idea : DHCP lease for 12h , add arp for lease. WIFI interface arp-reply only. New IP is added into two lists : one for Internet access , second for ban
Code: Select all/interface wireless set [ find default-name=wlan1 ] arp=reply-only band=2ghz-b/g/n channel-width=\ 20/40mhz-Ce disabled=no distance=indoors l2mtu=1600 mode=ap-bridge \ tx-power=4 tx-power-mode=all-rates-fixed /ip pool add name=WiFI ranges=192.168.10.10-192.168.10.100 /ip dhcp-server add add-arp=yes address-pool=WiFI disabled=no interface=wlan1 lease-time=12h \ name=WiFi /system logging action set 3 src-address=0.0.0.0 /ip address add address=192.168.10.1/24 interface=wlan1 network=192.168.10.0 /ip dhcp-client add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ether1 /ip dhcp-server network add address=192.168.10.0/24 dns-server=8.8.8.8 gateway=192.168.10.1 netmask=\ 24 /ip firewall filter add action=add-src-to-address-list address-list=NewIp address-list-timeout=5m \ chain=forward out-interface=ether1 src-address=192.168.10.0/24 \ src-address-list=!TimeOut add action=add-src-to-address-list address-list=TimeOut address-list-timeout=\ 10m chain=forward out-interface=ether1 src-address=192.168.10.0/24 /ip firewall nat add action=masquerade chain=srcnat out-interface=ether1 src-address=\ 192.168.10.0/24 src-address-list=NewIp
/interface bridge
add arp=reply-only comment=hotspot name=br1
#
#
/ip address
add address=10.1.30.1/24 comment=hotspot interface=br1 network=10.1.30.0
#
#
/ip pool
add name=dhcp_pool2 ranges=10.1.30.2-10.1.30.254
#
/ip dhcp-server
add add-arp=yes address-pool=dhcp_pool2 disabled=no interface=br1 name=dhcp2
/ip dhcp-server network
add address=10.1.30.0/24 dns-server=10.1.30.1 gateway=10.1.30.1
#
#
/ip firewall filter
add chain=forward connection-state=established,related
add chain=forward connection-state=new src-address-list=hotspot_permit
add action=reject chain=forward connection-state=new protocol=tcp reject-with=tcp-reset src-address-list=hotspot_deny
add action=add-src-to-address-list address-list=hotspot_permit address-list-timeout=1m chain=forward connection-state=new \
src-address=10.1.30.0/24 src-address-list=!hotspot_deny
add action=add-src-to-address-list address-list=hotspot_deny address-list-timeout=2m chain=forward connection-state=new \
src-address=10.1.30.0/24
/
#
#
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1 src-address-list=hotspot_permit
/
#
#
Testing this configuration , seems to be working :
General idea : DHCP lease for 12h , add arp for lease. WIFI interface arp-reply only. New IP is added into two lists : one for Internet access , second for ban
Code: Select all/interface wireless set [ find default-name=wlan1 ] arp=reply-only band=2ghz-b/g/n channel-width=\ 20/40mhz-Ce disabled=no distance=indoors l2mtu=1600 mode=ap-bridge \ tx-power=4 tx-power-mode=all-rates-fixed /ip pool add name=WiFI ranges=192.168.10.10-192.168.10.100 /ip dhcp-server add add-arp=yes address-pool=WiFI disabled=no interface=wlan1 lease-time=12h \ name=WiFi /system logging action set 3 src-address=0.0.0.0 /ip address add address=192.168.10.1/24 interface=wlan1 network=192.168.10.0 /ip dhcp-client add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ether1 /ip dhcp-server network add address=192.168.10.0/24 dns-server=8.8.8.8 gateway=192.168.10.1 netmask=\ 24 /ip firewall filter add action=add-src-to-address-list address-list=NewIp address-list-timeout=5m \ chain=forward out-interface=ether1 src-address=192.168.10.0/24 \ src-address-list=!TimeOut add action=add-src-to-address-list address-list=TimeOut address-list-timeout=\ 10m chain=forward out-interface=ether1 src-address=192.168.10.0/24 /ip firewall nat add action=masquerade chain=srcnat out-interface=ether1 src-address=\ 192.168.10.0/24 src-address-list=NewIp