Tuesday, 23 May 2023

A complete Mikrotik Script to configure

A complete Mikrotik Script to configure Vlan wise service, INT, GGC, FNA, BDIX. With SRC NAT, Queue, PCQ, IP poole, PPPOE server, PPPOE profile, Configure BGP, Static Route


/interface bridge

add name=Loopback


/interface vlan

add interface=ether1 name=REGO-BDIX vlan-id=1214

add interface=ether1 name=REGO-FNA vlan-id=1213

add interface=ether1 name=REGO-GGC vlan-id=1212

add interface=ether1 name=REGO-INT vlan-id=1211


/ip address

add address=172.20.6.10/30 interface=REGO-INT

add address=172.22.6.10/30 interface=REGO-GGC

add address=172.24.6.10/30 interface=REGO-FNA

add address=172.26.6.10/30 interface=REGO-BDIX

add address=103.130.16.160 interface=Loopback



/ip dns

set servers=103.167.15.150


/ip firewall nat

add action=src-nat chain=srcnat out-interface=REGO-INT to-addresses=\ 103.130.16.160

add action=src-nat chain=srcnat out-interface=REGO-GGC to-addresses=\ 103.130.16.160

add action=src-nat chain=srcnat out-interface=REGO-FNA to-addresses=\ 103.130.16.160

add action=src-nat chain=srcnat out-interface=REGO-BDIX to-addresses=\ 103.130.16.160



/ip route

add check-gateway=ping distance=1 gateway=172.20.6.9


add dst-address=103.123.171.0/27 gateway=172.22.6.9 comment=GGC check-gateway=ping

add dst-address=103.166.252.96/27 gateway=172.22.6.9 comment=GGC check-gateway=ping

add dst-address=103.166.252.128/25 gateway=172.22.6.9 comment=GGC check-gateway=ping


add dst-address=103.123.170.0/26 gateway=172.24.6.9 comment=FNA check-gateway=ping

add dst-address=103.167.14.0/26 gateway=172.24.6.9 comment=FNA check-gateway=ping



/routing bgp instance

add as=64500 name=REGO-BDIX router-id=172.26.6.10


/routing bgp network

add network=103.130.16.160 synchronize=no


/routing bgp peer

add instance=REGO-BDIX name=REGO-BDIX remote-address=172.26.6.9 remote-as=\ 138346



/ip pool

add name=1MB ranges=10.10.0.2-10.10.1.254

add name=2MB ranges=10.10.2.2-10.10.3.254

add name=3MB ranges=10.10.4.2-10.10.5.254

add name=5MB ranges=10.10.6.2-10.10.7.254

add name=8MB ranges=10.10.8.2-10.10.9.254

add name=10MB ranges=10.10.10.2-10.10.11.254

add name=12MB ranges=10.10.12.2-10.10.13.254

add name=15MB ranges=10.10.14.2-10.10.15.254

add name=20MB ranges=10.10.16.2-10.10.17.254


/ppp profile

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.0.1 name=1MB \  only-one=no remote-address=1MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.2.1 name=2MB \ only-one=no remote-address=2MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.4.1 name=3MB \ only-one=no remote-address=3MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.6.1 name=5MB \ only-one=no remote-address=5MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.8.1 name=8MB \ only-one=no remote-address=8MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.10.1 name=10MB \ only-one=no remote-address=10MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.12.1 name=12MB \ only-one=no remote-address=12MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.14.1 name=15MB \ only-one=no remote-address=15MB

add dns-server=103.167.15.150,8.8.8.8 local-address=10.10.16.1 name=20MB \ only-one=no remote-address=20MB



/queue type

add kind=pcq name=3MB pcq-classifier=dst-address pcq-rate=3M

add kind=pcq name=5MB pcq-classifier=dst-address pcq-rate=5M

add kind=pcq name=8MB pcq-classifier=dst-address pcq-rate=8M

add kind=pcq name=10MB pcq-classifier=dst-address pcq-rate=10M

add kind=pcq name=12MB pcq-classifier=dst-address pcq-rate=12M

add kind=pcq name=20MB pcq-classifier=dst-address pcq-rate=20M

add kind=pcq name=All-Upload pcq-classifier=src-address pcq-rate=50M

add kind=pcq name=1MB pcq-classifier=dst-address pcq-rate=1M

add kind=pcq name=2MB pcq-classifier=dst-address pcq-rate=2M

add kind=pcq name=15MB pcq-classifier=dst-address pcq-rate=15M

add kind=pcq name=GGC-50M pcq-classifier=src-address,dst-address pcq-limit=\ 500KiB pcq-rate=50M pcq-total-limit=200000KiB

add kind=pcq name=FNA-50M pcq-classifier=src-address,dst-address pcq-limit=\ 500KiB pcq-rate=50M pcq-total-limit=200000KiB

add kind=pcq name=BDIX-50M pcq-classifier=src-address,dst-address pcq-limit=\ 500KiB pcq-rate=50M pcq-total-limit=200000KiB



/queue simple

add dst=REGO-BDIX max-limit=1G/1G name=BDIX queue=BDIX-50M/BDIX-50M target=""

add dst=REGO-GGC max-limit=1G/1G name=GGC queue=GGC-50M/GGC-50M target=""

add dst=REGO-FNA max-limit=1G/1G name=FNA queue=FNA-50M/FNA-50M target=""

add max-limit=1G/1G name=1MB-Package queue=All-Upload/1MB target=10.10.0.0/23

add max-limit=1G/1G name=2MB-Package queue=All-Upload/2MB target=10.10.2.0/23

add max-limit=1G/1G name=3MB-Package queue=All-Upload/3MB target=10.10.4.0/23

add max-limit=1G/1G name=5MB-Package queue=All-Upload/5MB target=10.10.6.0/23

add max-limit=1G/1G name=8MB-Package queue=All-Upload/5MB target=10.10.8.0/23

add max-limit=1G/1G name=10MB-Package queue=All-Upload/10MB target=\ 10.10.10.0/23

add max-limit=1G/1G name=12MB-Package queue=All-Upload/12MB target=\ 10.10.12.0/23

add max-limit=1G/1G name=15MB-Package queue=All-Upload/15MB target=\ 10.10.14.0/23

add max-limit=1G/1G name=20MB-Package queue=All-Upload/20MB target=\ 10.10.16.0/23

No comments:

Post a Comment

Thanks for your valuable feedback.

Comprehensive IP Calculator: Supporting Both IPv4 and IPv6

Download:  Download Whether you're a network engineer, IT professional, or simply a tech enthusiast, understanding IP addresses is cruci...