Page 1 of 1

L2TP/IPSEC Peers drop / Router reboot needed

Posted: Wed Dec 05, 2018 8:08 pm
by obinoob
Hi,

I'm facing some serious trouble with my L2TP/IPSEC configuration every time a IPSEC peer drops I need to reboot my main router. After the reboot all peers can connect without problem. I can't be sure of whats happening but I'm counting on you guys since I've reached my knowlege on mikrotik / networking.

Thank you in advance.

Image

# dec/05/2018 15:29:57 by RouterOS 6.40.9
# software id = CI7W-VPJL
#
# model = RouterBOARD 750G r3
# serial number = 6F3807BB95D2
/interface bridge
add admin-mac=00:00:00:00:00:00 ageing-time=5m arp=enabled arp-timeout=auto \
    auto-mac=yes disabled=no fast-forward=yes forward-delay=15s \
    max-message-age=20s mtu=auto name=bridge-local priority=0x8000 \
    protocol-mode=none transmit-hold-count=6
/interface ethernet
set [ find default-name=ether1 ] advertise=\
    10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full arp=enabled \
    arp-timeout=auto auto-negotiation=yes bandwidth=unlimited/unlimited \
    disabled=no full-duplex=yes l2mtu=1596 loop-protect=default \
    loop-protect-disable-time=5m loop-protect-send-interval=5s mac-address=\
    6C:3B:6B:AA:68:92 master-port=none mtu=1500 name=ether1 orig-mac-address=\
    64:D1:54:63:00:92 rx-flow-control=off speed=100Mbps tx-flow-control=off
set [ find default-name=ether2 ] advertise=\
    10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full arp=enabled \
    arp-timeout=auto auto-negotiation=yes bandwidth=unlimited/unlimited \
    disabled=no full-duplex=yes l2mtu=1596 loop-protect=default \
    loop-protect-disable-time=5m loop-protect-send-interval=5s mac-address=\
    64:D1:54:63:00:93 master-port=none mtu=1500 name=ether2 orig-mac-address=\
    64:D1:54:63:00:93 rx-flow-control=off speed=100Mbps tx-flow-control=off
set [ find default-name=ether3 ] advertise=\
    10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full arp=enabled \
    arp-timeout=auto auto-negotiation=yes bandwidth=unlimited/unlimited \
    disabled=no full-duplex=yes l2mtu=1596 loop-protect=default \
    loop-protect-disable-time=5m loop-protect-send-interval=5s mac-address=\
    64:D1:54:63:00:94 master-port=none mtu=1500 name=ether3 orig-mac-address=\
    64:D1:54:63:00:94 rx-flow-control=off speed=100Mbps tx-flow-control=off
set [ find default-name=ether4 ] advertise=\
    10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full arp=enabled \
    arp-timeout=auto auto-negotiation=yes bandwidth=unlimited/unlimited \
    disabled=no full-duplex=yes l2mtu=1596 loop-protect=default \
    loop-protect-disable-time=5m loop-protect-send-interval=5s mac-address=\
    64:D1:54:63:00:95 master-port=none mtu=1500 name=ether4 orig-mac-address=\
    64:D1:54:63:00:95 rx-flow-control=off speed=100Mbps tx-flow-control=off
set [ find default-name=ether5 ] advertise=\
    10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full arp=enabled \
    arp-timeout=auto auto-negotiation=yes bandwidth=unlimited/unlimited \
    disabled=no full-duplex=yes l2mtu=1596 loop-protect=default \
    loop-protect-disable-time=5m loop-protect-send-interval=5s mac-address=\
    64:D1:54:63:00:96 master-port=none mtu=1500 name=ether5 orig-mac-address=\
    64:D1:54:63:00:96 rx-flow-control=off speed=100Mbps tx-flow-control=off
/ip neighbor discovery
set ether1 discover=yes
set ether2 discover=yes
set ether3 discover=yes
set ether4 discover=yes
set ether5 discover=yes
set bridge-local discover=yes
/queue interface
set bridge-local queue=no-queue
/interface ethernet switch
set 0 mirror-source=none mirror-target=none name=switch1
/interface ethernet switch port
set 0 default-vlan-id=1 vlan-mode=fallback
set 1 default-vlan-id=1 vlan-mode=fallback
set 2 default-vlan-id=1 vlan-mode=fallback
set 3 default-vlan-id=1 vlan-mode=fallback
set 4 default-vlan-id=1 vlan-mode=fallback
set 5 default-vlan-id=1 vlan-mode=fallback
/interface list
set [ find name=all ] name=all
add name=lan
add name=wan
/ip dhcp-client option
set clientid code=61 name=clientid value="0x01\$(CLIENT_MAC)"
set hostname code=12 name=hostname value="\$(HOSTNAME)"
/ip ipsec mode-config
set [ find default=yes ] name=request-only
/ip ipsec policy group
set [ find default=yes ] name=default
/ip ipsec proposal
set [ find default=yes ] auth-algorithms=sha1 disabled=no enc-algorithms=\
    aes-256-cbc,aes-192-cbc,aes-128-cbc lifetime=1h name=default pfs-group=\
    modp1024
