2 Internet (WAN1 + WAN2) ok

🔥 کیا کرے گا یہ اسکرپٹ؟

✔ 2 Internet (WAN1 + WAN2)
✔ Load Balancing (50/50)
✔ Auto Failover
✔ DHCP + DNS ready
✔ Basic firewall


⚠️ Run کرنے سے پہلے چیک کریں

  • WAN1 gateway = 192.168.2.1
  • WAN2 gateway = 192.168.100.1

👉 اگر آپ کے ISP کا IP different ہو تو change کر دیں



INTERFACE RENAME



set [ find default-name=ether1 ] name=WAN1

set [ find default-name=ether2 ] name=WAN2

set [ find default-name=ether3 ] name=LAN1

set [ find default-name=ether4 ] name=LAN2


BRIDGE CONFIG (LAN PORTS)

======================


/interface bridge

add name=LAN-BRIDGE


/interface bridge port

add interface=LAN1 bridge=LAN-BRIDGE

add interface=LAN2 bridge=LAN-BRIDGE



IP ADDRESSING


/ip address

add address=192.168.2.2/24 interface=WAN1

add address=192.168.100.2/24 interface=WAN2

add address=192.168.0.1/24 interface=LAN-BRIDGE




DNS CONFIG


/ip dns

set servers=8.8.8.8 allow-remote-requests=no



DHCP SERVER


/ip pool

add name=dhcp_pool ranges=192.168.0.10-192.168.0.254


/ip dhcp-server


add name=dhcp1 interface=LAN-BRIDGE address-pool=dhcp_pool disabled=no


/ip dhcp-server network

add address=192.168.0.0/24 gateway=192.168.0.1 dns-server=8.8.8.8



NAT


/ip firewall nat

add chain=srcnat out-interface=WAN1 action=masquerade

add chain=srcnat out-interface=WAN2 action=masquerade



ROUTING TABLES (IMPORTANT v7)


/routing table

add name=to_WAN1 fib

add name=to_WAN2 fib



Mangle LOAD BALANCING (PCC)



/ip firewall mangle


add chain=prerouting in-interface=LAN-BRIDGE connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes


add chain=prerouting in-interface=LAN-BRIDGE connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes


add chain=prerouting in-interface=LAN-BRIDGE connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1 passthrough=no


add chain=prerouting in-interface=LAN-BRIDGE connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2 passthrough=no


ROUTES (LOAD BALANCE + FAILOVER)


/ip route


add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-table=to_WAN1 check-gateway=ping


add dst-address=0.0.0.0/0 gateway=192.168.100.1 routing-table=to_WAN2 check-gateway=ping



MAIN ROUTE (FAILOVER)


/ip route


add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=1 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=192.168.100.1 distance=2 check-gateway=ping



FIREWALL BASIC SECURITY


/ip firewall filter


add chain=input connection-state=established,related action=accept

add chain=input connection-state=invalid action=drop

add chain=input protocol=icmp action=accept

add chain=input in-interface=LAN-BRIDGE action=accept

add chain=input action=drop






Comments

Popular posts from this blog

Windows 11 rdp problem resolved

Microsoft Activation Scripts (MAS)

Windows 11 ke common RDP issues fix karta hai