Pages

Wednesday, May 16, 2012

MikrotiK Simple Queue

Just type  
/Queue simple name="172.16.1.1" target-addresses=172.16.1.1/32 interface=all parent=none direction=both priority=8 limit-at=32k/32k max-limit=256k/256k

Sunday, March 18, 2012

P21 -- What is T1 and E1 ?

T1 
T1 is a digital carrier signal that transmits the DS – 1 signal. It has a data rate of about 1.544 megabits / second. It contains twenty four digital channels and hence requires a device that has digital connection. This digital connection is called as the CSU / DSU – Customer Switching Unit or Digital Switching Unit. The scalability of the T1 is up to 200 and above users. It also provides some services similar to the internet provider. Most of the computer uses a T1 connection. This technology makes your modem to have higher speeds and it is an affordable technology.  

E1
E1 is similar to the T1. T1 is the North American term whereas the E1 is the European term for the transmission (digital). The data rate of E1 is about 2 mega bits per second. It has 32 channels at the speed of 64 Kbps. It is important to know that 2 channels among the 32 are already reserved. One channel is used for signaling while the other channel is used for controlling. The difference between T1 and E1 lies in the number of channels here. The speed remains the same. There may be inter – connection between the E1 and T1 lines. This is interconnected because it is used for international purpose. 

Tuesday, March 13, 2012

P20 -- Well known TCP and UDP ports