/ip pool
add name=pool-br-lan ranges=192.168.10.101-192.168.10.199
add name=pool-vpn ranges=192.168.40.100-192.168.40.200
/ip dhcp-server
add address-pool=pool-br-lan authoritative=yes bootp-support=static disabled=\
    no interface=bridge-local lease-script="" lease-time=1h name=dhcp-br-lan
/ppp profile
set *0 address-list="" !bridge !bridge-horizon !bridge-path-cost \
    !bridge-port-priority change-tcp-mss=yes !dns-server !idle-timeout \
    !incoming-filter !insert-queue-before !interface-list !local-address \
    name=default on-down="" on-up="" only-one=default !outgoing-filter \
    !parent-queue !queue-type !rate-limit !remote-address !session-timeout \
    use-compression=default use-encryption=default use-mpls=default use-upnp=\
    default !wins-server
set *FFFFFFFE address-list="" !bridge !bridge-horizon !bridge-path-cost \
    !bridge-port-priority change-tcp-mss=yes dns-server=192.168.10.100 \
    !idle-timeout !incoming-filter !insert-queue-before !interface-list \
    local-address=172.16.0.1 name=default-encryption on-down="" on-up="" \
    only-one=default !outgoing-filter !parent-queue !queue-type !rate-limit \
    remote-address=pool-vpn !session-timeout use-compression=default \
    use-encryption=yes use-mpls=default use-upnp=default !wins-server
/queue type
set 0 kind=pfifo name=default pfifo-limit=50
set 1 kind=pfifo name=ethernet-default pfifo-limit=50
set 2 kind=sfq name=wireless-default sfq-allot=1514 sfq-perturb=5
set 3 kind=red name=synchronous-default red-avg-packet=1000 red-burst=20 \
    red-limit=60 red-max-threshold=50 red-min-threshold=10
set 4 kind=sfq name=hotspot-default sfq-allot=1514 sfq-perturb=5
set 5 kind=pcq name=pcq-upload-default pcq-burst-rate=0 pcq-burst-threshold=0 \
    pcq-burst-time=10s pcq-classifier=src-address pcq-dst-address-mask=32 \
    pcq-dst-address6-mask=128 pcq-limit=50KiB pcq-rate=0 \
    pcq-src-address-mask=32 pcq-src-address6-mask=128 pcq-total-limit=2000KiB
set 6 kind=pcq name=pcq-download-default pcq-burst-rate=0 \
    pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=dst-address \
    pcq-dst-address-mask=32 pcq-dst-address6-mask=128 pcq-limit=50KiB \
    pcq-rate=0 pcq-src-address-mask=32 pcq-src-address6-mask=128 \
    pcq-total-limit=2000KiB
set 7 kind=none name=only-hardware-queue
set 8 kind=mq-pfifo mq-pfifo-limit=50 name=multi-queue-ethernet-default
set 9 kind=pfifo name=default-small pfifo-limit=10
/queue interface
set ether1 queue=only-hardware-queue
set ether2 queue=only-hardware-queue
set ether3 queue=only-hardware-queue
set ether4 queue=only-hardware-queue
set ether5 queue=only-hardware-queue
/queue simple
add bucket-size=0.1/0.1 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s \
    disabled=yes dst=ether1 limit-at=0/0 max-limit=10M/100M name=Geral \
    packet-marks="" parent=none priority=8/8 queue=\
    default-small/default-small target="" !time
add bucket-size=0.1/0.1 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s \
    disabled=yes dst=ether1 limit-at=5M/80M max-limit=8M/90M name=\
    Queue-Internel-Sede packet-marks="" parent=Geral priority=8/8 queue=\
    default-small/default-small target=192.168.10.0/24 !time
add bucket-size=0.1/0.1 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s \
    disabled=yes dst=192.168.10.0/24 limit-at=0/0 max-limit=8M/50M name=\
    Queue-VPN-Papelaria packet-marks="" parent=none priority=8/8 queue=\
    default-small/default-small target=192.168.1.0/24 !time
add bucket-size=0.1/0.1 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s \
    disabled=yes dst=192.168.10.0/24 limit-at=8M/30M max-limit=8M/30M name=\
    Queue-VPN-Coimbra packet-marks="" parent=Geral priority=8/8 queue=\
    default-small/default-small target=192.168.30.0/24 !time
add bucket-size=0.1/0.1 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s \
    disabled=yes dst=192.168.10.0/24 limit-at=4M/10M max-limit=6M/20M name=\
    Queue-BPN-Ecosta packet-marks="" parent=Geral priority=8/8 queue=\
    default-small/default-small target=192.168.20.0/24 !time
/routing bgp instance
set default as=65530 client-to-client-reflection=yes !cluster-id \
    !confederation disabled=no ignore-as-path-len=no name=default out-filter=\
    "" redistribute-connected=no redistribute-ospf=no redistribute-other-bgp=\
    no redistribute-rip=no redistribute-static=no router-id=0.0.0.0 \
    routing-table=""
