แสดงบทความที่มีป้ายกำกับ MikroTik แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ MikroTik แสดงบทความทั้งหมด

วันอังคารที่ 12 พฤษภาคม พ.ศ. 2563

สร้าง Queue อัตโนมัติ สำหรับ DHCP Lease

ใส่ในแท็บ Script ในหัวข้อ DHCP Server

:local queueName "Client- $leaseActMAC";

:if ($leaseBound = "1") do={
/queue simple add name=$queueName target=($leaseActIP . "/32") max-limit=40M/40M comment=[/ip dhcp-server lease get [find where active-mac-address=$leaseActMAC && active-address=$leaseActIP] host-name];
} else={
/queue simple remove $queueName
}

วันศุกร์ที่ 31 พฤษภาคม พ.ศ. 2562

[MikroTik] เข้าทางไหน ออกทางนั้น

redirect incoming traffic in wan1 and wan2 to the local server
/ip firewall nat add chain=dstnat protocol=tcp dst-port=22 in-interface=wan1 action=dst-nat to-addresses=192.168.0.1 to-ports=22
/ip firewall nat add chain=dstnat protocol=tcp dst-port=22 in-interface=wan2 action=dst-nat to-addresses=192.168.0.1 to-ports=22
what comes from wan1, gets out from wan1
/ip firewall mangle add action=mark-connection chain=input in-interface=wan1 new-connection-mark=wan1_conn passthrough=yes disabled=no comment="in wan1,out wan1"
/ip firewall mangle add action=mark-routing chain=output connection-mark=wan1_conn new-routing-mark=wan1_traffic passthrough=no disabled=no comment="in wan1,out wan1"
what comes from wan2, gets out from wan2
/ip firewall mangle add action=mark-connection chain=input in-interface=wan2 new-connection-mark=wan2_conn passthrough=yes disabled=no comment="in wan2,out wan2"
/ip firewall mangle add action=mark-routing chain=output connection-mark=wan2_conn new-routing-mark=wan2_traffic passthrough=no disabled=no comment="in wan2,out wan2"
port forwards from wan1, gets out from wan1
/ip firewall mangle add action=mark-connection chain=forward in-interface=wan1 connection-state=new new-connection-mark=wan1_pfw passthrough=no disabled=no comment="pfw wan1, out wan1"
/ip firewall mangle add action=mark-routing chain=prerouting in-interface=lan connection-mark=wan1_pfw new-routing-mark=wan1_traffic passthrough=no disabled=no comment="pfw wan1, out wan1"
port forwards from wan2, gets out from wan2
/ip firewall mangle add action=mark-connection chain=forward in-interface=wan2 connection-state=new new-connection-mark=wan2_pfw passthrough=no disabled=no comment="pfw wan2, out wan2"
/ip firewall mangle add action=mark-routing chain=prerouting in-interface=lan connection-mark=wan2_pfw new-routing-mark=wan2_traffic passthrough=no disabled=no comment="pfw wan2, out wan2"
routing rules for wan1_traffic and wan2_traffic
/ip route add dst-address=0.0.0.0/0 gateway=wan1 distance=1 routing-mark=wan1_traffic disabled=no
/ip route add dst-address=0.0.0.0/0 gateway=wan2 distance=1 routing-mark=wan2_traffic disabled=no
Credit: MikroTik Tutoroial.

วันศุกร์ที่ 19 มกราคม พ.ศ. 2561

Script สั่ง Reboot MikroTik

ไปที่ System > Scripts
สร้าง Script ใหม่ ตั้งชื่อตามต้องการ เช่นชื่อ reboot
ช่อง Policy ให้เลือก Reboot
ช่อง Source พิมพ์ /system reboot


ไปที่ System > Scheduler
สร้าง Schedule ใหม่ ตั้งชื่อตามต้องการ เช่น reboot
ช่อง Start Time เลือก startup
ช่อง Interval ตั้งเวลาตามต้องการ
ช่อง Policy ให้เลือก Reboot
ช่อง On Event ให้ใส่ชื่อ Script ที่เราตั้งไว้ก่อนหน้า จากตัวอย่างคือ reboot