7 TCP/UDP echo 792 echo -
20 TCP File Transport Protocol (FTP) 959 ftp-data -
21 TCP FTP control 959 ftp -
22 TCP Secure Shell (SSH) 4250 - 4254 ssh -
23 TCP Telnet 854 telnet -
25 TCP Simple Mail Transfer Protocol (SMTP) 5321 smtp Mail (for sending email); MobileMe Mail (sending)
53 TCP/UDP Domain Name System (DNS) 1034 domain MacDNS, FaceTime
67 UDP Bootstrap Protocol Server (BootP, bootps) 951 bootps NetBoot via DHCP
68 UDP Bootstrap Protocol Client (bootpc) 951 bootpc NetBoot via DHCP
69 UDP Trivial File Transfer Protocol (TFTP) 1350 tftp -
79 TCP Finger 1288 finger -
80 TCP Hypertext Transfer Protocol (HTTP) 2616 http World Wide Web, MobileMe, QuickTime Installer, iTunes Store and Radio, Software Update, RAID Admin, Backup, iCal calendar publishing, iWeb, WebDAV (iDisk), Final Cut Server, AirPlay, OS X Lion Internet Restore, Profile Manager.
88 TCP Kerberos 4120 kerberos -
106 TCP Password Server
(Unregistered Use)
- 3com-tsmux Mac OS X Server Password Server
110 TCP Post Office Protocol (POP3)
Authenticated Post Office Protocol (APOP)
1939 pop3 Mail (for receiving email)
111 TCP/UDP Remote Procedure Call (RPC) 1057, 1831 sunrpc Portmap (sunrpc)
113 TCP Identification Protocol 1413 ident -
115 TCP Secure File Transfer Program (SFTP) 913 sftp Note: Some authorities reference a "Simple File Transport Protocol" or "Secured File Transport Protocol" on this port.
119 TCP Network News Transfer Protocol (NNTP) 3977 nntp Used by applications that read newsgroups.
123 TCP/UDP Network Time Protocol (NTP) 1305 ntp Date & Time preferences. Used for network time server synchronization, AppleTV Network Time Server Sync
137 UDP Windows Internet Naming Service (WINS) - netbios-ns -
138 UDP NETBIOS Datagram Service - netbios-dgm Windows Datagram Service, Windows Network Neighborhood
139 TCP Server Message Block (SMB) - netbios-ssn Used by Microsoft Windows file and print services, such as Windows Sharing in Mac OS X.
143 TCP Internet Message Access Protocol (IMAP) 3501 imap Mail (for receiving email); MobileMe Mail (IMAP)
161 UDP Simple Network Management Protocol (SNMP) 1157 snmp -
192 UDP OSU Network Monitoring System - osu-nms AirPort Base Station PPP status or discovery (certain configurations), AirPort Admin Utility, AirPort Express Assistant
311 TCP Secure server administration - asip-webadmin Server Admin, Workgroup Manager, Server Monitor, Xsan Admin
389 TCP Lightweight Directory Access Protocol (LDAP) 4511 ldap Used by applications that look up addresses, such as Mail and Address Book.
427 TCP/UDP Service Location Protocol (SLP) 2608 svrloc Network Browser
443 TCP Secure Sockets Layer (SSL, or "HTTPS") 2818 https TLS websites, iTunes Store, FaceTime, Game Center, MobileMe (authentication, iDisk, iDisk Sync, and MobileMe Sync), AirPlay, OS X Lion Internet Restore, Profile Manager.
445 TCP Microsoft SMB Domain Server - microsoft-ds -
464 TCP/UDP kpasswd 3244 kpasswd -
497 TCP/UDP Dantz Retrospect - dantz -
500 UDP ISAKMP/IKE - isakmp Mac OS X Server VPN service, Back to My Mac (MobileMe, Mac OS X v10.5 or later).
514 TCP shell - shell -
514 UDP Syslog - syslog -
515 TCP Line Printer (LPR), Line Printer Daemon (LPD) - printer Used for printing to a network printer, Printer Sharing in Mac OS X.
532 TCP netnews - netnews -
548 TCP Apple Filing Protocol (AFP) over TCP - afpovertcp AppleShare, Personal File Sharing, Apple File Service
554 TCP/UDP Real Time Streaming Protocol (RTSP) 2326 rtsp QuickTime Streaming Server (QTSS), streaming media players, AirPlay
587 TCP Message Submission for Mail (Authenticated SMTP) 4409 submission Mail (for sending mail), MobileMe Mail (SMTP authentication)
600-1023 TCP/UDP Mac OS X RPC-based services - ipcserver Used by NetInfo, for example.
623 UDP Lights-Out-Monitoring - asf-rmcp Used by Intel Xserves' Lights-Out-Monitoring (LOM) feature; used by Server Monitor
625 TCP Directory Service Proxy (DSProxy) (Unregistered Use) - dec_dlm DirectoryService, Open Directory Assistant, Workgroup Manager. Note: This port is registered to DEC DLM.
626 TCP AppleShare Imap Admin (ASIA) - asia IMAP Administration (Mac OS X Server 10.2.8 or earlier, AppleShare IP 6)
626 UDP serialnumberd (Unregistered Use) - asia Server serial number registration (Xsan, Mac OS X Server v10.3 - v10.6)
631 TCP Internet Printing Protocol (IPP) 2910 ipp Mac OS X Printer Sharing, Printing to many common printers
636 TCP Secure LDAP - ldaps -
660 TCP MacOS Server Admin - mac-srvr-admin Server Admin (both AppleShare IP and Mac OS X Server), Server settings
687 TCP Server administration - asipregistry Server app, Server Admin, Workgroup Manager, Server Monitor, Xsan Admin
749 TCP/UDP Kerberos 5 admin/changepw - kerberos-adm -
985 TCP NetInfo Static Port - - -
993 TCP Mail IMAP SSL - imaps MobileMe Mail (SSL IMAP)
995 TCP/UDP Mail POP SSL - pop3s -
1085 TCP/UDP WebObjects - webobjects -
1099 & 8043 TCP Remote RMI and IIOP Acess to JBOSS - rmiregistry -
1220 TCP QT Server Admin - qt-serveradmin Used for administration of QuickTime Streaming Server.
1640 TCP Certificate Enrollment Server - cert-responder Profile Manager, SCEP
1649 TCP IP Failover - kermit -
1701 UDP L2TP - l2f Mac OS X Server VPN service
1723 TCP PPTP - pptp Mac OS X Server VPN service
2049 TCP/UDP Network File System (NFS) (version 3 and 4) 1094 nfsd -
2195 TCP Apple Push Notification Service (APNS) - - Push notifications
2196 TCP Apple Push Notification Service (APNS) - - Feedback service
2336 TCP Mobile account sync - appleugcontrol Home directory synchronization
3004 TCP iSync - csoftragent -
3031 TCP/UDP Remote AppleEvents - eppc Program Linking, Remote Apple Events
3283 TCP/UDP Net Assistant - net-assistant Apple Remote Desktop 2.0 or later (Reporting feature)
3306 TCP MySQL - mysql -
3478-3497 UDP - - nat-stun-port - ipether232port FaceTime, Game Center
3632 TCP Distributed compiler - distcc -
3659 TCP/UDP Simple Authentication and Security Layer (SASL) - apple-sasl Mac OS X Server Password Server
3689 TCP Digital Audio Access Protocol (DAAP) - daap iTunes Music Sharing, AirPlay
4111 TCP XGrid - xgrid -
4398 UDP - - - Game Center
4488 TCP/UDP Apple Wide Area Connectivity Service   awacs-ice Back To My Mac
4500 UDP IKE NAT Traversal - ipsec-msft Mac OS X Server VPN service, Back to My Mac (MobileMe, Mac OS X v10.5 or later).
Note: VPN and MobileMe are mutually exclusive when configured through an Apple access point (such as an AirPort Base Station); MobileMe will take precedence.
5003 TCP FileMaker - name binding and transport - fmpro-internal -
5009 TCP (Unregistered Use) - winfs AirPort Admin Utility, AirPort Express Assistant
5060 UDP Session Initiation Protocol (SIP) 3261 sip iChat
5100 TCP - - socalia Mac OS X camera and scanner sharing
5190 TCP/UDP America Online (AOL) - aol iChat and AOL Instant Messenger, file transfer
5222 TCP XMPP (Jabber) 3920 jabber-client iChat and Jabber messages
5223 TCP XMPP over SSL, Apple Push Notification Service - - MobileMe (Automatic sync notifications) (see note 9), APNs, FaceTime, Game Center
5269 TCP XMPP server-to-server communication 3920 jabber-server iChat Server
5297 TCP - - - iChat (local traffic), Bonjour
5298 TCP/UDP - - - iChat (local traffic), Bonjour
5353 UDP Multicast DNS (MDNS) 3927 mdns Bonjour (mDNSResponder), AirPlay, Home Sharing, Printer Discovery
5354 TCP Multicast DNS Responder - mdnsresponder Back to My Mac
5432 TCP PostgreSQL - postgresql May be enabled manually on Lion Server. Previously enabled by default for ARD 2.0 Database.
5678 UDP SNATMAP server - rrac The SNATMAP service on port 5678 is used to determine the external Internet address of hosts so that connections between iChat users can properly function behind network address translation (NAT). The SNATMAP service simply communicates to clients the Internet address that connected to it. This service runs on an Apple server, but does not send personal information to Apple. When certain iChat AV features are used, this service will be contacted. Blocking this service may cause issues with iChat AV connections with hosts on networks that use NAT.
5897-5898 UDP (Unregistered Use) - - xrdiags
5900 TCP Virtual Network Computing (VNC)
(Unregistered Use)
- vnc-server Apple Remote Desktop 2.0 or later (Observe/Control feature)
Screen Sharing (Mac OS X 10.5 or later)
5988 TCP WBEM HTTP - wbem-http Apple Remote Desktop 2.x (see http://www.dmtf.org/about/faq/wbem)
6970-9999 UDP - - - QuickTime Streaming Server
7070 TCP RTSP (Unregistered Use)
Automatic Router Configuration Protocol (ARCP - Registered Use)
- arcp QuickTime Streaming Server (RTSP)
7070 UDP RTSP alternate - arcp QuickTime Streaming Server
7777 TCP iChat server file transfer proxy (unregistered use) - cbt -
8000-8999 TCP - - irdmi Web service, iTunes Radio streams
8005 TCP Tomcat remote shutdown - - -
8008 TCP iCal service - http-alt Mac OS X Server v10.5 and later
8080 TCP Alternate port for Apache web service - http-alt -
8085-8087 TCP Wiki service - - Mac OS X Server v10.5 and later
8088 TCP Software Update service - radan-http Mac OS X Server v10.4 and later
8089 TCP Web email rules - - Mac OS X Server v10.6 and later
8096 TCP Web Password Reset - - Mac OS X Server v10.6.3 and later
8170 TCP HTTPS (web service/site) - - Podcast Capture/podcast CLI
8171 TCP HTTP (web service/site) - - Podcast Capture/podcast CLI
8175 TCP Pcast Tunnel - - pcastagentd (for control operations, camera and so on)
8443 TCP iCal service (SSL) - pcsync-https Mac OS X Server v10.5 and later
8800 TCP Address Book service - sunwebadmin Mac OS X Server v10.6 and later
8843 TCP Address Book service (SSL) - - Mac OS X Server v10.6 and later
8821, 8826
TCP Stored - - Final Cut Server
8891 TCP ldsd - - Final Cut Server (data transfers)
9006, 8080, 8443 - HTTP and HTTPS ports for Tomcat Standalone and JBOSS (J2EE) - -, http-alt, pcsync-https -
11211 - memcached (unregistered) - - iCal Server
16080 TCP - - - Web service with performance cache
16384-16403 UDP Real-Time Transport Protocol (RTP), Real-Time Control Protocol (RTCP) - connected, - iChat AV (Audio RTP, RTCP; Video RTP, RTCP)
16384-16387 UDP Real-Time Transport Protocol (RTP), Real-Time Control Protocol (RTCP) - connected, - FaceTime, Game Center
16393-16402 UDP Real-Time Transport Protocol (RTP), Real-Time Control Protocol (RTCP) - - FaceTime, Game Center
16403-16472 UDP Real-Time Transport Protocol (RTP), Real-Time Control Protocol (RTCP) - - Game Center
24000-24999 TCP - - med-ltp Web service with performance cache
42000-42999 TCP - - - iTunes Radio streams
49152-65535 TCP Xsan - - Xsan Filesystem Access
50003 - FileMaker server service - - -
50006 - FileMaker helper service - - -

Sunday, March 11, 2012

P19 --Mikrotik router board Password reset

RouterOS password can only be reset by reinstalling the router, or using the reset jumper (or jumper hole) in case the hardware is RouterBOARD. For RouterBOARDS just close the jumper and boot the board until the configuration is cleared. For some RouterBOARDs there is not a jumper, but a jumper hole - just put a metal object into the hole, and boot the board.





For older models

The below image shows the location of the Reset Jumper on older RouterBOARDs like RB133C:


Note: Don't forget to remove the jumper after configuration has been reset, or it will be reset every time you reboot.

P18 --Forwarding a port to an internal IP using Mikrotik

This example will show you how to forward port (tcp 5900) to an internal IP using destination NAT. 69.69.69.69 is the example wan IP, 192.168.1.101 is the desired internal destination.

/ip firewall nat add chain=dstnat dst-address=69.69.69.69 protocol=tcp dst-port=5900 \
    action=dst-nat to-addresses=192.168.1.101 to-ports=5900

P17-- How to Block Websites & Stop Downloading Using Mikrotik Proxy

This example will explain you “How to Block Web Sites” & “How to Stop Downloading”.

First, Configure Proxy.

/ip proxy
set enabled=yes
set src-address=0.0.0.0
set port=8080
set parent-proxy=0.0.0.0
set parent-proxy-port=0
set cache-administrator="webmaster"
set max-cache-size=none
set cache-on-disk=no
set max-client-connections=600
set max-server-connections=600
set max-fresh-time=3d
set always-from-cache=no
set cache-hit-dscp=4
set serialize-connections=no


Now, Make it Transparent

/ip firewall nat
add chain=dstnat protocol=tcp dst-port=80 action=dst-nat to-addresses=<Your LAN IP for the Router>
to-ports=8080


Make sure that your proxy is NOT a Open Proxy

/ip firewall filter
add chain=input in-interface=<Your WAN Port> src-address=0.0.0.0/0\
    protocol=tcp dst-port=8080 action=drop

Now for Blocking Websites

/ip proxy access
add dst-host=www.vansol27.com action=deny

It will block website http://www.vansol27.com, We can always block the same for different networks by giving src-address. It will block for particular source address.

We can also stop downloading files like.mp3, .exe, .dat, .avi,…etc.

/ip proxy access
add path=*.exe action=deny
add path=*.mp3 action=deny
add path=*.zip action=deny
add path=*.rar action=deny.


Try with this also

/ip proxy access
add dst-host=:mail action=deny


This will block all the websites contain word “mail” in url.

Example: It will block www.hotmail.com, mail.yahoo.com, www.rediffmail.com

P16 -- DoS(Denial of Service) attack protection using MikrotiK

Generally there is no perfect solution to protect against DoS attacks. Every service could be overloaded by too much requests. So there are only some methods for minimization impact of attack.

  • Get more powerfull router or server
  • Get more faster uplink
  • Reduce number of firewall rules, queues and other packet handling actions
  • Track attack path and block it closer to source (by upstream provider)  
Types

TCP SYN flood  

More info: SYN flood. 

Diagnose

  • Are there too much connections with syn-sent state present?
/ip firewall connection print
  • Is too much packets per second going through interface?
/interface monitor-traffic ether3
  • Is CPU usage 100%?
/system resource monitor
  • Are there too much suspicious connections?
/tool torch

Protection

  • Limit incoming connections
Address with too much connections can be added to address list for futher blocking.
/ip firewall filter add chain=input protocol=tcp connection-limit=LIMIT,32  \
action=add-src-to-address-list  address-list=blocked-addr address-list-timeout=1d 
where LIMIT is max. number of connection per IP. LIMIT should be 100 or higher as many services use multiple connection (HTTP, Torrent, other P2P programs).
  • Action tarpit
Instead of simply droping attackers packets(action=drop) router can capture and hold connections and with enough powerfull router is can kill the attacker.
/ip firewall filter add chain=input protocol=tcp src-address-list=blocked-addr \
connection-limit=3,32 action=tarpit 
  • SYN filtering
Some advanced filtering can by applied to tcp packet state.
/ip firewall filter add chain=forward protocol=tcp tcp-flags=syn connection-state=new \
action=jump jump-target=SYN-Protect comment="SYN Flood protect" disabled=yes
/ip firewall filter add chain=SYN-Protect protocol=tcp tcp-flags=syn limit=400,5 connection-state=new \
action=accept comment="" disabled=no
/ip firewall filter add chain=SYN-Protect protocol=tcp tcp-flags=syn connection-state=new \
action=drop comment="" disabled=no
"syn limit=400" is a threshold, just enable rule in forward for syn packets to get dropped (for excessive amount of new connection)
  • SYN cookies
More info: SYN cookies
/ip firewall connection tracking set tcp-syncookie=yes

P15 --Mikrotik essentials firewall

Just copy and paste to new terminal

/ ip firewall filter
add chain=forward protocol=udp dst-port=1718-1720 action=drop \
    comment="Drop_ILLIGAL_VOIP" disabled=no
add chain=forward protocol=tcp dst-port=1718-1720 action=drop \
    comment="Drop_ILLIGAL_VOIP" disabled=no
add chain=forward protocol=udp dst-port=5060 action=drop \
    comment="Drop_ILLIGAL_VOIP" disabled=no
add chain=forward protocol=tcp dst-port=5060 action=drop \
    comment="Drop_ILLIGAL_VOIP" disabled=no
add chain=forward protocol=tcp dst-port=11720 action=drop \
    comment="Drop_ILLIGAL_VOIP" disabled=no
add chain=forward protocol=udp dst-port=11720 action=drop \
    comment="Drop_ILLIGAL_VOIP" disabled=no
add chain=input protocol=tcp dst-port=21 src-address-list=ftp_blacklist \
    action=drop comment="drop ftp brute forcers" disabled=no
add chain=output protocol=tcp content="530 Login incorrect" \
    dst-limit=1/1m,9,dst-address/1m action=accept comment="" disabled=no
add chain=output protocol=tcp content="530 Login incorrect" \
    action=add-dst-to-address-list address-list=ftp_blacklist \
    address-list-timeout=3h comment="" disabled=no
add chain=input protocol=tcp dst-port=22 src-address-list=ssh_blacklist \
    action=drop comment="drop ssh brute forcers" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new \
    src-address-list=ssh_stage3 action=add-src-to-address-list \
    address-list=ssh_blacklist address-list-timeout=1w3d comment="" \
    disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new \
    src-address-list=ssh_stage2 action=add-src-to-address-list \
    address-list=ssh_stage3 address-list-timeout=1m comment="" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new \
    src-address-list=ssh_stage1 action=add-src-to-address-list \
    address-list=ssh_stage2 address-list-timeout=1m comment="" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new \
    action=add-src-to-address-list address-list=ssh_stage1 \
    address-list-timeout=1m comment="" disabled=no
add chain=forward protocol=tcp dst-port=22 src-address-list=ssh_blacklist \
    action=drop comment="drop ssh brute downstream" disabled=no
add chain=forward connection-state=established action=accept comment="allow \
    established connections" disabled=no
add chain=forward connection-state=related action=accept comment="allow \
    related connections" disabled=no
add chain=forward connection-state=invalid action=drop comment="drop invalid \
    connections" disabled=no
add chain=virus protocol=tcp dst-port=135-139 action=drop comment="Drop \
    Blaster Worm" disabled=no
add chain=virus protocol=udp dst-port=135-139 action=drop comment="Drop \
    Messenger Worm" disabled=no
add chain=virus protocol=tcp dst-port=445 action=drop comment="Drop Blaster \
    Worm" disabled=no
add chain=virus protocol=udp dst-port=445 action=drop comment="Drop Blaster \
    Worm" disabled=no
add chain=virus protocol=tcp dst-port=593 action=drop comment="" disabled=no
add chain=virus protocol=tcp dst-port=1024-1030 action=drop comment="" \
    disabled=no
add chain=virus protocol=tcp dst-port=1080 action=drop comment="Drop MyDoom" \
    disabled=no
add chain=virus protocol=tcp dst-port=1214 action=drop comment="" disabled=no
add chain=virus protocol=tcp dst-port=1363 action=drop comment="ndm requester" \
    disabled=no
add chain=virus protocol=tcp dst-port=1364 action=drop comment="ndm server" \
    disabled=no
add chain=virus protocol=tcp dst-port=1368 action=drop comment="screen cast" \
    disabled=no
add chain=virus protocol=tcp dst-port=1373 action=drop comment="hromgrafx" \
    disabled=no
add chain=virus protocol=tcp dst-port=1377 action=drop comment="cichlid" \
    disabled=no
add chain=virus protocol=tcp dst-port=1433-1434 action=drop comment="Worm" \
    disabled=no
add chain=virus protocol=tcp dst-port=2745 action=drop comment="Bagle Virus" \
    disabled=no
add chain=virus protocol=tcp dst-port=2283 action=drop comment="Drop Dumaru.Y" \
    disabled=no
add chain=virus protocol=tcp dst-port=2535 action=drop comment="Drop Beagle" \
    disabled=no
add chain=virus protocol=tcp dst-port=2745 action=drop comment="Drop \
    Beagle.C-K" disabled=no
add chain=virus protocol=tcp dst-port=3127-3128 action=drop comment="Drop \
    MyDoom" disabled=no
add chain=virus protocol=tcp dst-port=3410 action=drop comment="Drop Backdoor \
    OptixPro" disabled=no
add chain=virus protocol=tcp dst-port=4444 action=drop comment="Worm" \
    disabled=no
add chain=virus protocol=udp dst-port=4444 action=drop comment="Worm" \
    disabled=no
add chain=virus protocol=tcp dst-port=5554 action=drop comment="Drop Sasser" \
    disabled=no
add chain=virus protocol=tcp dst-port=8866 action=drop comment="Drop Beagle.B" \
    disabled=no
add chain=virus protocol=tcp dst-port=9898 action=drop comment="Drop \
    Dabber.A-B" disabled=no
add chain=virus protocol=tcp dst-port=10000 action=drop comment="Drop \
    Dumaru.Y" disabled=no
add chain=virus protocol=tcp dst-port=10080 action=drop comment="Drop \
    MyDoom.B" disabled=no
add chain=virus protocol=tcp dst-port=12345 action=drop comment="Drop NetBus" \
    disabled=no
add chain=virus protocol=tcp dst-port=17300 action=drop comment="Drop Kuang2" \
    disabled=no
add chain=virus protocol=tcp dst-port=27374 action=drop comment="Drop \
    SubSeven" disabled=no
add chain=virus protocol=tcp dst-port=65506 action=drop comment="Drop PhatBot, \
    Agobot, Gaobot" disabled=no
add chain=forward action=jump jump-target=virus comment="jump to the virus \
    chain" disabled=no
add chain=forward protocol=tcp dst-port=25 action=drop comment="" disabled=no
add chain=forward protocol=tcp src-port=25 action=drop comment="" disabled=no
add chain=forward protocol=tcp tcp-flags=syn connection-state=new action=jump \
    jump-target=SYN-Protect comment="SYN Flood protect" disabled=no
add chain=SYN-Protect protocol=tcp tcp-flags=syn limit=400,5 \
    connection-state=new action=accept comment="" disabled=no
add chain=SYN-Protect protocol=tcp tcp-flags=syn connection-state=new \
    action=drop comment="" disabled=no

P14 -- Mikrotik EOIP Tunnel

Let us assume we want to bridge two networks: 'Office LAN' and 'Remote LAN'. By using EoIP setup can be made so that Office and Remote LANs are in the same Layer2 broadcast domain.

Diagram:


At first we create EoIP tunnel on our gateway ...
Code: [Select]
[admin@Our_GW] interface eoip> add name="eoip-remote" tunnel-id=0 \
\... remote-address=10.0.0.2
[admin@Our_GW] interface eoip> enable eoip-remote
[admin@Our_GW] interface eoip> print
Flags: X - disabled, R - running
  0    name=eoip-remote mtu=1500 arp=enabled remote-address=10.0.0.2 tunnel-id=0
[admin@Our_GW] interface eoip>
 
and on Remote router

Code: [Select]
[admin@Remote] interface eoip> add name="eoip" tunnel-id=0 \
\... remote-address=10.0.0.1
[admin@Remote] interface eoip> enable eoip-main
[admin@Remote] interface eoip> print
Flags: X - disabled, R - running
  0   name=eoip mtu=1500 arp=enabled remote-address=10.0.0.1 tunnel-id=0

[admin@Remote] interface eoip>

Next step is to bridge local interfaces with EoIP tunnel On Our GW ...

Code: [Select]
[admin@Our_GW] interface bridge> add 
[admin@Our_GW] interface bridge> print
Flags: X - disabled, R - running
 0  R name="bridge1" mtu=1500 arp=enabled mac-address=00:00:00:00:00:00 
      protocol-mode=none priority=0x8000 auto-mac=yes 
      admin-mac=00:00:00:00:00:00 max-message-age=20s forward-delay=15s 
      transmit-hold-count=6 ageing-time=5m 
[admin@Our_GW] interface bridge> port add bridge=bridge1 interface=eoip-remote
[admin@Our_GW] interface bridge> port add bridge=bridge1 interface=office-eth
[admin@Our_GW] interface bridge> port print
Flags: X - disabled, I - inactive, D - dynamic
 #    INTERFACE      BRIDGE  PRIORITY PATH-COST
 0    eoip-remote    bridge1 128      10
 1    office-eth     bridge1 128      10
[admin@Our_GW] interface bridge>

... and Remote router:

Code: [Select]
[admin@Remote] interface bridge> add 
[admin@Remote] interface bridge> print
Flags: X - disabled, R - running
 0  R name="bridge1" mtu=1500 arp=enabled mac-address=00:00:00:00:00:00 
      protocol-mode=none priority=0x8000 auto-mac=yes 
      admin-mac=00:00:00:00:00:00 max-message-age=20s forward-delay=15s 
      transmit-hold-count=6 ageing-time=5m 
[admin@Remote] interface bridge> port add bridge=bridge1 interface=ether
[admin@Remote] interface bridge> port add bridge=bridge1 interface=eoip-main
[admin@Remote] interface bridge> port print
Flags: X - disabled, I - inactive, D - dynamic
 #    INTERFACE      BRIDGE  PRIORITY PATH-COST
 0    ether          bridge1 128      10
 1    eoip-main      bridge1 128      10     
[admin@Remote] interface bridge>

Now both sites are in the same Layer2 broadcast domain. You can set up IP addresses from the same network on both sites.

P13 -- Bridge mode Bandwidth Shaping in Mikrotik

Introduction

This example shows how to configure a transparent traffic shaper. The transparent traffic shaper is essentially a bridge that is able to differentiate and prioritize traffic that passes through it.


Consider the following network layout:


Configuration code:

Code: [Select]
/ interface bridge 
add name="bridge1"
/ interface bridge port 
add interface=ether2 bridge=bridge1 
add interface=ether3 bridge=bridge1 
/ interface bridge settings
set use-ip-firewall=yes

/ ip firewall mangle 
add chain=prerouting protocol=tcp dst-port=80 action=mark-connection \
    new-connection-mark=http_conn passthrough=yes
add chain=prerouting connection-mark=http_conn action=mark-packet \
    new-packet-mark=http passthrough=no
add chain=prerouting p2p=all-p2p action=mark-connection \
    new-connection-mark=p2p_conn passthrough=yes
add chain=prerouting connection-mark=p2p_conn action=mark-packet \
    new-packet-mark=p2p passthrough=no
add chain=prerouting action=mark-connection new-connection-mark=other_conn \
    passthrough=yes
add chain=prerouting connection-mark=other_conn action=mark-packet \
    new-packet-mark=other passthrough=no

/ queue simple 
add name="main" target-addresses=10.0.0.12/32 max-limit=256000/512000
add name="http" parent=main packet-marks=http max-limit=240000/500000 priority=1
add name="p2p" parent=main packet-marks=p2p max-limit=64000/64000 priority=8
add name="other" parent=main packet-marks=other max-limit=128000/128000 priority=4