/routing ospf instance
set [ find default=yes ] disabled=no distribute-default=never !domain-id \
    !domain-tag in-filter=ospf-in metric-bgp=auto metric-connected=20 \
    metric-default=1 metric-other-ospf=auto metric-rip=20 metric-static=20 \
    !mpls-te-area !mpls-te-router-id name=default out-filter=ospf-out \
    redistribute-bgp=no redistribute-connected=no redistribute-other-ospf=no \
    redistribute-rip=no redistribute-static=no router-id=0.0.0.0 \
    !routing-table !use-dn
/routing ospf area
set [ find default=yes ] area-id=0.0.0.0 disabled=no instance=default name=\
    backbone type=default
/snmp community
set [ find default=yes ] addresses=0.0.0.0/0 authentication-protocol=MD5 \
    encryption-protocol=DES name=public read-access=yes security=none \
    write-access=no
/system logging action
set 0 memory-lines=1000 memory-stop-on-full=no name=memory target=memory
set 1 disk-file-count=2 disk-file-name=flash/log disk-lines-per-file=1000 \
    disk-stop-on-full=no name=disk target=disk
set 2 name=echo remember=yes target=echo
set 3 bsd-syslog=no name=remote remote=0.0.0.0 remote-port=514 src-address=\
    0.0.0.0 syslog-facility=daemon syslog-severity=auto syslog-time-format=\
    bsd-syslog target=remote
/user group
set read name=read policy="local,telnet,ssh,reboot,read,test,winbox,password,w\
    eb,sniff,sensitive,api,romon,tikapp,!ftp,!write,!policy,!dude" skin=\
    default
set write name=write policy="local,telnet,ssh,reboot,read,write,test,winbox,pa\
    ssword,web,sniff,sensitive,api,romon,tikapp,!ftp,!policy,!dude" skin=\
    default
set full name=full policy="local,telnet,ssh,ftp,reboot,read,write,policy,test,\
    winbox,password,web,sniff,sensitive,api,romon,dude,tikapp" skin=default
/certificate settings
set crl-download=yes crl-use=yes
/interface bridge port
add auto-isolate=no bridge=bridge-local disabled=no edge=auto external-fdb=\
    auto horizon=none interface=ether2 path-cost=10 point-to-point=auto \
    priority=0x80
add auto-isolate=no bridge=bridge-local disabled=no edge=auto external-fdb=\
    auto horizon=none interface=ether3 path-cost=10 point-to-point=auto \
    priority=0x80
add auto-isolate=no bridge=bridge-local disabled=no edge=auto external-fdb=\
    auto horizon=none interface=ether4 path-cost=10 point-to-point=auto \
    priority=0x80
add auto-isolate=no bridge=bridge-local disabled=no edge=auto external-fdb=\
    auto horizon=none interface=ether5 path-cost=10 point-to-point=auto \
    priority=0x80
add auto-isolate=no disabled=no edge=auto external-fdb=auto horizon=none \
    path-cost=10 point-to-point=auto priority=0x80
/interface bridge settings
set allow-fast-path=yes use-ip-firewall=no use-ip-firewall-for-pppoe=no \
    use-ip-firewall-for-vlan=no
/ip firewall connection tracking
set enabled=auto generic-timeout=10m icmp-timeout=10s tcp-close-timeout=10s \
    tcp-close-wait-timeout=10s tcp-established-timeout=1d \
    tcp-fin-wait-timeout=10s tcp-last-ack-timeout=10s \
    tcp-max-retrans-timeout=5m tcp-syn-received-timeout=5s \
    tcp-syn-sent-timeout=5s tcp-time-wait-timeout=10s tcp-unacked-timeout=5m \
    udp-stream-timeout=3m udp-timeout=10s
/ip neighbor discovery settings
set default=yes default-for-dynamic=no
/ip settings
set accept-redirects=no accept-source-route=no allow-fast-path=no \
    arp-timeout=30s icmp-rate-limit=10 icmp-rate-mask=0x1818 ip-forward=yes \
    max-neighbor-entries=8192 route-cache=yes rp-filter=no secure-redirects=\
    yes send-redirects=yes tcp-syncookies=no
/interface l2tp-server server
set allow-fast-path=yes authentication=mschap1,mschap2 caller-id-type=\
    ip-address default-profile=default-encryption enabled=yes \
    keepalive-timeout=30 max-mru=1450 max-mtu=1450 max-sessions=unlimited \
    mrru=disabled one-session-per-host=yes use-ipsec=yes
/interface list member
add disabled=no interface=bridge-local list=lan
add disabled=no interface=ether1 list=wan
/interface ovpn-server server
set auth=sha1,md5 cipher=blowfish128,aes128 default-profile=default enabled=\
    no keepalive-timeout=60 mac-address=FE:50:D3:1D:4E:17 max-mtu=1500 mode=\
    ip netmask=24 port=1194 require-client-certificate=no
/interface pptp-server server
set authentication=mschap1,mschap2 default-profile=default-encryption \
    enabled=no keepalive-timeout=30 max-mru=1450 max-mtu=1450 mrru=disabled
