Community discussions

MikroTik App
 
redroom
just joined
Topic Author
Posts: 1
Joined: Sun Aug 09, 2020 11:50 pm

REST API insert firewall rule

Fri Oct 14, 2022 5:23 pm

Hello,
Is it possible to insert firewall filter rule using rest api in specific place (analogue of place-before)?
Currently rules id in winbox/ssh dont match id within REST so its not possible to use legacy command inside REST to adjust rules order.
RouterOS 7.5

REST:
[
{
"id": "*1",
"action": "drop",
"dstAddress": "192.168.0.0/24",
"srcAddress": "10.0.0.0/24"
},
{
"id": "*3",
"action": "drop",
"srcAddress": "192.168.0.0/24"
},
{
"id": "*7",
"action": "accept",
"dstPort": "2244",
"protocol": "udp",
"srcAddress": "10.240.240.0/24",
"srcPort": "1144"
},
{
"id": "*8",
"action": "accept",
"dstPort": "1234",
"protocol": "tcp"
}
]

winbox/ssh:
0 ;;; 275
chain=forward action=drop src-address=10.0.0.0/24
dst-address=192.168.0.0/24 log=no log-prefix=""

1 ;;; 275
chain=forward action=drop src-address=192.168.0.0/24 log=no log-prefix=""

2 ;;; 275
chain=forward action=accept protocol=udp src-address=10.240.240.0/24
src-port=1144 dst-port=2244 log=no log-prefix=""

3 ;;; 275
chain=forward action=accept protocol=tcp dst-port=1234 log=no
log-prefix=""

Who is online

Users browsing this forum: JDF and 22 guests