Wednesday, 24 January 2018

Mikrotik Two WAN Failover

Failover with Netwatch



/interface bridge
add name=bridge1
/interface ethernet
set [ find default-name=ether3 ] name=LOCAL
set [ find default-name=ether1 ] name="WAN-1 AIRTEL"
set [ find default-name=ether2 ] name="WAN-2 BSNL"
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.0.40-192.168.0.250
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=bridge1 name=dhcp1
/tool user-manager customer
set admin access=\
    own-routers,own-users,own-profiles,own-limits,config-payment-gw
/interface bridge port
add bridge=bridge1 interface=LOCAL
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether5
add bridge=bridge1 interface=ether6
add bridge=bridge1 interface=ether7
add bridge=bridge1 interface=ether8
add bridge=bridge1 interface=ether9
add bridge=bridge1 interface=ether10
/ip address
add address=1.1.1.1/1 <<<Change IP>>>interface="WAN-1 AIRTEL" network=<<<1.1.1.1/1>>>
add address=192.168.0.1/24 interface=LOCAL network=192.168.0.0
add address=2.2.2.2/2 interface="WAN-2 BSNL" network=2.2.2.2
add address=192.168.30.1 network=255.255.255.0
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface="WAN-2 BSNL"
/ip dhcp-server network
add address=192.168.0.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.0.1
/ip dns
set allow-remote-requests=yes max-udp-packet-size=2096 servers=8.8.4.4
/ip firewall mangle
add action=mark-packet chain=postrouting comment="p2p download" \
    layer7-protocol=*1 new-packet-mark="p2p download" passthrough=no
add action=mark-packet chain=postrouting layer7-protocol=*2 new-packet-mark=\
    "p2p download" passthrough=no
/ip firewall nat
add action=masquerade chain=srcnat out-interface="WAN-1 AIRTEL"
add action=masquerade chain=srcnat out-interface="WAN-2 BSNL"
/ip firewall service-port
set sip disabled=yes
/ip route
add distance=20 gateway=1.1.1.1/1 (Change IP)
add distance=1 dst-address=8.8.8.8/32 gateway=(Change ageway)
add distance=2 dst-address=8.8.8.8/32 type=blackhole
/ip service
set telnet disabled=yes
set ssh disabled=yes
/system clock
set time-zone-name=Asia/Kolkata
/system identity
set name=Office-Router
/system script
add name=AIRTEL owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="/ip\
    \_route set [/ip route find dst-address=\"0.0.0.0/0\"] gateway=1.1.1.1 <<<Change Gateway>>>\
    "
add name=BSNL owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="/ip\
    \_route set [/ip route find dst-address=\"0.0.0.0/0\"] gateway=2.2.2.2<<<Change gateway>>>\
    7"
/tool netwatch

add down-script=BSNL host=8.8.8.8 interval=10s timeout=998ms up-script=AIRTEL

-------------------------------------------------------------------------------------------------------------------

4 comments:

Cisco Commands

Basic Configuration Commands Command  Purpose enable Logs you into enable mode, which is also known as user exec mode or privilege...