/interface sstp-server server
set authentication=pap,chap,mschap1,mschap2 certificate=none default-profile=\
    default enabled=no force-aes=no keepalive-timeout=60 max-mru=1500 \
    max-mtu=1500 mrru=disabled pfs=no port=443 tls-version=any \
    verify-client-certificate=no
/ip accounting
set account-local-traffic=no enabled=no threshold=256
/ip accounting web-access
set accessible-via-web=no address=0.0.0.0/0
/ip address
add address=192.168.10.254/24 disabled=no interface=bridge-local network=\
    192.168.10.0
add address=100.67.15.26/30 disabled=no interface=ether1 network=100.67.15.24
add address=61.38.210.177/32 disabled=no interface=ether1 network=\
    61.38.210.177
/ip cloud
set ddns-enabled=yes update-time=yes
/ip cloud advanced
set use-local-address=no
/ip dhcp-client
add add-default-route=yes default-route-distance=1 dhcp-options=\
    hostname,clientid disabled=yes interface=ether1 use-peer-dns=yes \
    use-peer-ntp=yes
/ip dhcp-server config
set store-leases-disk=5m
/ip dhcp-server network
add address=192.168.10.0/24 caps-manager="" dhcp-option="" dns-server=\
    192.168.10.100 gateway=192.168.10.254 ntp-server="" wins-server=""
/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB \
    max-concurrent-queries=100 max-concurrent-tcp-sessions=20 \
    max-udp-packet-size=4096 query-server-timeout=2s query-total-timeout=10s \
    servers=192.168.10.254,192.168.10.100,62.28.40.173,61.38.210.177
/ip firewall address-list
add address=0.0.0.0/8 disabled=no list=bogons
add address=10.0.0.0/8 disabled=no list=bogons
add address=100.64.0.0/10 disabled=no list=bogons
add address=127.0.0.0/8 disabled=no list=bogons
add address=169.254.0.0/16 disabled=no list=bogons
add address=172.16.0.0/12 disabled=no list=bogons
add address=192.0.0.0/24 disabled=no list=bogons
add address=192.0.2.0/24 disabled=no list=bogons
add address=192.168.0.0/16 disabled=no list=bogons
add address=198.18.0.0/15 disabled=no list=bogons
add address=198.51.100.0/24 disabled=no list=bogons
add address=203.0.113.0/24 disabled=no list=bogons
add address=224.0.0.0/3 disabled=no list=bogons
/ip firewall filter
add action=fasttrack-connection chain=forward comment=\
    "FastTrack ALL Except IPSec" connection-bytes=10000-0 connection-mark=\
    !ipsec connection-state=established,related
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept established,related" \
    connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related" \
    connection-bytes=10000-0 connection-state=established,related
add action=accept chain=fw-lan-wan comment="allow TCP" protocol=tcp
add action=accept chain=fw-lan-wan comment="allow UDP" protocol=udp
add action=accept chain=fw-lan-wan comment=gre protocol=gre
add action=drop chain=fw-lan-wan
add action=reject chain=fw-lan-wan comment=bogons dst-address-list=bogons \
    reject-with=icmp-network-unreachable
add action=drop chain=fw-all comment="src-addr-list: blacklist" \
    src-address-list=blacklist
add action=drop chain=fw-all comment="conn-mark: blacklist" connection-mark=\
    blacklist
add action=drop chain=fw-all comment=invalid connection-state=invalid
add action=accept chain=fw-all comment="limited icmp" limit=10,5:packet \
    protocol=icmp
add action=drop chain=fw-all comment=icmp protocol=icmp
add action=accept chain=fw-all comment="established, related" \
    connection-state=established,related
add action=jump chain=forward comment="jump fw-all" jump-target=fw-all
add action=jump chain=forward comment="jump fw-all" in-interface=bridge-local \
    jump-target=fw-all
add action=jump chain=forward comment="jump fw-all" in-interface=ether1 \
    jump-target=fw-all
add action=drop chain=fw-wan comment="src-addr-list: bogons" \
    src-address-list=bogons
add action=accept chain=fw-wan-lan dst-address=192.168.10.100 dst-port=3389 \
    in-interface=ether1 log=yes log-prefix=RDP-LOGIN protocol=tcp
add action=accept chain=fw-wan-lan comment=WebEticadata dst-address=\
    192.168.10.100 dst-port=80 in-interface=ether1 log=yes log-prefix=\
    Web-Eticad protocol=tcp
add action=drop chain=fw-wan-lan
add action=jump chain=input comment="jump in-all" jump-target=in-all
add action=drop chain=in-all comment="src-addr-list: blacklist" \
    src-address-list=blacklist
add action=drop chain=in-all comment="conn-mark: blacklist" connection-mark=\
    blacklist
add action=drop chain=in-all comment=invalid connection-state=invalid
add action=add-src-to-address-list address-list=blacklist \
    address-list-timeout=30m chain=in-all comment=syn-flood connection-limit=\
    30,32 protocol=tcp tcp-flags=syn
