Community discussions

MikroTik App
 
lamprop
just joined
Topic Author
Posts: 2
Joined: Fri Jul 01, 2022 12:24 pm

Script to find address and remove accordingly

Fri Jul 01, 2022 12:53 pm

I have tried to make a script but I am not so familiar yet so I ask for your help.

I have the following configuration:
> /routing ospf network print
Flags: X - disabled, I - invalid 
 #   NETWORK            AREA                                                                                                                                                                                                                               
 0   10.0.x.y/30     areaXX                                                                                                                                                                                                                             
 1   10.a.b.0/24      areaXX                                                                                                                                                                                                                             
 2   c.d.e.f/32  areaXX

> /ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic 
 0    chain=srcnat action=src-nat to-addresses=k.l.m.n src-address=10.p.q.32-10.p.q.254 dst-address=!10.0.0.0/8 out-interface=WAN_Connection
 1    chain=srcnat action=src-nat to-addresses=k.l.m.n src-address=10.p.q.32-10.p.q.254 dst-address=!10.0.0.0/8 out-interface=pppoe-out1
 2    chain=srcnat action=src-nat to-addresses=k.l.m.n src-address=10.p.q.r dst-address=!10.0.0.0/8 out-interface=WAN_Connection
 3    chain=srcnat action=src-nat to-addresses=k.l.m.n src-address=10.p.q.r dst-address=!10.0.0.0/8 out-interface=pppoe-out1
 4    chain=dstnat action=dst-nat to-addresses=10.p.q.r dst-address=k.l.m.n in-interface=WAN_Connection
 5    chain=dstnat action=dst-nat to-addresses=10.p.q.r dst-address=k.l.m.n in-interface=pppoe-out1
I want to do 2 things with a script:

1. Disable or remove only the "10.a.b.0/24" from OSPF networks (there can be multiple similar entries).
2. Keep the same NAT commands while removing the "dst-address=!10.0.0.0/8" argument everywhere.

Thank you.

Who is online

Users browsing this forum: No registered users and 11 guests