add action=add-src-to-address-list address-list=blacklist \
    address-list-timeout=30m chain=in-all comment=port-scanner protocol=tcp \
    psd=21,3s,3,1
add action=jump chain=in-all comment="check icmp" jump-target=icmp
add action=accept chain=icmp comment="Echo request - Avoiding Ping Flood" \
    icmp-options=8:0 limit=20,5:packet protocol=icmp
add action=accept chain=icmp comment="Echo reply" icmp-options=0:0 protocol=\
    icmp
add action=accept chain=icmp comment="Time Exceeded" icmp-options=11:0 \
    protocol=icmp
add action=accept chain=icmp comment="Destination unreachable" icmp-options=\
    3:0-1 protocol=icmp
add action=accept chain=icmp comment=PMTUD icmp-options=3:4 protocol=icmp
add action=drop chain=icmp comment="Drop to the other ICMPs" protocol=icmp
add action=jump chain=output comment="Jump for icmp output" jump-target=ICMP \
    protocol=icmp
add action=accept chain=in-all comment="established, related" \
    connection-state=established,related
add action=drop chain=in-wan comment="src-addr-list: bogons" \
    src-address-list=bogons
add action=accept chain=in-wan comment=winbox dst-port=8291 protocol=tcp
add action=accept chain=in-wan comment="IPsec 500" dst-port=500 protocol=udp
add action=accept chain=in-wan comment="IPsec 4500" dst-port=4500 protocol=\
    udp
add action=accept chain=in-wan comment="IPsec 4500" dst-port=1701 protocol=\
    udp
add action=accept chain=in-wan comment="IPsec esp" protocol=ipsec-esp
add action=accept chain=in-wan comment="IPsec ah" protocol=ipsec-ah
add action=drop chain=input comment="Disable Remote DNS Requests" dst-port=53 \
    protocol=udp src-address=!192.168.10.0/24
add action=drop chain=input comment="Disable Remote DNS Requests" dst-port=53 \
    protocol=udp src-address=!192.168.1.0/24
add action=drop chain=input comment="Disable Remote DNS Requests" dst-port=53 \
    protocol=udp src-address=!192.168.20.0/24
add action=drop chain=input comment="Disable Remote DNS Requests" dst-port=53 \
    protocol=udp src-address=!192.168.30.0/24
add action=drop chain=in-wan comment="defconf: drop all from WAN" \
    in-interface-list=wan
/ip firewall mangle
add action=mark-connection chain=forward comment=\
    "Mark IPsec - Caso IPSEC N\E3o Funcione Remover" ipsec-policy=out,ipsec \
    new-connection-mark=ipsec passthrough=yes
add action=mark-connection chain=forward comment="Mark IPsec" ipsec-policy=\
    in,ipsec new-connection-mark=ipsec passthrough=yes
/ip firewall nat
add action=accept chain=srcnat comment="Regra IPSEC SEDE" dst-address=\
    192.168.1.0/24 src-address=192.168.10.0/24 !to-addresses !to-ports
add action=accept chain=srcnat comment="Regra IPSEC COIMBRA" dst-address=\
    192.168.20.0/24 src-address=192.168.10.0/24 !to-addresses !to-ports
add action=accept chain=srcnat comment="Regra IPSEC ECOSTA" dst-address=\
    192.168.30.0/24 src-address=192.168.10.0/24 !to-addresses !to-ports
add action=accept chain=srcnat comment="Regra IPSec Bypass" dst-address=\
    192.168.10.0/24 !to-addresses !to-ports
add action=src-nat chain=srcnat comment="Source Nat" out-interface=ether1 \
    to-addresses=61.38.210.177 !to-ports
/ip firewall service-port
set ftp disabled=yes ports=21,8021
set tftp disabled=yes ports=69
set irc disabled=yes ports=6667
set h323 disabled=yes
set sip disabled=yes ports=5060,5061 sip-direct-media=yes sip-timeout=1h
set pptp disabled=yes
set udplite disabled=yes
set dccp disabled=yes
set sctp disabled=yes
/ip ipsec peer
add address=94.142.190.171/32 auth-method=pre-shared-key comment=PAPELARIA \
    dh-group=modp1024 disabled=no dpd-interval=2m dpd-maximum-failures=5 \
    enc-algorithm=aes-128,3des exchange-mode=main generate-policy=no \
    hash-algorithm=sha1 lifetime=1d nat-traversal=no policy-template-group=\
    default proposal-check=obey send-initial-contact=yes
add address=79.165.18.176/32 auth-method=pre-shared-key comment=COIMBRA \
    dh-group=modp1024 disabled=no dpd-interval=2m dpd-maximum-failures=5 \
    enc-algorithm=aes-128,3des exchange-mode=main generate-policy=no \
    hash-algorithm=sha1 lifetime=1d nat-traversal=no policy-template-group=\
    default proposal-check=obey send-initial-contact=yes
add address=213.22.28.134/32 auth-method=pre-shared-key comment=ECOSTA \
    dh-group=modp1024 disabled=no dpd-interval=2m dpd-maximum-failures=5 \
    enc-algorithm=aes-128,3des exchange-mode=main generate-policy=no \
    hash-algorithm=sha1 lifetime=1d nat-traversal=no policy-template-group=\
    default proposal-check=obey send-initial-contact=yes
/ip ipsec policy
add action=encrypt comment=COIMBRA disabled=no dst-address=192.168.20.0/24 \
    dst-port=any ipsec-protocols=esp level=require proposal=default protocol=\
    all sa-dst-address=79.165.18.176 sa-src-address=61.38.210.177 \
    src-address=192.168.10.0/24 src-port=any tunnel=yes
add action=encrypt comment=ECOSTA disabled=no dst-address=192.168.30.0/24 \
    dst-port=any ipsec-protocols=esp level=require proposal=default protocol=\
    all sa-dst-address=213.22.28.134 sa-src-address=61.38.210.177 \
    src-address=192.168.10.0/24 src-port=any tunnel=yes
add action=encrypt comment=PAPELARIA disabled=no dst-address=192.168.1.0/24 \
    dst-port=any ipsec-protocols=esp level=require proposal=default protocol=\
    all sa-dst-address=94.142.190.171 sa-src-address=61.38.210.177 \
    src-address=192.168.10.0/24 src-port=any tunnel=yes
set 3 comment="Default policy" disabled=no dst-address=::/0 group=default \
    proposal=default protocol=all src-address=::/0 template=yes
/ip ipsec user settings
set xauth-use-radius=no
/ip proxy
set always-from-cache=no anonymous=no cache-administrator=webmaster \
    cache-hit-dscp=4 cache-on-disk=no cache-path=web-proxy enabled=no \
    max-cache-object-size=2048KiB max-cache-size=unlimited \
    max-client-connections=600 max-fresh-time=3d max-server-connections=600 \
    parent-proxy=:: parent-proxy-port=0 port=8080 serialize-connections=no \
    src-address=::
/ip route
add !bgp-as-path !bgp-atomic-aggregate !bgp-communities !bgp-local-pref \
    !bgp-med !bgp-origin !bgp-prepend !check-gateway disabled=no distance=1 \
    dst-address=0.0.0.0/0 gateway=100.67.15.25 !route-tag !routing-mark \
    scope=30 target-scope=10
add !bgp-as-path !bgp-atomic-aggregate !bgp-communities !bgp-local-pref \
    !bgp-med !bgp-origin !bgp-prepend !check-gateway disabled=no distance=1 \
    dst-address=192.168.1.0/24 gateway=bridge-local pref-src=192.168.10.254 \
    !route-tag !routing-mark scope=30 target-scope=10
add !bgp-as-path !bgp-atomic-aggregate !bgp-communities !bgp-local-pref \
    !bgp-med !bgp-origin !bgp-prepend !check-gateway disabled=no distance=1 \
    dst-address=192.168.20.0/24 gateway=bridge-local pref-src=192.168.10.254 \
    !route-tag !routing-mark scope=30 target-scope=10
add !bgp-as-path !bgp-atomic-aggregate !bgp-communities !bgp-local-pref \
    !bgp-med !bgp-origin !bgp-prepend !check-gateway disabled=no distance=1 \
    dst-address=192.168.30.0/24 gateway=bridge-local pref-src=192.168.10.254 \
    !route-tag !routing-mark scope=30 target-scope=10
/ip service
set telnet address="" disabled=yes port=23
set ftp address="" disabled=yes port=21
set www address="" disabled=yes port=80
set ssh address="" disabled=yes port=22
set www-ssl address="" certificate=none disabled=yes port=443
set api address="" disabled=yes port=8728
set winbox address="" disabled=no port=8291
set api-ssl address="" certificate=none disabled=yes port=8729
/ip smb
set allow-guests=yes comment=MikrotikSMB domain=MSHOME enabled=no interfaces=\
    all
/ip smb shares
set [ find default=yes ] comment="default share" directory=/flash/pub \
    disabled=no max-sessions=10 name=pub
/ip smb users
set [ find default=yes ] disabled=no name=guest read-only=yes
/ip socks
set connection-idle-timeout=2m enabled=no max-connections=200 port=1080
/ip ssh
set always-allow-password-login=no forwarding-enabled=no host-key-size=2048 \
    strong-crypto=no
/ip traffic-flow
set active-flow-timeout=30m cache-entries=64k enabled=no \
    inactive-flow-timeout=15s interfaces=all
/ip traffic-flow ipfix
set bytes=yes dst-address=yes dst-address-mask=yes dst-mac-address=yes \
    dst-port=yes first-forwarded=yes gateway=yes icmp-code=yes icmp-type=yes \
    igmp-type=yes in-interface=yes ip-header-length=yes ip-total-length=yes \
    ipv6-flow-label=yes is-multicast=yes last-forwarded=yes nat-dst-address=\
    yes nat-dst-port=yes nat-src-address=yes nat-src-port=yes out-interface=\
    yes packets=yes protocol=yes src-address=yes src-address-mask=yes \
    src-mac-address=yes src-port=yes tcp-ack-num=yes tcp-flags=yes \
    tcp-seq-num=yes tcp-window-size=yes tos=yes ttl=yes udp-length=yes
/ip upnp
set allow-disable-external-interface=no enabled=no show-dummy-rule=yes
/port firmware
set directory=firmware ignore-directip-modem=no
/ppp aaa
set accounting=yes interim-update=0s use-circuit-id-in-nas-port-id=no \
    use-radius=no
/ppp secret
add caller-id="" disabled=no limit-bytes-in=0 limit-bytes-out=0 \
    !local-address name=joao profile=default-encryption !remote-address \
    routes="" service=l2tp
add caller-id="" disabled=no limit-bytes-in=0 limit-bytes-out=0 \
    !local-address name=bugbyte profile=default-encryption !remote-address \
    routes="" service=l2tp
/radius incoming
set accept=no port=3799
/routing bfd interface
set [ find default=yes ] disabled=no interface=all interval=0.2s min-rx=0.2s \
    multiplier=5
/routing mme
set bidirectional-timeout=2 gateway-class=none gateway-keepalive=1m \
    gateway-selection=no-gateway origination-interval=5s preferred-gateway=\
    0.0.0.0 timeout=1m ttl=50
/routing rip
set distribute-default=never garbage-timer=2m metric-bgp=1 metric-connected=1 \
    metric-default=1 metric-ospf=1 metric-static=1 redistribute-bgp=no \
    redistribute-connected=no redistribute-ospf=no redistribute-static=no \
    routing-table=main timeout-timer=3m update-timer=30s
/snmp
set contact="" enabled=no engine-id="" location="" trap-community=public \
    trap-generators="" trap-target="" trap-version=1
/system clock
set time-zone-autodetect=yes time-zone-name=Europe/Lisbon
/system clock manual
set dst-delta=+00:00 dst-end="jan/01/1970 00:00:00" dst-start=\
    "jan/01/1970 00:00:00" time-zone=+00:00
/system identity
set name=PAPIRO-SEDE
/system leds
add disabled=no
/system leds settings
set all-leds-off=never
/system logging
set 0 action=memory disabled=no prefix="" topics=info
set 1 action=memory disabled=no prefix="" topics=error
set 2 action=memory disabled=no prefix="" topics=warning
set 3 action=echo disabled=no prefix="" topics=critical
add action=memory disabled=no prefix="" topics=ipsec
add action=memory disabled=no prefix="" topics=l2tp
/system note
set note="" show-at-login=yes
/system ntp client
set enabled=no primary-ntp=0.0.0.0 secondary-ntp=0.0.0.0 server-dns-names=""
/system package update
set channel=bugfix
/system resource irq
set 0 cpu=auto
set 1 cpu=auto
set 2 cpu=auto
/system resource irq rps
set ether1 disabled=no
set ether2 disabled=no
set ether3 disabled=no
set ether4 disabled=no
set ether5 disabled=no
/system routerboard settings
set boot-device=nand-if-fail-then-ethernet boot-protocol=bootp \
    force-backup-booter=no protected-routerboot=disabled \
    reformat-hold-button=20s reformat-hold-button-max=10m silent-boot=no
/system routerboard mode-button
set enabled=no on-event=""
/system scheduler
add disabled=no interval=10m name=SCH-IPSEC-PAPELARIA on-event=IP-PAPELARIA \
    policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
    start-time=startup
add disabled=no interval=10m name=SCH-IPSEC-ECOSTA on-event=IP-ECOSTA policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
    start-time=startup
add disabled=no interval=10m name=SCH-IPSEC-COIMBRA on-event=IP-COIMBRA \
    policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
    start-time=startup
/system script
add name=IP-PAPELARIA owner=bugbyte policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\
    local peerid \"PAPELARIA\"\r\
    \n:local peerhost \"6f3805467426766.sn.mynetname.net\"\r\
    \n:local peerip [:resolve \$peerhost]\r\
    \n:local peeruid\r\
    \n:local policyuid\r\
    \n\r\
    \n:set peeruid [/ip ipsec peer find comment=\"\$peerid\" and address!=\"\$\
    peerip/32\"]\r\
    \n:set policyuid [/ip ipsec policy find comment=\"\$peerid\" and sa-dst-ad\
    dress!=\"\$peerip\"]\r\
    \n\r\
    \n:if (\$peeruid != \"\") do={\r\
    \n  /ip ipsec peer set \$peeruid address=\"\$peerip/32\"\r\
    \n  :log info \"Script ipsec-peer-update updated peer '\$peerid' with addr\
    ess '\$peerip'\"\r\
    \n} else {\r\
    \n  :log info \"NO CHANGED NEEDED\"\r\
    \n}\r\
    \n\r\
    \n:if (\$policyuid != \"\") do={\r\
    \n  /ip ipsec policy set \$policyuid sa-dst-address=\"\$peerip\"\r\
    \n  :log info \"Script ipsec-peer-update updated policy '\$peerid' with ad\
    dress '\$peerip'\"\r\
    \n} else {\r\
    \n  :log info \"NO CHANGED NEEDED\"\r\
    \n}\r\
    \n\r\
    \n:log info \"END\""
add name=IP-COIMBRA owner=bugbyte policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\
    local peerid \"COIMBRA\"\r\
    \n:local peerhost \"resolve 6F3dsfsf4536C4C9.sn.mynetname.net\"\r\
    \n:local peerip [:resolve \$peerhost]\r\
    \n:local peeruid\r\
    \n:local policyuid\r\
    \n\r\
    \n:set peeruid [/ip ipsec peer find comment=\"\$peerid\" and address!=\"\$\
    peerip/32\"]\r\
    \n:set policyuid [/ip ipsec policy find comment=\"\$peerid\" and sa-dst-ad\
    dress!=\"\$peerip\"]\r\
    \n\r\
    \n:if (\$peeruid != \"\") do={\r\
    \n  /ip ipsec peer set \$peeruid address=\"\$peerip/32\"\r\
    \n  :log info \"Script ipsec-peer-update updated peer '\$peerid' with addr\
    ess '\$peerip'\"\r\
    \n} else {\r\
    \n  :log info \"NO CHANGED NEEDED\"\r\
    \n}\r\
    \n\r\
    \n:if (\$policyuid != \"\") do={\r\
    \n  /ip ipsec policy set \$policyuid sa-dst-address=\"\$peerip\"\r\
    \n  :log info \"Script ipsec-peer-update updated policy '\$peerid' with ad\
    dress '\$peerip'\"\r\
    \n} else {\r\
    \n  :log info \"NO CHANGED NEEDED\"\r\
    \n}\r\
    \n\r\
    \n:log info \"END\""
add name=IP-ECOSTA owner=bugbyte policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\
    local peerid \"ECOSTA\"\r\
    \n:local peerhost \"resolve 6f3756756a7564.sn.mynetname.net\"\r\
    \n:local peerip [:resolve \$peerhost]\r\
    \n:local peeruid\r\
    \n:local policyuid\r\
    \n\r\
    \n:set peeruid [/ip ipsec peer find comment=\"\$peerid\" and address!=\"\$\
    peerip/32\"]\r\
    \n:set policyuid [/ip ipsec policy find comment=\"\$peerid\" and sa-dst-ad\
    dress!=\"\$peerip\"]\r\
    \n\r\
    \n:if (\$peeruid != \"\") do={\r\
    \n  /ip ipsec peer set \$peeruid address=\"\$peerip/32\"\r\
    \n  :log info \"Script ipsec-peer-update updated peer '\$peerid' with addr\
    ess '\$peerip'\"\r\
    \n} else {\r\
    \n  :log info \"NO CHANGED NEEDED\"\r\
    \n}\r\
    \n\r\
    \n:if (\$policyuid != \"\") do={\r\
    \n  /ip ipsec policy set \$policyuid sa-dst-address=\"\$peerip\"\r\
    \n  :log info \"Script ipsec-peer-update updated policy '\$peerid' with ad\
    dress '\$peerip'\"\r\
    \n} else {\r\
    \n  :log info \"NO CHANGED NEEDED\"\r\
    \n}\r\
    \n\r\
    \n:log info \"END\""
/system upgrade mirror
set check-interval=1d enabled=no primary-server=0.0.0.0 secondary-server=\
    0.0.0.0 user=""
/system watchdog
set auto-send-supout=no automatic-supout=yes no-ping-delay=5m watch-address=\
    none watchdog-timer=yes
/tool bandwidth-server
set allocate-udp-ports-from=2000 authenticate=yes enabled=yes max-sessions=\
    100
/tool e-mail
set address=0.0.0.0 from=<> port=25 start-tls=no user=""
/tool graphing
set page-refresh=300 store-every=5min
/tool mac-server
set [ find default=yes ] disabled=no interface=all
/tool mac-server mac-winbox
set [ find default=yes ] disabled=no interface=all
/tool mac-server ping
set enabled=yes
/tool romon
set enabled=no id=00:00:00:00:00:00
/tool romon port
set [ find default=yes ] cost=100 disabled=no forbid=no interface=all
/tool sms
set allowed-number="" channel=0 keep-max-sms=0 port=none receive-enabled=no
/tool sniffer
set file-limit=1000KiB file-name="" filter-cpu="" filter-direction=any \
    filter-interface="" filter-ip-address="" filter-ip-protocol="" \
    filter-ipv6-address="" filter-mac-address="" filter-mac-protocol="" \
    filter-operator-between-entries=or filter-port="" filter-stream=no \
    memory-limit=100KiB memory-scroll=yes only-headers=no streaming-enabled=\
    no streaming-server=0.0.0.0
/tool traffic-generator
set latency-distribution-max=100us measure-out-of-order=no \
    stats-samples-to-keep=100 test-id=0
/user aaa
set accounting=yes default-group=read exclude-groups="" interim-update=0s \
    use-radius=no

Re: L2TP/IPSEC Peers drop / Router reboot needed

Posted: Tue Jan 08, 2019 10:33 am
by samad1230
/ppp secret set profile=2_Mbps [find name=user]

PHP Code ?