15panduan Praktek Mikrotikos

Download as pdf or txt
Download as pdf or txt
You are on page 1of 240

BAB I Software Package Management

General Information
Summary
The MikroTik RouterOS is distributed in the form of software packages. The basic functionality of the router and the operating system itself is provided by the system software package. Other packages contain additional software features as well as support to various network interface cards.

Specifications
License required: Level1 Submenu level: /system package Standards and Technologies: FTP Hardware usage: Not significant

Related Documents
Basic Setup Guide Driver Management Software Version Management License Management Installing RouterOS with NetInstall Installing RouterOS with CD -Install Installing RouterOS with Floppies

Description
Features The modular software package system of MikroTik RouterOS has the following features: Ability to extend RouterOS functions by installing additional software packages Optimal usage of the storage space by employing modular/compressed system Unused software packages can be uninstalled The RouterOS functions and the system itself can be easily upgraded Multiple packages can be installed at once The package dependency is checked before installing a software package. The package will not be installed, if the required software package is missing The version of the feature package should be the same as that of the system package The packages can be uploaded on the router using ftp and installed only when the router is going for shutdown during the reboot process If the software package file can be uploaded to the router, then the disk space is sufficient for the installation of the package The system can be downgraded to an older version by uploading the needed packages to router via FTP binary mode. After that, execute command /system package downgrade

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

Installation (Upgrade)
Description
Installation or upgrade of the MikroTik RouterOS software packages can be done by uploading the newer version of the software package to the router and re booting it. The software package files are compressed binary files, which can be downloaded from the MikroTik's web page download section. The full name of the software package consists of a descriptive name, version number and extension .npk, exempli gratia system-2.9.11.npk, routerboard-2.9.11.npk. Package routeros-x86 contains all necessary packages for RouterOS installation and upgrading for RouterBOARD 200 and PC. Package routeros-rb500 contains all necessary packages for RouterOS installation and upgr ading for RouterBOARD 500. These packages are preferred installation and upgrading method. You should check the available hard disk space prior to downloading the package file by issuing /system resource print command. If there is not enough free disk spac e for storing the upgrade packages, it can be freed up by uninstalling some software packages, which provide functionality not required for your needs. If you have a sufficient amount of free space for storing the upgrade packages, connect to the router us ing ftp. Use user name and password of a user with full access privileges. Step-by-Step Connect to the router using ftp client Select the BINARY mode file transfer Upload the software package files to the router Check the information about the uploaded software packages using the /file print command Reboot the router by issuing the /system reboot command or by pressing Ctrl+Alt+Del keys at the router's console After reboot, verify that the packages were installed correctly by issuing /system package print command

Notes
The packages uploaded to the router should retain the original name and also be in lowercase. The installation/upgrade process is shown on the console screen (monitor) attached to the router. The Free Demo License do not allow softw are upgrades using ftp. You should do a complete reinstall from floppies, or purchase the license. Before upgrading the router, please check the current version of the system package and the additional software packages. The versions of additional package s should match the version number of the system software package. The version of the MikroTik RouterOS system software (and the build number) are shown before the console login prompt. Information about the version numbers and build time of the installed M ikroTik RouterOS software packages can be obtained using the /system package print command. Do not use routeros-x86 and routeros-rb500 packges to upgrade from version 2.8 or older. To upgrade use regular packages. Packages wireless-test, rstp-bridge-test, routing-test are included in routeros-x86 and routeros-rb500 packages, but disabled by default.

Uninstallation
Command name: /system package uninstall

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

Description
Usually, you do not need to uninstall software packages. However, if you have installed a wrong package, or you need additional free space to install a new one, you have to uninstall some unused packages.

Notes
If a package is marked for uninstallation, but it is required for another (dependent) package, then the marked package cannot be uninstalled. You should uninstall the dependent package too. For the list of package dependencies see the 'Software Package List; section below. The system package will not be uninstalled even if marked for uninstallation.

Example
Suppose we need to uninstall security package from the router: [admin@MikroTik] system package> print # NAME VERSION 0 system 2.9.11 1 routing 2.9.11 2 dhcp 2.9.11 3 hotspot 2.9.11 4 wireless 2.9.11 5 web-proxy 2.9.11 6 advanced-tools 2.9.11 7 security 2.9.11 8 ppp 2.9.11 9 routerboard 2.9.11 [admin@MikroTik] system package> uninstall security [admin@MikroTik] > .. reboot SCHEDULED

Downgrading
Command name: /system package downgrade

Description
Downgrade option allows you to downgrade the software via FTP without losing your license key or reinstalling the router. Step-by-Step Connect to the router using ftp client Select the BINARY mode file transfer Upload the software package files to the router Check the information about the uploaded software packages using the /file print command Execute command /system package downgrade . The router will downgrade and reboot. After reboot, verify that the packages were installed correctly by issuing /system package print command

Command Description
downgrade - this command asks your confirmation and reboots the router. After reboot the software is downgraded (if all needed packages were uploaded to the router)

Example
To downgrade the RouterOS (assuming that all needed packages are already uploaded): Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 3

[admin@MikroTik] system package> downgrade Router will be rebooted. Continue? [y/N]: y system will reboot shortly

Disabling and Enabling


Specifications
Command name: /system package disable, /system package enable

Description
You can disable packages making them invisible for the system and later enable them, bringing the system back to the previous state. It is useful if you don't want to uninstall a package, but just turn off its functionality.

Notes
If a package is marked for disabling, but it is required for another (dependent) package, then the marked package cannot be disabled. You should disable or uninstall the dependent package too. For the list of package dependencies see the 'Software Package List; section below. If any of the test packages will be enabled (for example wireless -test and routing-test packages, that are included in routeros-x86.npk and routeros-rb500.npk) system automaticly will disable regular packages that conflict with them.

Example
Suppose we need to test wireless-test package features: [admin@MikroTik] system package> print [admin@MikroTik] > system package pr Flags: X - disabled # NAME VERSION 0 system 2.9.11 1 routerboard 2.9.11 2 X wireless-test 2.9.11 3 ntp 2.9.11 4 routeros-rb500 2.9.11 5 X rstp-bridge-test 2.9.11 6 wireless 2.9.11 7 webproxy-test 2.9.11 8 routing 2.9.11 9 X routing-test 2.9.11 10 ppp 2.9.11 11 dhcp 2.9.11 12 hotspot 2.9.11 13 security 2.9.11 14 advanced-tools 2.9.11 [admin@MikroTik] system package> enable wireless -test [admin@MikroTik] system package> .. reboot

SCHEDULED

Unscheduling
Command name: /system package unschedule Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 4

Description
Unschedule option allows to cancel pending uninstall, disable or enable actions for listed packages.

Notes
packages marked for uninstallation, disabling or enabling o n reboot in column "schedule" will have a note, warning about changes.

Example
Suppose we need to cancel wireless-test package uninstallation action scheduled on reboot: [admin@MikroTik] system package> print [admin@MikroTik] > system package pr Flags: X - disabled # NAME VERSION SCHEDULED 0 system 2.9.11 1 routerboard 2.9.11 2 wireless-test 2.9.11 scheduled for uninstall 3 ntp 2.9.11 4 routeros-rb500 2.9.11 5 X rstp-bridge-test 2.9.11 6 wireless 2.9.11 7 webproxy-test 2.9.11 8 routing 2.9.11 9 X routing-test 2.9.11 10 ppp 2.9.11 11 dhcp 2.9.11 12 hotspot 2.9.11 13 security 2.9.11 14 advanced-tools 2.9.11 [admin@MikroTik] system package> unschedule wireless -test [admin@MikroTik] system package>

System Upgrade
Submenu level: /system upgrade

Description
This submenu gives you the ability to download RouterOS software packages from a remote RouterOS router. Step-by-Step Upload desired RouterOS packages to a router (not the one that you will upgrade ) Add this router's IP address, user name and password to /system upgrade upgrade-package-source Refresh available software package list /system upgrade refresh See available packages, using /system upgrade print command Download selected or all packages from the remote router, using the download or download-all command

Property Description
download - download packages from list by specifying their numbers download-all - download all packages that are needed for the upgrade (packages which are availab le in '/system package print' list) name (read-only: name) - package name Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 5 Referensi : Download :www.mikrotik.com

refresh - updates currently available package list source (read-only: IP address) - source IP address of the router from which the package list entry is retrieved status (read-only: available | scheduled | downloading | downloaded | installed) - package status version (read-only: text) - version of the package

Example
See the available packages: [admin@MikroTik] system upgrade> print # SOURCE NAME VERSION STATUS COMPLETED 0 192.168.25.8 advanced -tools 2.9.11 available 1 192.168.25.8 dhcp 2.9.11 available 2 192.168.25.8 hotspot 2.9.11 available 3 192.168.25.8 isdn 2.9.11 ava ilable 4 192.168.25.8 ntp 2.9.11 available 5 192.168.25.8 ppp 2.9.11 available 6 192.168.25.8 routerboard 2.9.11 available 7 192.168.25.8 routing 2.9.11 available 8 192.168.25.8 security 2.9.11 available 9 192.168.25.8 synchronous 2.9.11 available 10 192.168.25.8 system 2.9.11 available 11 192.168.25.8 telephony 2.9.11 available 12 192.168.25.8 ups 2.9.11 available 13 192.168.25.8 web -proxy 2.9.11 available 14 192.168.25.8 wireless 2.9.11 available [admin@MikroTik] system upgrade> To upgrade chosen packages: [admin@MikroTik] system upgrade> download 0,1,2,5,6 ,7,8,9,10,13,14 [admin@MikroTik] system upgrade> print # SOURCE NAME VERSION STATUS COMPLETED 0 192.168.25.8 advanced -tools 2.9.11 downloaded 1 192.168.25.8 dhcp 2.9.11 downloading 16 % 2 192.168.25.8 hotspot 2.9.11 scheduled 3 192.168.25.8 isdn 2.9.11 available 4 192.168.25.8 ntp 2.9.11 available 5 192.168.25.8 ppp 2.9.11 scheduled 6 192.168.25.8 route rboard 2.9.11 scheduled 7 192.168.25.8 routing 2.9.11 scheduled 8 192.168.25.8 security 2.9.11 scheduled 9 192.168.25.8 synchronous 2.9.11 scheduled 10 192.168.25.8 system 2.9.11 scheduled 11 192.168.25.8 telephony 2.9.11 available 12 192.168.25.8 ups 2.9.11 available 13 192.168.25.8 web -proxy 2.9.11 scheduled 14 192.168.25.8 wireless 2.9.11 scheduled [admin@MikroTik] system upgrade>

Adding Package Source


Submenu level: /system upgrade upgrade-package-source

Description
In this submenu you can add remote routers from which to download the RouterOS software packages.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

Property Description
address (IP address) - source IP address of the router from which the package list entry will be retrieved password (text) - password of the remote router user (text) - username of the remote router

Notes
After specifying a remote router in /system upgrade upgrade-package-source, you can type /system upgrade refresh to refresh the package list and /system upgrade print to see all available packages.

Example
To add a router with IP address 192.168.25.8, username admin and no password: /system upgrade upgrade -package-source add address=192.168.25.8 user=admin [admin@MikroTik] system upgrade upgrade -package-source> print # ADDRESS USER 0 192.168.25.8 admin [admin@MikroTik] system upgrade upgrade -package-source>

Software Package List


Description
System Software Package The system software package provides the basic functionality of the MikroTik RouterOS, namely: IP address management, ARP, static IP routing, policy routing, firewall (packet filtering, content filtering, masquerading, and static NAT), traffic sh aping (queues), IP traffic accounting, MikroTik Neighbour Discovery, IP Packet Packing, DNS client settings, IP service (servers) Ethernet interface support IP over IP tunnel interface support Ethernet over IP tunnel interface support driver management for Ethernet ISA cards serial port management local user management export and import of router configuration scripts backup and restore of the router's configuration undo and redo of configuration changes network diagnostics tools (ping, traceroute , bandwidth tester, traffic monitor) bridge support system resource management package management telnet client and server local and remote logging facility winbox server as well as winbox executable with some plugins After installing the MikroTik R outerOS, a free license should be obtained from MikroTik to enable the basic system functionality. Additional Software Feature Packages The table below shows additional software feature packages, extended functionality provided by them, the required prerequisites and additional licenses, if any. Prere Name Contents quisit Additional License es Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 7

advanc ed-tools arlan dhcp gps hotspot isdn lcd ntp ppp radiola n routerb oard routing security

email client, pingers, netwatch and other utilities support for DSSS 2.4GHz 2mbps Aironet ISA cards DHCP server and client support support for GPS devices HotSpot gateway support for ISDN devices support for informational LCD display network time protocol support support for PPP, PPTP, L2TP, PPPoE and ISDN PPP Provides support for 5.8GHz RadioLAN cards support for RouterBoard-specific functions and utilities

none none none none none ppp none none none none none none none none none none none none none

none 2.4GHz/5GHz Wireless Client none none any additional license none none none none 2.4GHz/5GHz Wireless Client none none none Synchronous none none none none 2.4GHz/5GHz Wireless Client / 2.4GHz/5GHz Wireless Server (optional)

support for RIP, OSPF and BGP4 support for IPSEC, SSH and secure WinBox connections support for Frame Relay and Moxa C101, Moxa C502, synchro Farsync, Cyclades PC300, LMC SBE and XPeed nous synchronous cards telepho IP telephony support (H.323) ny thinrout forces PCI-to-CardBus Bridge to use IRQ 11 as in erThinRouters pcipc ups APC Smart Mode UPS support webHTTP Web proxy support proxy wireles s Provides support for Cisco Aironet cards, PrismII and Atheros wireless stations and APs

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

BAB II MikroTik Router Basic Setup Guide


General Information
Summary
MikroTik RouterOS is independent Linux -based Operating System for IA -32 routers and thinrouters. It does not require any additional components and has no software prerequirements. It is designed with easy -to-use yet powerful interface allowing network adm inistrators to deploy network structures and functions, that would require long education elsewhere simply by following the Reference Manual (and even without it).

Related Documents
Software Package Management Device Driver List License Management Ping Bandwidth Control ../ip/firewall.php WinBox Installing RouterOS with NetInstall Installing RouterOS with CD -Install Installing RouterOS with Fl oppies

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

Description
MikroTik RouterOS turns a standard PC computer into a powerful network router. Just add standard network PC interfaces to expand the router capabilities. Remote control with easy real -time Windows application (WinBox) Advanced Quality of Service control with burst support Stateful firewall with P2P protocol filtering, tunnels and IPsec STP bridging with filtering capabilities WDS and Virtual AP features HotSpot for Plug-and-Play access RIP, OSPF, BGP routing protocols Gigabit Ethernet ready V.35, X.21, T1/E1 synchronous support async PPP with RADUIS AAA IP Telephony remote winbox GUI admin telnet/ssh/serial console admin real-time configuration and monitoring and much more (please see the Specifications Sheet) The Guide describes the basic steps of installing and configuring a dedicated PC router running MikroTik RouterOS.

Setting up MikroTik RouterOS


Description
Downloading and Installing the MikroTik RouterOS

The download and installation process of the MikroTik RouterOS is described in the following diagram: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

10

1.Download the basic installation archieve file. Depending on the desired media to be used for installing th e MikroTik RouterOS please chose one of the following archive types for downloading: ISO image - of the installation CD, if you have a CD writer for creating CDs. The ISO image is in the MTcdimage_v2-9-x_dd-mmm-yyyy_(build_z).zip archive file containing a bootable CD image. The CD will be used for booting up the dedicated PC and installing the MikroTik RouterOS on its hard-drive or flash-drive. Netinstall - if you want to install RouterOS over a LAN with one floppy boot disk, or alternatively using PXE or EtherBoot option supported by some network interface cards, that allows truly networked installation. Netinstall program works on Windows 95/98/NT4/2K/XP. MikroTik Disk Maker - if you want to create 3.5" installation floppies. The Disk Maker is a self-extracting archive DiskMaker_v2 -9-x_dd-mmm-yyyy_(build_z).exe file, which should be run on your Windows 95/98/NT4/2K/XP workstation to create the installation floppies. The installation floppies will be used for booting up the dedicated PC and installing th e MikroTik RouterOS on its hard-drive or flash-drive. 2. Create the installation media. Use the appropriate installation archive to create the Installation CD or floppies. For the CD, write the ISO image onto a blank CD. For the floppies, run the Disk Mak er on your Windows workstation to create the installation floppies. Follow the instructions and insert the floppies in your FDD as requested, label them as Disk 1,2,3, etc. 1. Install the MikroTik RouterOS software. Your dedicated PC router hardware should have: CPU and motherboard - advanced 4th generation (core frequency 100MHz or more), 5th generation (Intel Pentium, Cyrix 6X86, AMD K5 or comparable) or newer uniprocessor Intel IA-32 (i386) compatible (multiple processors are not supported) RAM - minimum 64 MiB, maximum 1 GiB; 64 MiB or more recommended Hard Drive/Flash - standard ATA interface controller and drive (SCSI and USB controllers and drives are not supported; RAID controllers that require additional drivers are not supported) with minimum of 64 Mb space Hardware needed for installation time only Depending on installation method chosen the router must have the following hardware: Floppy-based installation - standard AT floppy controller and 3.5'' disk drive connected as the first floppy disk drive (A); AT, PS/2 or USB keyboard; VGA -compatible video controller card and monitor CD-based installation - standard ATA/ATAPI interface controller and CD drive supporting "El Torito" bootable CDs (you might need also to check if the router's BIOS suppor ts booting from this type of media; if El Torito is not supported by the BIOS, you can still boot up from the CD using Smart Boot Manager Floppy ); AT, PS/2 or USB keyboard; VGA -compatible video controller card and monitor Floppy-based network installation - standard AT floppy controller and 3.5'' disk drive connected as the first floppy disk drive (A); PCI Ethernet network interface card supported by MikroTik RouterOS (see the Device Driver List for the list) Full network-based installation - PCI Ethernet network interface card supported by MikroTik RouterOS (see the Device Driver List for the list) with PXE or EtherBoot extension booting ROM (you might need also to check if the router's BIOS supports booting from network) Note that if you use Netinstall, you can license the software during the installation procedure (the next point of this section describes how to do it). Boot up your dedicated PC router from the Installation Media you created and follow the instructions on the console screen while the HD D is reformatted and MikroTik RouterOS installed on it. After successful installation please remove the installation media from your CD or floppy disk drive and hit 'Enter' to reboot the router. 2. License the software.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

11

When booted, the software allows you t o use all its features for 24 hours (note that you can pause the countdown by shutting down the router). If the license key will not be entered during this period of time, the router will become unusable, and will need a complete reinstallation. RouterOS licensing scheme is based on software IDs. To license the software, you must know the software ID. It is shown during installation procedures, and also you can get it from system console or Winbox. To get the software ID from system console, type: /system license print (note that you must first log in the router; by default there is user admin with no password (just press [Enter] key when prompted for password)). See sections below on basic configuration of your router Once you have the ID, you can obtain a license: You should have an account on our account server. If you do not have an account at www.mikrotik.com, just press the 'New' button on the upper right -hand corner of the MikroTik's web page to create your account Choose the appropriate licence level that meets your needs. Please see the License Manual or the Software price list. Note that there is a free license with res tricted features (no time limitation) There are different methods how to get a license from the account server: 1. Enter the software ID in the account server, and get the license key by e -mail. You can upload the file received on the router's FTP server, or drag-and-drop it into opened Winbox window 2. You can open the file with a text editor, and copy the contents. Then paste the text into system console (in any menu - you just should be logged in), or into System >License window of Winbox 3. If the router has Internet connection, you can obtain the license directly from within it. The commands are described in the License Manual. Note that you must have Allow to use my account in netins tall option enabled for your account. You can set it by following change user information link on the main screen of the account server.

Notes
The hard disk will be entirely reformatted during the installation and all data on it will be lost! You can move the hard drive with MikroTik RouterOS installed to a new hardware without loosing a license, but you cannot move the RouterOS to a different hard drive without purchasing an another license (except hardware failure situations). For additional informati on write to [email protected]. Note! Do not use MS-DOS format command or other disk format utilities to reinstall your MikroTik router! This will cause the Software -ID to change, so you will need t o buy another license in order to get MikroTik RouterOS running.

Logging into the MikroTik Router


Description
Normally you connect to the router by IP addresses with any telnet or SSH client software (a simple text -mode telnet client is usually called te lnet and is distributed together with almost any OS). You can also use graphical configuration tool for Windows (also can be run in Linux using Wine) called Winbox. To get Winbox, connect to the router's IP address with a web browser, and follow the link t o download winbox.exe from the router. MAC-telnet is used to connect to a router when there is no other way to connect to it remotely if the router has no IP address or in case of misconfigured firewall. MAC -telnet can only be used from the same broadcast domain (so there should be no routers in between) as any of the router's enabled interfaces (you can not connect to a disabled interface). MAC -telnet program is a part of the Neighbor Viewer. Download it from www.mikrotik.com, unpack both files contained in the archive to the same directory, and run NeighborViewer.exe. A list of MikroTik routers working in the same broadcast domain will be showed double Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 12

click the one you need to connect to. Note that Winbox is also able to connect to routers by their MAC addresses, and has the discovery tool built -in. You can also connect to the router using a standard DB9 serial null -modem cable from any PC. Default settings of the router's serial port are 9600 bits/s (for RouterBOARD 500 series - 115200 bits/s), 8 data bits, 1 stop bit, no parity, hardware (RTS/CTS) flow control. Use terminal emulation program (like HyperTerminal or SecureCRT in Windows, or minicom in UNIX/Linux) to connect to the router. The router will beep twice when booted up, and you should see the l ogin prompt shortly before that (check cabling and serial port settings if you do not see anything in the terminal window). When logging into the router via terminal console, you will be pre sented with the MikroTik RouterOS login prompt. Use 'admin' and no password (hit [Enter]) for logging in the router for the first time, for example: MikroTik v2.9 Login: admin Password: The password can be changed with the /password command. [admin@MikroTik] > password old password: new password: ************ retype new password: ************ [admin@MikroTik] >

Adding Software Packages


Description
The basic installation comes only with the system package. This includes basic IP routing and router administration. To have additional features such as IP Telephony, OSPF, wireless and so on, you will need to download additional software packages. The additional software packages should have the same version as the system package. If not, the package won't be installed. Please consult the MikroTik RouterOS Software Package Installation and Upgrading Manual for more detailed information about installing additional software packages. To upgrade the router packages, simply upload the packages to the router via ftp, using the binary transfer mode. After you have uploaded the packages, reboot the router, and the features that are provided by those packages will be available (regarding your license type, of cour se).

Navigating The Terminal Console


Description
Welcome Screen and Command Prompt After logging into the router you will be presented with the MikroTik RouterOS Welcome Screen and command prompt, for example: MMM MMM MMMM MMMM MMM MMMM MMM MMM MM MMM MMM MMM MMM MMM KKK KKK KKK KKK KKKKK KKK KKK KKK KKK TTTTTTTTTTT TTTTT TTTTTT OOOOOO TTT OOO OOO TTT OOO OOO TTT OOOOOO TTT KKK KKK KKK KKK KKKKK KKK KKK KKK KKK

III III III III

RRRRRR RRR RRR RRRRRR RRR RRR

III III III III

MikroTik RouterOS 2.9 (c) 1999 -2004

http://www.mikrotik.com/

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

13

Terminal xterm detected, using multiline input mode [admin@MikroTik] > The command prompt shows the identity name of the router and the current menu level, for example: [admin@MikroTik] > [admin@MikroTik] interface> [admin@MikroTik] ip address> Commands The list of available commands at any menu level can be obtained by entering the question mark '?', for example: [admin@MikroTik] > log/ -- System logs quit -- Quit console radius/ -- Radius client settings certificate/ -- Certificate management special-login/ -- Special login users redo -- Redo previously undone action driver/ -- Driver management ping -- Send ICMP Echo packets setup -- Do basic setup of system interface/ -- Interface configuration password -- Change password undo -- Undo previous action port/ -- Serial ports import -- Run exported configuration script snmp/ -- SNMP settings user/ -- User management file/ -- Local router file storage. system/ -- System information and utilities queue/ -- Bandwidth management ip/ -- IP options tool/ -- Diagnostics tools ppp/ -- Point to Point Protocol routing/ -- Various routing protocol settings export -[admin@MikroTik] > [admin@MikroTik] ip>

.. -- go up to root service/ -- IP services socks/ -- SOCKS version 4 proxy arp/ -- ARP entries management upnp/ -- Universal Plug and Play dns/ -- DNS settings address/ -- Address management accounting/ -- Traffic accounting the-proxy/ -vrrp/ -- Virtual Router Redundancy Protocol pool/ -- IP address pools packing/ -- Packet packing settings neighbor/ -- Neighbors route/ -- Route management firewall/ -- Firewall management dhcp-client/ -- DHCP client settings dhcp-relay/ -- DHCP relay settings Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 14

dhcp-server/ -- DHCP server settings hotspot/ -- HotSpot management ipsec/ -- IP security web-proxy/ -- HTTP proxy export -[admin@MikroTik] ip> The list of available commands and menus has short descriptions next to the items. Y ou can move to the desired menu level by typing its name and hitting the [Enter] key, for example: [admin@MikroTik] > | Base level menu [admin@MikroTik] > driver | Enter 'driver' to move to the driver | level menu [admin@MikroTik] driver> / | Enter '/' to move to the base level menu | from any level [admin@MikroTik] > interface | Enter 'interface' to move to the | i nterface level menu [admin@MikroTik] interface> /ip | Enter '/ip' to move to the IP level menu | from any level [admin@MikroTik] ip> | A command or an argument does not need to be completed, if it is not ambiguous. For example, instead of typing interface you can type just in or int. To complete a command use the [Tab] key. Note that the completion is optional, and you can just use short command and parameter names The commands may be invoked from the menu level, where they are located, by typing its name. If the command is in a different menu level than the current one, then the command should be invoked using its full (absolute) or relative path, for example: [admin@MikroTik] ip route> print | Prints the routing table [admin@MikroTik] ip route> .. address print | Prints the IP address table [admin@MikroTik] ip route> /ip address print | Prints the IP address table The commands may have arguments. The arguments have their names and val ues. Some commands, may have a required argument that has no name. Summary on executing the commands and navigating the menus Command Action command [Enter] Executes the command [?] Shows the list of all available commands command [?] Displays help on the command and the list of arguments command Displays help on the command's argument argument [?] Completes the command/word. If the input is ambiguous, a second [Tab] gives possible [Tab] options / Moves up to the base level /command Executes the base level command .. Moves up one level "" Specifies an empty string "word1 word2" Specifies a string of 2 words that contain a space You can abbreviate names of levels, commands and arguments. For the IP address configuration, instead of using the address and netmask arguments, in most cases you can specify the address together with the number of true bits in the network mask, i.e., there is no need to specify the netmask separately. Thus, the following two entries would be equivalent: /ip address add ad dress 10.0.0.1/24 interface ether1 /ip address add address 10.0.0.1 netmask 255.255.255.0 interface ether1

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

15

Notes
You must specify the size of the network mask in the address argument, even if it is the 32 -bit subnet, i.e., use 10.0.0.1/32 for address=10.0.0.1 netmask=255.255.255.255

Basic Configuration Tasks


Description
Interface Management Before configuring the IP addresses and routes please check the /interface menu to see the list of available interfaces. If you have Plug-and-Play cards installed in the router, it is most likely that the device drivers have been loaded for them automatically, and the relevant interfaces appear on the /interface print list, for example: [admin@MikroTik] interface> print Flags: X - disabled, D - dynamic, R - running # NAME TYPE RX -RATE TX-RATE MTU 0 R ether1 ether 0 0 1500 1 R ether2 ether 0 0 1500 2 X wavelan1 wavelan 0 0 1500 3 X prism1 wlan 0 0 1500 [admin@MikroTik] interface> The interfaces need to be enabled, if you want to use them for communications. Use the /interface enable name command to enable the interface with a given name or number, for example: [admin@MikroTik] interface> print Flags: X - disabled, D - dynamic, R - running # NAME TYPE RX -RATE TX-RATE MTU 0 X ether1 ether 0 0 1500 1 X ether2 ether 0 0 1500 [admin@MikroTik] interface> enable 0 [admin@MikroTik] interface> enable ether2 [admin@MikroTik] interf ace> print Flags: X - disabled, D - dynamic, R - running # NAME TYPE RX -RATE TX-RATE MTU 0 R ether1 ether 0 0 1500 1 R ether2 ether 0 0 1500 [admin@MikroTik] interface> The interface name can be changed to a more descriptive one by using /interface set command: [admin@MikroTik] interface> set 0 name=Local; set 1 name=Public [admin@MikroTik] interface> print Flags: X - disabled, D - dynamic, R - running # NAME TYPE RX -RATE TX-RATE MTU 0 R Local ether 0 0 1500 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 16

1 R Public 1500 [admin@MikroTik] interface>

ether

Notes
The device drivers for NE2000 compatible ISA cards need to be loaded using the add command under the /drivers menu. For example, to load the driver for a card with IO address 0x280 and IRQ 5, it is enough to issue the command: [admin@MikroTik] driver> add name=ne2k -isa io=0x280 [admin@MikroTik] driver> print Flags: I - invalid, D - dynamic # DRIVER IRQ IO MEMORY ISDN PROTOCOL 0 D RealTek 8139 1 D Intel EtherExpressPro 2 D PCI NE2000 3 ISA NE2000 280 4 Moxa C101 Synchronous C8000 [admin@MikroTik] driver> There are some other drivers that should be added manually. Please refer to the respe ctive manual sections for the detailed information on how drivers are to be loaded.

Setup Command
Command name: /setup

Description
The initial setup of the router can be done by using the /setup command which offers the following configuration: reset all router configuration load interface driver configure ip address and gateway setup dhcp client setup dhcp server setup pppoe client setup pptp client

Configure IP address on router, using the Setup command


Execute the /setup command from command li ne: [admin@MikroTik] > setup Setup uses Safe Mode. It means that all changes that are made during setup are reverted in case of error, or if [Ctrl]+[C] is used to abort setup. To keep changes exit setup using the [X] key. [Safe Mode taken] Choose options by pressing one of the letters in the left column, before dash. Pressing [X] will exit current menu, pressing Enter key will select the entry that is marked by an '*'. You can abort setup at any time by pressing [Ctrl]+[C]. Entries marked by '+' are al ready configured. Entries marked by ' -' cannot be used yet. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 17 Referensi : Download :www.mikrotik.com

Entries marked by 'X' cannot be used without installing additional packages. r - reset all router configuration + l - load interface driver * a - configure ip address and gateway d - setup dhcp client s - setup dhcp server p - setup pppoe client t - setup pptp client x - exit menu your choice [press Enter to configure ip address and gateway]: a To configure IP address and gateway, press a or [Enter], if the a choice is marked with an asterisk symbol ('*'). * a - add ip address - g - setup default gateway x - exit menu your choice [press Enter to add ip address]: a Choose a to add an IP address. At first, setup will ask you for an interface to which the address will be assign ed. If the setup offers you an undesirable interface, erase this choice, and press the [Tab] key twice to see all available interfaces. After the interface is chosen, assign IP address and network mask on it: your choice: a enable interface: ether1 ether2 wlan1 enable interface: ether1 ip address/netmask: 10.1.0.66/24 #Enabling interface /interface enable ether1 #Adding IP address /ip address add address=10.1.0.66/24 interface=ether1 comment="added by setup" + a - add ip address * g - setup default gate way x - exit menu your choice: x

Basic Examples
Example
Assume you need to configure the MikroTik router for the following network setup:

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

18

In the current example we use two networks: The local LAN with network address 192.168.0.0 and 24 -bit netmask: 255.255.255.0. The router's address is 192.168.0.254 in this network The ISP's network with address 10.0.0.0 and 24 -bit netmask 255.255.255.0. The router's address is 10.0.0.217 in this network The addresses can be added and viewed using the followin g commands: [admin@MikroTik] ip address> add address 10.0.0.217/24 interface Public [admin@MikroTik] ip address> add address 192.168.0.254/24 interface Local [admin@MikroTik] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 10.0.0.217/24 10.0.0.217 10.0.0.255 Public 1 192.168.0.254/24 192.168.0.0 192.168.0.255 Local [admin@MikroTik] ip address> Here, the network mask has been specified in the v alue of the address argument. Alternatively, the argument 'netmask' could have been used with the value '255.255.255.0'. The network and broadcast addresses were not specified in the input since they could be calculated automatically. Please note that the addresses assigned to different interfaces of the router should belong to different networks.

Viewing Routes
You can see two dynamic (D) and connected (C) routes, which have been ad ded automatically when the addresses were added in the example above: [admin@MikroTik] ip route> print Flags: A - active, X - disabled, I - invalid, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, d - dynamic Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 19 Referensi : Download :www.mikrotik.com

# DST-ADDRESS G GATEWAY DISTANCE INTERFACE 0 ADC 192.168.0.0/24 r 0.0.0.0 0 Local 1 ADC 10.0.0.0/24 r 0.0.0.0 0 Public [admin@MikroTik] ip route> print detail Flags: A - active, X - disabled, I - invalid, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, d - dynamic 0 ADC dst-address=192.168.0.0/24 prefsrc=192.168.0.254 interface=Local scope=10 1 ADC dst-address=10.0.0.0/24 prefsrc=10.0.0.217 interface=Public scope=10 [admin@MikroTik] ip route> These routes show, that IP packets with destination to 10.0.0.0/24 would be sent through the interface Public, whereas IP packets with destination to 192.168.0.0/24 would be sent through the interface Local. However, you need to specify where the router should forward packets, which have destination other than networks connected directly to the router.

Adding Default Routes


In the following example the default route (destination 0.0.0.0 (any), netmask 0.0.0.0 (any)) will be added. In this case it is the ISP's gateway 10.0.0.1, which can be reached through the interface Public [admin@MikroTik] ip route> add gateway=10.0.0.1 [admin@MikroTik] ip route> print Flags: X - disabled, I - invalid, D - dynamic, J - rejected, C - connect, S - static, R - rip, O - ospf, B - bgp # DST-ADDRESS G GATEWAY DISTANCE INTERFACE 0 ADC 192.168.0.0/24 Local 1 ADC 10.0.0.0/24 Public 2 A S 0.0.0.0/0 r 10.0.0.1 0 Public [admin@MikroTik] ip route> Here, the default route is listed under #2. As we see, the gateway 10.0.0.1 can be reached through the interface 'Public'. If the gateway was specified incorrectly, the value for the argument 'interface' would be unk nown. Notes You cannot add two routes to the same destination, i.e., destination -address/netmask! It applies to the default routes as well. Instead, you can enter multiple gateways for one destination. For more information on IP routes, please read the Routes, Equal Cost Multipath Routing, Policy Routing manual. If you have added an unwanted static route accidentally, use the remove command to delete the unneeded one. You will not be able to delete dynamic (DC) routes. They are added automatically and represent routes to the networks the router connected directly.

Testing the Network Connectivity


From now on, the /ping command can be used to test the network connectivity on both interface s. You can reach any host on both connected networks from the router. How the /ping command works: [admin@MikroTik] ip route> /ping 10.0.0.4 10.0.0.4 64 byte ping: ttl=255 time=7 ms 10.0.0.4 64 byte ping: ttl=255 time=5 ms 10.0.0.4 64 byte ping: ttl=255 ti me=5 ms 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 5/5.6/7 ms [admin@MikroTik] ip route> [admin@MikroTik] ip route> /ping 192.168.0.1 192.168.0.1 64 byte ping: ttl=255 time=1 ms 192.168.0.1 64 byte ping: ttl=255 time =1 ms 192.168.0.1 64 byte ping: ttl=255 time=1 ms 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 1/1.0/1 ms Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 20

[admin@MikroTik] ip route> The workstation and the laptop can reach (ping) the router at its local address 192.1 68.0.254, If the router's address 192.168.0.254 is specified as the default gateway in the TCP/IP configuration of both the workstation and the laptop, then you should be able to ping the router: C:\>ping 192.168.0.254 Reply from 192.168.0.254: bytes=32 ti me=10ms TTL=253 Reply from 192.168.0.254: bytes=32 time<10ms TTL=253 Reply from 192.168.0.254: bytes=32 time<10ms TTL=253 C:\>ping 10.0.0.217 Reply from 10.0.0.217: bytes=32 time=10ms TTL=253 Reply from 10.0.0.217: bytes=32 time<10ms TTL=253 Reply from 10.0.0.217: bytes=32 time<10ms TTL=253 C:\>ping 10.0.0.4 Request timed out. Request timed out. Request timed out. Notes You cannot access anything beyond the router (network 10.0.0.0/24 and the Internet), unless you do the one of the following: Use source network address translation (masquerading) on the MikroTik router to 'hide' your private LAN 192.168.0.0/24 (see the information below), or Add a static route on the ISP's gateway 10.0.0.1, which specifies the host 10.0.0.217 as the gateway to network 192.168.0.0/24. Then all hosts on the ISP's network, including the server, will be able to communicate with the hosts on the LAN To set up routing, it is required that you have some knowledge of configuring TCP/IP networks. We strongly recommend that you obtain more knowledge, if you have difficulties configuring your network setups.

Advanced Configuration Tasks


Description
Next will be discussed situation with 'hiding' the private LAN 192.168.0.0/24 'behind' one address 10.0.0.217 given to you by the ISP.

Application Example with Masquerading


If you want to 'hide' the private LAN 192.168.0.0/24 'behind' one address 10.0.0.217 given to you by the ISP, you should use the source network address translation (masquerading) feature of the MikroTik router. Masquerading is useful, if you want to access the ISP's network and the Internet appearing as all requests coming from the host 10.0.0.217 of the ISP's network. The masquerading will change the source IP address and port of the packets originated from the networ k 192.168.0.0/24 to the address 10.0.0.217 of the router when the packet is routed through it. Masquerading conserves the number of global IP addresses required and it lets the whole network use a single IP address in its communication with the world. To use masquerading, a source NAT rule with action 'masquerade' should be added to the firewall configuration: [admin@MikroTik] ip firewall nat> add chain=srcnat action=masquerade out interface=Public [admin@MikroTik] ip firewall nat> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=srcnat out -interface=Public action=masquerade Notes Please consult Network Address Translation for more information on masquerading.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

21

Example with Bandwidth Management


Assume you want to limit the bandwidth to 128kbps on downloads and 64kbps on uploads for all hosts on the LAN. Bandwidth limitation is done by applying queues for outgoing interfaces regarding the traffic flow. It is enough to add a single queue at the MikroTik router: [admin@MikroTik] queue simple> add max -limit=64000/128000 interface=Local [admin@MikroTik] queue simple> print Flags: X - disabled, I - invalid, D - dynamic 0 name="queue1" target -address=0.0.0.0/0 dst -address=0.0.0.0/0 interface=Local queue=default/default priority=8 limit -at=0/0 max-limit=64000/128000 total -queue=default [admin@MikroTik] queue simple> Leave all other parameters as set by default. The limit is approximately 128kbps going to the LAN (download) and 64kbps leaving the client's LAN (upload).

Example with NAT


Assume we have moved the server in our previous examples from the public network to our local one:

The server's address is now 192.168.0.4, and we are running web server on it that listens to the TCP port 80. We want to make it accessible from the Internet at address:port 10.0.0.217:80. This can be done by means of Static Network Address translation (NAT) at the MikroTik Router. The Public address:port 10.0.0.217:80 will be Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 22 Referensi : Download :www.mikrotik.com

translated to the Local address:port 192.168.0.4:80. One destination NAT rule is required for translating the destination address and port: [admin@MikroTik] ip firewall nat> add chain=dstnat action=dst -nat protocol=tcp dst-address=10.0.0.217/32 dst-port=80 to-addresses=192.168.0.4 [admin@MikroTik] ip firewall nat> pr Flags: X - disabled, I - invalid, D - dynamic 0 chain=dstnat dst -address=10.0.0.217/32 protocol=tcp dst -port=80 action=dst-nat to-addresses=192.168.0.4 to -ports=0-65535 Notes Please consult Network Address Translation for more information on Network Address Translation. Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

23

BAB III DNS Client and Cache


General Information
Summary
DNS cache is used to minimize DNS requests to an externa l DNS server as well as to minimize DNS resolution time. This is a simple recursive DNS server with local items.

Specifications
Packages required: system License required: Level1 Submenu level: /ip dns Standards and Technologies: DNS Hardware usage: Not significant

Related Documents
Software Package Management HotSpot Gateway ../guide/aaa.php

Description
The MikroTik router with DNS cache feature enabled can be set as a primary DNS server for any DNS compliant clients. Moreover, MikroTik router can be specified as a primary DNS server under its dhcp -server settings. When the DNS cache is enabled, the MikroTik router responds to DNS TCP and UDP requests on port 53.

Additional Resources
http://www.freesoft.org/CIE/Course/Section2/3.htm http://www.networksorcery.com/enp/protocol/dns.htm RFC1035

Client Configuration and Cache Setup


Submenu level: /ip dns

Description
DNS client is used to provide domain name reso lution for router itself as well as for the P2P clients connected to the router.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

24

Property Description
allow-remote-requests (yes | no) - specifies whether to allow network requests cache-max-ttl (time; default: 1w) - specifies maximum time-to-live for cahce records. In other words, cache records will expire after cache-max-ttl time. cache-size (integer: 512..10240; default: 2048KiB) - specifies the size of DNS cache in KiB cache-used (read-only: integer) - displays the currently used cache size in KiB primary-dns (IP address; default: 0.0.0.0) - primary DNS server secondary-dns (IP address; default: 0.0.0.0) - secondary DNS server

Notes
If the property use-peer-dns under /ip dhcp-client is set to yes then primary-dns under /ip dns will change to a DNS address given by DHCP Server.

Example
To set 159.148.60.2 as the primary DNS server and allow the router to be used as a DNS server, do the following: [admin@MikroTik] ip dns> set primary -dns=159.148.60.2 \ \... allow-remote-requests=yes [admin@MikroTik] ip dns> print primary -dns: 159.148.60.2 secondary -dns: 0.0.0.0 allow-remote-requests: yes cache -size: 2048KiB cache-max-ttl: 1w cache -used: 17KiB [admin@MikroTik] ip dns>

Cache Monitoring
Submenu level: /ip dns cache

Property Description
address (read-only: IP address) - IP address of the host name (read-only: name) - DNS name of the host ttl (read-only: time) - remaining time-to-live for the record

Static DNS Entries


Submenu level: /ip dns static

Description
The MikroTik RouterOS has an embedded DNS server feature in DNS cache. It allows you to link the particular domain names with the respective IP addresses and advertize these links to the DNS clients using the router as their DNS server.

Property Description
address (IP address) - IP address to resolve domain name with name (text) - DNS name to be resolved to a given IP address ttl (time) - time-to-live of the DNS record Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 25

Example
To add a static DNS entry for www.example.com to be resolved to 10.0.0.1 IP address: [admin@MikroTik] ip dns static> add name www.example.com address=10.0.0.1 [admin@MikroTik] ip dns static> print # NAME ADDRESS TTL 0 aaa.aaa.a 123.123.123.123 1d 1 www.example.com 10.0.0.1 1d [admin@MikroTik] ip dns static>

Flushing DNS cache


Command name: /ip dns cache flush

Command Description
flush - clears internal DNS cache

Example
[admin@MikroTik] ip dns> cache flush [admin@MikroTik] ip dns> print primary -dns: 159.148.60.2 secondary -dns: 0.0.0.0 allow-remote-requests: yes cache -size: 2048 KiB cache-max-ttl: 1w cache -used: 10 KiB [admin@MikroTik] ip dns> Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

26

BAB IV Web Proxy


General Information
Summary
The MikroTik RouterOS implements the following proxy server features: Regular HTTP proxy Transparent proxy. Can be transparent and regular at the same time Access list by source, destination, URL and requested method Cache access list (specifies which objects to cache, and which not) Direct Access List (specifies which resources should be accessed directly, and which - through another proxy server) Logging facility

Quick Setup Guide


To set up a 1 GiB large web cache which will listen on port 8000, do the following: [admin@MikroTik] ip web -proxy> set enabled=yes port=8000 max -cachesize=1048576 [admin@MikroTik] ip web -proxy> print enabled: yes src-address: 0.0.0.0 port: 8000 hostname: proxy transparent -proxy: no parent -proxy: 0.0.0.0:0 cache-administrator: webmaster max-object-size: 4096 KiB cache-drive: system max-cache-size: 1048576 KiB max-ram-cache-size: unlimited status: rebuilding -cache reserved-for-cache: 9216 KiB reserved-for-ram-cache: 2048 KiB [admin@MikroTik] ip web -proxy> Remember to secure your proxy by preventing unauthorized access to it, otherwise it may be used as an open proxy.

Specifications
Packages required: web-proxy License required: Level3 Submenu level: /ip web-proxy Standards and Technologies: HTTP/1.0, HTTP/1.1, FTP Hardware usage: uses memory and disk space, if available (see description below)

Related Documents
Software Package Management Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 27

IP Addresses and ARP ../ip/firewall.php Log Management

Description
Web proxy performs Internet object cache function by storing requested Internet objects, i.e., data available via HTTP and FTP protocols on a system positioned closer to the recipient than the site the data is originated from. Here 'closer' means increased path reliab ility, speed or both. Web browsers can then use the local proxy cache to speed up access and reduce bandwidth consumption. When setting up Web proxy, make sure it serves only your clients, and is not misused as relay. Please read the security notice in the Access List Section! Note that it may be useful to have Web proxy running even with no cache when you want to use it as something like HTTP and FTP firewall (for example, denying access to mp3 files) or to redirect requests to external proxy transparently.

Setup
Submenu level: /ip web-proxy

Property Description
cache-administrator (text; default: webmaster) - administrator's e-mail displayed on proxy error page cache-drive (system | name; default: system) - specifies the target disk drive to be used for storing cached objects. You can use console completion to see the list of available drives enabled (yes | no; default: no) - specifies whether the web proxy is enabled hostname (text; default: proxy) - hostname (DNS or IP address) of the web proxy max-cache-size (none | unlimited | integer: 0..4294967295; default: none) - specifies the maximal disk cache size, measured in kibibytes max-object-size (integer; default: 4096) - objects larger than the size specified will not be saved on disk. The value is measured in kibibytes. If you wish to get a high bytes hit ratio, you should probably increase this (one 2 MiB object hit counts for 2048 1KiB hits). If you wish to increase speed more than your want to save bandwidth you should leave this low max-ram-cache-size (none | unlimited | integer: 0..4294967295; default: unlimited) - specifies the maximal memory cache size, measured in kibibytes parent-proxy (IP address:port; default: 0.0.0.0:0) - specifies upper-level (parent) proxy port (port{1,10}; default: 3128) - specifies the port(s) the web proxy will be listening on reserved-for-cache (read-only: integer; default: 0) - specifies allocated memory cache size, measured in kibibytes reserved-for-ram-cache (read-only: integer; default: 2048) - specifies allocated memory cache size, measured in kibibytes src-address (IP address; default: 0.0.0.0) - the web-proxy will use this address connecting to the parent proxy or web site. 0.0.0.0 - appropriate src-address will be automatically taken from the routing ta ble status (read-only: text; default: stopped) - display status information of the proxy server stopped - proxy is disabled and is not running rebuilding-cache - proxy is enabled and running, existing cache is being verified running - proxy is enabled and running stopping - proxy is shutting down (max 10s) clearing-cache - proxy is stopped, cache files are being removed creating-cache - proxy is stopped, cache directory structure is being created dns-missing - proxy is enabled, but not running becaus e of unknown DNS server (you should specify it under /ip dns) invalid-address - proxy is enabled, but not running because of invalid address (you should change address or port) invalid-cache-administrator - proxy is enabled, but not running because of in valid cache-administrator's email address Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 28

invalid-hostname - proxy is enabled, but not running because of invalid hostname (you should set a valid hostname value) error-logged - proxy is not running because of unknown error. This error is logged as Syst em-Error. Please, send us this error and some description, how it happened reserved-for-cache (integer) - maximal cache size, that is accessible to web -proxy transparent-proxy (yes | no; default: no) - specifies whether the proxy uses transparent mode or not

Notes
By default the proxy cache can use as much disk space as there is allocated for it. When the system allocates the space for the proxy cache, 1/7th of the total partition (disk) size is reserved for the system, but not less than 50MB. The rest is left for the proxy cache. The system RAM size is considered as well when allocating the cache size. The cache size is limited so, that there are at least 15MB of RAM per 1GB of cache plus 55MB of RAM is reserved for the system. max-cache-size is also taken in account, so the cache will not occupy more than it is specified in this property. The effective limit is calculated as a minimum of all three limits. Note also that RouterOS supports up to 950MB of memory. Considering the previous note, you should be aware that you will not be able to enable web proxy, if you have less than 60MB of RAM on your router Expire time of cache entries can be different for each HTML page (specified in headers). But, if there is no such header, the entry will be considere d fresh for not more than 72 hours. The web proxy listens to all IP addresses that the router has in its IP address list.

Example
To enable the proxy on port 8080: [admin@MikroTik] ip web -proxy> set enabled=yes port=8080 [admin@MikroTik] ip web -proxy> print enabled: yes src -address: 0.0.0.0 port: 8080 hostname: proxy transparent -proxy: no parent -proxy: 0.0.0.0:0 cache-administrator: webmaster max-object-size: 4096 KiB cache -drive: system max-cache-size: none max-ram-cache-size: unlimited status: running reserved-for-cache: 0 KiB reserved-for-ram-cache: 2048 KiB [admin@MikroTik] ip web-proxy>

Access List
Submenu level: /ip web-proxy access

Description
Access list is configured in the same way as MikroTik RouterOS firewall rules. Rules are processed from the top to the bottom. First matching rule specifies decision of what to do with this connection. There is a total of 6 classifiers that specify matching constraints. If none of these classifiers is specified, the particular rule will match every connection. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 29

If connection is matched by a rule, action property of this rule specifies whether connection will be allowed or not. If the particular connection does not match any rule, it will be allowed. By default, there is one rule, which prevents connect requests to ports other then 443 and 563.

Property Description
action (allow | deny; default: allow) - specifies whether to pass or deny matched packets dst-address (IP address/netmask) - destination address of the IP packet dst-port (port{1,10}) - a list or range of ports the packet is destined to local-port (port) - specifies the port of the web proxy via which the packet was received. This value should match one of the ports web proxy is listening on. method (any | connect | delete | get | head | options | post | put | trace) - HTTP method used in the request (see HTTP Methods section at the end of this document) src-address (IP address/netmask) - source address of the IP packet url (wildcard) - the URL of the HTTP request

Notes
There is one rule by default, that disallows connect method connections to ports other than 443 (https) and 563 (snews). connect method is a security hole that allows connections (transparent tunneling) to any computer using any protocol. It is used mostly by spammers, as they found it very convenient to use others' mail (SMTP) servers as anonymous mail relay to send spam over the Internet. It is strongly recommended to deny all IP addresses except those behind the router as the proxy still may be used to access your internal-use-only (intranet) web servers. Also, consult examples in Firewall Manual on how to protect your router. Wildcard property url matches a complete string (i.e., they will not match "example.com" if they are set to "example"). Available wildcards are '*' (match any number of any characters) and '?' (match any one character). Regular expressions are also accepted here, but if the property should be treated as a regular expression, it should start with a colon (':'). Small hits in using regular expressions: \\ symbol sequence is used to enter \ character in console \. pattern means . only (in regular expressions single dot in pattern means any symbol) to show that no symbols are allowed before the given pattern, we use ^ symbol at the beginning of the pattern to specify that no symbols are allowed after the given pattern, we use $ symbol at the end of the pattern to enter [ or ] symbols, you should escape them with backslash \.

Example
The default rule: [admin@MikroTik] ip web -proxy access> print Flags: X - disabled, I - invalid 0 ;;; allow CONNECT only to SSL ports 443 [https] and 563 [snews] dst-port=!443,563 method=connect action=deny [admin@MikroTik] ip web -proxy access> To disallow download of .MP3 and .MPG files and FTP connections other than from the 10.0.0.1 server: [admin@MikroTik] ip web -proxy access> add url=": \\.mp\[3g\]$" action=deny [admin@MikroTik] ip web -proxy access> add src -address=10.0.0.1/32 action=allow [admin@MikroTik] ip web -proxy access> add url="ftp://*" action=deny [admin@MikroTik] ip web -proxy access> print Flags: X - disabled, I - invalid 0 ;;; allow CONNECT only to SSL ports 443 [https] and 563 [snews] dst-port=!443,563 method=connect action=deny Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 30

1 2

url=":\.mp[3g]$" action=deny src-address=10.0.0.1/32 action=allow

3 url="ftp://*" action=deny [admin@MikroTik] ip web -proxy access>

Direct Access List


Submenu level: /ip web-proxy direct

Description
If parent-proxy property is specified, it is possible to tell the proxy server whether to try to pass the request to the parent proxy or to resolve it connecting to the requested server directly. Direct Access List is managed just like Proxy Access List described in the previous chapter except the action argument.

Property Description
action (allow | deny; default: allow) - specifies the action to perform on matched packets allow - always resolve matched requests directly bypassing the parent router deny - resolve matched requests through the parent proxy. If no one is specified this has the same effect as allow dst-address (IP address/netmask) - destination address of the IP packet dst-port (port{1,10}) - a list or range of ports the packet is destined to local-port (port) - specifies the port of the web proxy via which the packet was received. This value should match one of the ports web proxy is listening on. method (any | connect | delete | get | head | options | post | put | trace) - HTTP method used in the request (see HTTP Methods section in the end of this document) src-address (IP address/netmask) - source address of the IP packet url (wildcard) - the URL of the HTTP request

Notes
Unlike the access list, the direct proxy access list has default action equal to deny. It takes place when no rules are specified or a particular request did not match any rule.

Cache Management
Submenu level: /ip web-proxy cache

Description
Cache access list specifies, which requests (domains, servers, pages) have to be cached locally by web proxy, and which not. This list is implemented exactly the same way as web proxy access list. Default action is to cache object (if no matching rule is fou nd).

Property Description
action (allow | deny; default: allow) - specifies the action to perform on matched packets allow - cache objects from matched request deny - do not cache objects from matched request dst-address (IP address/netmask) - destination address of the IP packet dst-port (port{1,10}) - a list or range of ports the packet is destined to Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

31

local-port (port) - specifies the port of the web proxy via which the packet was received. This value should match one of the ports web proxy is listeni ng on. method (any | connect | delete | get | head | options | post | put | trace) - HTTP method used in the request (see HTTP Methods section in the end of this document) src-address (IP address/netmask) - source address of the IP packet url (wildcard) - the URL of the HTTP request

Complementary Tools
Description
Web proxy has additional commands to handle non -system drive used for caching purposes and to recover the proxy from severe file system errors.

Command Description
check-drive - checks non-system cache drive for errors clear-cache - deletes existing cache and creates new cache directories format-drive - formats non-system cache drive and prepairs it for holding the cache

Transparent Mode
Description
Transparent proxy feature performs re quest caching invisibly to the end -user. This way the user does not notice that his connection is being processed by the proxy and therefore does not need to perform any additional configuration of the software he is using. This feature may as well be comb ined with bridge to simplify deployment of web proxy in the existing infrastructure. To enable the transparent mode, place a firewall rule in destination NAT, specifying which connections, id est traffic coming to which ports should be redirected to the pr oxy.

Notes
Only HTTP traffic is supported in transparent mode of the web proxy. HTTPS and FTP protocols are not going to work this way.

Example
To configure the router to transparently redirect all connections coming from ether1 interface to port 80 to the web proxy listening on port 8080, then add the following destination NAT rule: [admin@MikroTik] > /ip firewall nat add in -interface=ether1 dst -port=80 \ \... protocol=tcp action=redirect to -ports=8080 chain=dstnat [admin@MikroTik] > /ip firewall nat pr int Flags: X - disabled, I - invalid, D - dynamic 0 chain=dstnat protocol=tcp in -interface=ether1 dst -port=80 action=redirect to-ports=8080 [admin@MikroTik] > Notes Be aware, that you will not be able to access the router's web page after addition of the rule above unless you will change the port for the www service under /ip service submenu to a different value or explicitly exclude router's IP address from those to be matched, like: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 32 Referensi : Download :www.mikrotik.com

/ip firewall nat add in -interface=ether1 dst -port=80 \ \... protocol=tcp action=redirect to -ports=8080 chain=dstnat dst address=!1.1.1.1/32 It is assumed that the router's address is 1.1.1.1/32.

HTTP Methods
Description
OPTIONS This method is a request of information about the communication options available on the chain between the client and the server identified by the Request-URI. The method allows the client to determine the options and (or) the requirements associated with a resource without initiating any resource retrieval GET This method retrieves whatever information identified by the Request-URI. If the Request-URI refers to a data processing process than the response to the GET method should contain data produced by the process, not the source code of the process procedure( -s), unless the source is the r esult of the process. The GET method can become a conditional GET if the request message includes an If-Modified-Since, IfUnmodified-Since, If-Match, If-None-Match, or If-Range header field. The conditional GET method is used to reduce the network traffic specifying that the transfer of the entity should occur only under circumstances described by conditional header field( -s). The GET method can become a partial GET if the request message includes a Range header field. The partial GET method intends to reduce unnecessary network usage by requesting only parts of entities without transferring data already held by client. The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching. HEAD This method shares all features of GET method except that the server must not return a message -body in the response. This retrieves the metainformation of the entity implied by the request which leads to a wide usage of it for testing hypertext links for validity, accessibility, and rec ent modification. The response to a HEAD request may be cacheable in the way that the information contained in the response may be used to update previously cached entity identified by that Request-URI. POST This method requests that the origin server acc ept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI. The actual action performed by the POST method is determined by the origin server and usually is RequestURI dependent. Responses to POST method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. PUT This method requests that the enclosed entity be stored under the supplied Request-URI. If another entity exists under specified Request-URI, the enclosed entity should be considered as updated (newer) version of that residing on the origin server. If the Request-URI is not pointing to an existing resource, the origin server should create a resource with that URI. If the request passes through a cache and th e Request-URI identifies one or more currently cached entities, those entries should be treated as stale. Responses to this method are not cacheable. TRACE This method invokes a remote, application -layer loop-back of the request message. The final recipie nt of the request should reflect the message received back to the client as the entity -body of a 200 (OK) response. The final recipient is either the origin server or the first proxy or gateway to receive a Max-Forwards value of 0 in the request. A TRACE request must not include an entity. Responses to this method MUST NOT be cached. Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

33

BAB V HTTP Proxy


General Information
Summary
The MikroTik RouterOS implements the following proxy server features: Regular HTTP proxy Transparent proxy. Can be transparent and regular at the same time Access list by source, destination, URL and requested method Cache access list (specifies which objects to cache, and which not) Direct Access List (specifies, which resources should be accessed directly, and which - through another proxy server) Logging facility

Quick Setup Guide


To enable HTTP proxy, do the following: [admin@MikroTik] ip proxy> set enabled=yes [admin@MikroTik] ip proxy> print enabled: yes src -address: 0.0.0.0 port: 8080 parent -proxy: 0.0.0.0:0 cache -drive: system cache-administrator: "webmaster" max-disk-cache-size: none max-ram-cache-size: 100000KiB cache-only-on-disk: yes maximal-client-connections: 1000 maximal-server-connections: 1000 max-object-size: 2000KiB max-fresh-time: 3d [admin@MikroTik] ip proxy> Remember to secure your proxy by preventing unauthorized access to it, otherwise it may be used as an open proxy. Also you need to setup destination NAT in order to utilize transparent proxying facility: [admin@MikroTik] ip firewall nat> add chain=dstnat protocol=tcp dst -port=80 action=redirect to -ports=8080 [admin@MikroTik] ip firewall nat> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=dstnat protocol=tcp dst -port=80 action=redirect to -ports=8080 [admin@MikroTik] ip firewall nat>

Specifications
Packages required: system License required: Level3 Submenu level: /ip proxy Standards and Technologies: HTTP/1.0, HTTP/1.1, FTP

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

34

Related Documents
Software Package Management IP Addresses and ARP ../ip/firewall.php Log Management

Description
This service performs proxying of HTTP and HTTP -proxy (for FTP, HTTP and HTT PS protocols) requests. Web proxy performs Internet object cache function by storing requested Internet objects, i.e., data available via HTTP and FTP protocols on a system positioned closer to the recipient than the site the data is originated from. Here 'closer' means increased path reliability, speed or both. Web browsers can then use the local proxy cache to speed up access and reduce bandwidth consumption. When setting up proxy service, make sure it serves only your clients, and is not misused as relay . Please read the security notice in the Access List Section! Note that it may be useful to have Web proxy running even with no cache when you want to use it only as something like HTTP and FTP firewall (for example, denying access to mp3 files) or to redi rect requests to external proxy (possibly, to a proxy with caching functions) transparently.

Setup
Submenu level: /ip proxy

Property Description
cache-administrator (text; default: webmaster) - administrator's e-mail displayed on proxy error page cache-drive (system | name; default: system) - specifies the target disk drive to be used for storing cached objects. You can use console completion to see the list of available drives cache-only-on-disk (yes | no; default: yes) - whether to create database in memory that describes cache contents on disk. This will minimize memory consumption, but may affect speed enabled (yes | no; default: no) - whether the proxy server is enabled max-disk-cache-size (none | unlimited | integer: 0..4294967295; default: none) - specifies the maximal disk cache size, measured in kibibytes max-fresh-time (time; default: 3d) - maximal time to store a cached object. The validity period of an object is is usually defined by the object itself, but in case it is set too high, you ca n override the maximal value maximal-client-connecions (integer; default: 1000) - maximal number of connections accepted from clients (any further connections will be rejected) maximal-server-connectons (integer; default: 1000) - maximal number of connec tions made to servers (any further connections from clients will be put on hold until some server connections will terminate) max-object-size (integer; default: 2000KiB) - objects larger than the size specified will not be saved on disk. The value is measured in kibibytes. If you wish to get a high bytes hit ratio, you should probably increase this (one 2 MiB object hit counts for 2048 1KiB hits). If you wish to increase speed more than your want to save bandwidth you should leave this low max-ram-cache-size (none | unlimited | integer: 0..4294967295; default: none) - specifies the maximal RAM cache size, measured in kibibytes parent-proxy (IP address:port; default: 0.0.0.0:0) - IP address and port of another HTTP proxy to redirect all requests to (exceptions may be defined in the "direct access" list 0.0.0.0:0 - no parent proxy is used port (port; default: 8080) - TCP port the proxy server will be listening on. This is to be specified on all clients that want to use the server as HTTP proxy. Transparent (with zero configuration for clients) proxy setup can be made by redirecting HTTP requests to this port in IP firewall using destination NAT feature src-address (IP address; default: 0.0.0.0) - the web-proxy will use this address connecting to the parent proxy or web site. 0.0.0.0 - appropriate src-address will be automatically taken from the routing table

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

35

Notes
The web proxy listens to all IP addresses that the router has in its IP address list.

Example
To enable the proxy on port 8000: [admin@MikroTik] ip proxy> set enabled=yes port=8000 [admin@MikroTik] ip proxy> print enabled: yes src -address: 0.0.0.0 port: 8000 parent -proxy: 0.0.0.0:0 cache -drive: system cache-administrator: "[email protected]" max-disk-cache-size: none max-ram-cache-size: 100000KiB cache-only-on-disk: yes maximal-client-connections: 1000 maximal-server-connections: 1000 max-object-size: 2000KiB max-fresh-time: 3d [admin@MikroTik] ip proxy>

Access List
Submenu level: /ip proxy access

Description
Access list

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

36

BAB VI IP Pools
General Information
Summary
IP pools are used to define range of IP addresses that is used for DHCP server and Point -to-Point servers

Specifications
Packages required: system License required: Level1 Submenu level: /ip pool Standards and Technologies: none Hardware usage: Not significant

Related Documents
Package Management IP Addresses and ARP AAA DHCP Client and Server HotSpot Gateway Universal Client Interface

Description
IP pools simply group IP addresses for further usage. It is a single configuration point for all features that assign IP addresses to clients.

Notes
Whenever possible, the same ip address is given out to each client (OWN ER/INFO pair).

Setup
Submenu level: /ip pool

Property Description
name (name) - the name of the pool next-pool (name) - when address is acquired from pool that has no free addresses, and next-pool property is set to another pool, then next IP address wi ll be acquired from next-pool ranges (IP address) - IP address list of non-overlapping IP address ranges in form of: from1-to1,from2to2,...,fromN-toN. For example, 10.0.0.1-10.0.0.27,10.0.0.32-10.0.0.47 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 37

Example
To define a pool named ip-pool with the 10.0.0.1-10.0.0.125 address range excluding gateway's address 10.0.0.1 and server's address 10.0.0.100, and the other pool dhcp-pool, with the 10.0.0.200-10.0.0.250 address range: [admin@MikroTik] ip pool> add name=ip -pool ranges=10.0.0.2 10.0.0.99,10.0.0.1 01 10.0.0.126 [admin@MikroTik] ip pool> add name=dhcp -pool ranges=10.0.0.200 -10.0.0.250 [admin@MikroTik] ip pool> print # NAME RANGES 0 ip-pool 10.0.0.2 -10.0.0.99 10.0.0.101 -10.0.0.126 1 dhcp-pool 10.0.0.200 -10.0.0.250 [admin@MikroTik] ip pool>

Used Addresses from Pool


Submenu level: /ip pool used

Description
Here you can see all used IP addres ses from IP pools.

Property Description
pool (read-only: name) - name of the IP pool address (read-only: IP address) - IP address that is assigned to client form the pool owner (read-only: MAC address) - MAC address of the client info (read-only: name) - name of the interface to which the client is connected to

Example
See used addresses from pool: [admin@MikroTik] ip pool used> print POOL ADDRESS OWNER INFO local 192.168.0.100 00:0C:42:03:1F:60 test local 192.168.0.99 00:0C:42:03:21:0F test Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

38

BAB VII DHCP Client and Server


General Information
Summary
The DHCP (Dynamic Host Configuration Protocol) is needed for easy distribution of IP addresses in a network. The MikroTik RouterOS implementation includes both - server and client parts and is compliant with RFC2131. General usage of DHCP: IP assignment in LAN, cable -modem, and wireless systems Obtaining IP settings on cable -modem systems IP addresses can be bound to MAC addresses using static lease feature. DHCP server can be used with MikroTik RouterOS HotSpot feature to authenticate and account DHCP clients. See the HotSpot Manual for more information.

Quick Setup Guide


This example will show you how to setup DHCP -Server and DHCP-Client on MikroTik RouterOS. Setup of a DHCP-Server. 1. Create an IP address pool /ip pool add name=dhcp -pool ranges=172.16.0.10 -172.16.0.20 2. Add a DHCP network which will concern to the network 172.16.0.0/12 and will distribute a gateway with IP address 172.16.0.1 to DHCP clients: /ip dhcp-server network add address=172.16.0.0/12 gateway=172.16.0.1 3. Finally, add a DHCP server: /ip dhcp-server add interface=wlan1 address -pool=dhcp-pool Setup of the DHCP-Client (which will get a lease from the DHCP server, configu red above). 3. Add the DHCP client: /ip dhcp-client add interface=wlan1 use -peer-dns=yes \ add-default-route=yes disabled=no 4. Check whether you have obtained a lease: [admin@Server] ip dhcp -client> print detail Flags: X - disabled, I - invalid 0 interface=wlan1 add-default-route=yes use-peer-dns=yes status=bound address=172.16.0.20/12 gateway=172.16.0.1 dhcp server=192.168.0.1 primary-dns=159.148.147.194 expires -after=2d23:58:52 [admin@Server] ip dhcp -client>

Specifications
Packages required: dhcp License required: Level1 Submenu level: /ip dhcp-client, /ip dhcp-server, /ip dhcp-relay Standards and Technologies: DHCP

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

39

Description
The DHCP protocol gives and allocates IP addresses to IP clien ts. DHCP is basically insecure and should only be used in trusted networks. DHCP server always listens on UDP 67 port, DHCP client - on UDP 68 port. The initial negotiation involves communication between broadcast addresses (on some phases sender will use source address of 0.0.0.0 and/or destination address of 255.255.255.255). You should be aware of this when building firewall.

Additional Resources
ISC Dynamic Host Configuration Protocol (DHCP) DHCP mini-HOWTO ISC DHCP FAQ

DHCP Client Setup


Submenu level: /ip dhcp-client

Description
The MikroTik RouterOS DHCP client may be ena bled on any Ethernet-like interface at a time. The client will accept an address, netmask, default gateway, and two dns server addresses. The received IP address will be added to the interface with the respective netmask. The default gateway will be added to the routing table as a dynamic entry. Should the DHCP client be disabled or not renew an address, the dynamic default route will be removed. If there is already a default route installed prior the DHCP client obtains one, the route obtained by the DHCP client would be shown as invalid.

Property Description
address (IP address/netmask) - IP address and netmask, which is assigned to DHCP Client from the Server add-default-route (yes | no; default: yes) - whether to add the default route to the gateway sp ecified by the DHCP server client-id (text) - corresponds to the settings suggested by the network administrator or ISP. Commonly it is set to the client's MAC address, but it may as well be any test string dhcp-server (IP address) - IP address of the DHCP Server enabled (yes | no; default: no) - whether the DHCP client is enabled expires-after (time) - time, which is assigned by the DHCP Server, after which the lease expires gateway (IP address) - IP address of the gateway which is assigned by DHCP Se rver host-name (text) - the host name of the client as sent to a DHCP server interface (name) - any Ethernet-like interface (this includes wireless and EoIP tunnels) on which the DHCP Client searches the DHCP Server primary-dns (IP address) - IP address of the primary DNS server, assigned by the DHCP Server secondary-dns (IP address) - IP address of the secondary DNS server, assigned by DHCP Server primary-ntp - IP address of the primary NTP server, assigned by the DHCP Server secondary-ntp - IP address of the secondary NTP server, assigned by the DHCP Server status (bound | error | rebinding... | renewing... | requesting... | searching... | stopped) - shows the status of DHCP Client use-peer-dns (yes | no; default: yes) - whether to accept the DNS s ettings advertized by DHCP server (they will be ovverriden in /ip dns submenu) use-peer-ntp (yes | no; default: yes) - whether to accept the NTP settings advertized by DHCP server (they will override the settings put in the /system ntp client submenu)

Command Description
release - release current binding and restart DHCP client Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 40

renew - renew current leases. If the renew operation was not successful, client tries to reinitialize lease (i.e. it starts lease request procedure (rebind) as if it had not rece ived an IP address yet)

Notes
If host-name property is not specified, client's system identity will be sent in the respective field of DHCP request. If client-id property is not specified, client's MAC address will be sent in the respective field of DHC P request. If use-peer-dns property is enabled, the DHCP client will unconditionally rewrite the settings in /ip dns submenu. In case two or more DNS servers were received, first two of them are set as primary and secondary servers respectively. In case o ne DNS server was received, it is put as primary server, and the secondary server is left intact.

Example
To add a DHCP client on ether1 interface: /ip dhcp-client add interface=ether1 disabled=no [admin@MikroTik] ip dhcp -client> print detail Flags: X - disabled, I - invalid 0 interface=ether1 add -default-route=no use-peer-dns=no status=bound address=192.168.25.100/24 dhcp -server=10.10.10.1 expires after=2d21:25:12 [admin@MikroTik] ip dhcp -client>

DHCP Server Setup


Submenu level: /ip dhcp-server

Description
The router supports an individual server for each Ethernet -like interface. The MikroTik RouterOS DHCP server supports the basic functions of giving each requesting client an IP address/netmask lease, default gateway, domain name, DNS-server(s) and WINS-server(s) (for Windows clients) information (set up in the DHCP networks submenu) In order DHCP server to work, you must set up also IP pools (do not include the DHCP server's IP address into the pool range) and DHCP networks. It is also possible to hand out leases for DHCP clients using the RADIUS server, here are listed the parameters for used in RADIUS server. Access-Request: NAS-Identifier - router identity NAS-IP-Address - IP address of the router itself NAS-Port - unique session ID NAS-Port-Type - Ethernet Calling-Station-Id - client identifier (active-client-id) Framed-IP-Address - IP address of the client (active -address) Called-Station-Id - name of DHCP server User-Name - MAC address of the client (active -mac-address) Password - "" Access-Accept: Framed-IP-Address - IP address that will be assigned to client Framed-Pool - ip pool from which to assign ip address to client Rate-Limit - Datarate limitation for DHCP clients. Format is: rx -rate[/tx-rate] [rx-burst-rate[/tx-burstrate] [rx-burst-threshold[/tx-burst-threshold] [rx-burst-time[/tx-burst-time][priority] [rx-rate-min[/txrate-min]]]]. All rates should be numbers with optional 'k' (1,000s) or 'M' (1,000,000s). If tx -rate is not Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 41

specified, rx-rate is as tx-rate too. Same goes for tx-burst-rate and tx-burst-threshold and tx-burst-time. If both rx-burst-threshold and tx-burst-threshold are not specified (but burst -rate is specified), rx-rate and tx-rate are used as burst thresholds. If both rx -burst-time and tx-burst-time are not specified, 1s is used as default. Priority takes values 1..8, where 1 implies the highest priority, but 8 - the lowest. If rxrate-min and tx-rate-min are not specified rx-rate and tx-rate values are used. The rx-rate-min and txrate-min values can not exceed rx-rate and tx-rate values. Ascend-Data-Rate - tx/rx data rate limitation if multiple attributes are provided, first limits tx data rate, second - rx data rate. If used together with Ascend -Xmit-Rate, specifies rx rate. 0 if unlimited Ascend-Xmit-Rate - tx data rate limitation. It may be used to specify tx limit only instead of sending two sequental Ascend-Data-Rate attributes (in that case Ascend -Data-Rate will specify the receive rate). 0 if unlimited Session-Timeout - max lease time (lease-time)

Property Description
add-arp (yes | no; default: no) - whether to add dynamic ARP entry: no - either ARP mode should be enabled on that interface or static ARP entries should be administratively defined in /ip arp submenu address-pool (name | static-only; default: static-only) - IP pool, from which to take IP addresses for clients static-only - allow only the clients that have a static lease (i.e. no dynamic addresses will be given to clients, only the ones added in lease submenu) always-broadcast (yes | no; default: no) - always send replies as broadcasts authoritative (after-10sec-delay | after-2sec-delay | no | yes; default: after-2sec-delay) - whether the DHCP server is the only one DHCP server for the network after-10sec-delay - to clients request for an address, dhcp server will wait 10 seconds and if there is another request from the client after this period of time, then dhcp server will offer the address to the client or will send DHCPNAK, if the requested address is not available from this server after-2sec-delay - to clients request for an address, dhcp server will wait 2 seconds and if there is another request from the client after this period of time, then dhcp server will offer the address to the client or will send DHCPNAK, if the requested address is not available from this server no - dhcp server ignores clients requests for addresses that are not available from this server yes - to clients request for an address that is not available from this server, dhcp server will send neg ative acknowledgment (DHCPNAK) bootp-support (none | static | dynamic; default: static) - support for BOOTP clients none - do not respond to BOOTP requests static - offer only static leases to BOOTP clients dynamic - offer static and dynamic leases for BOOTP clients delay-threshold (time; default: none) - if secs field in DHCP packet is smaller than delay-threshold, then this packet is ignored none - there is no threshold (all DHCP packets are processed) interface (name) - Ethernet-like interface name lease-time (time; default: 72h) - the time that a client may use an address. The client will try to renew this address after a half of this time and will request a new address after time limit expires name (name) - reference name ntp-server (text) - the DHCP client will use these as the default NTP servers. Two comma -separated NTP servers can be specified to be used by DHCP client as primary and secondary NTP servers relay (IP address; default: 0.0.0.0) - the IP address of the relay this DHCP server s hould process requests from: 0.0.0.0 - the DHCP server will be used only for direct requests from clients (no DHCP really allowed) 255.255.255.255 - the DHCP server should be used for any incomming request from a DHCP relay except for those, which are processed by another DHCP server that exists in the /ip dhcp-server submenu src-address (IP address; default: 0.0.0.0) - the address which the DHCP client must send requests to in order to renew an IP address lease. If there is only one static address on th e DHCP server interface and the source address is left as 0.0.0.0, then the static address will be used. If there are multiple addresses on the interface, an address in the same subnet as the range of given addresses should be used use-radius (yes | no; default: no) - whether to use RADIUS server for dynamic leases

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

42

Notes
If using both - Universal Client and DHCP Server on the same interface, client will only receive a DHCP lease in case it is directly reachable by its MAC address through that interface (some wireless bridges may change client's MAC address). If authoritative property is set to yes, the DHCP server is sending rejects for the leases it cannot bind or renew. It also may (although not always) help to prevent the users of the network to run illicitly their own DHCP servers disturbing the proper way this network should be functioning. If relay property of a DHCP server is not set to 0.0.0.0 the DHCP server will not respond to the direct requests from clients.

Example
To add a DHCP server to interface ether1, lending IP addresses from dhcp-clients IP pool for 2 hours: /ip dhcp-server add name=dhcp -office disabled=no address -pool=dhcp-clients \ interface=ether1 lease -time=2h [admin@MikroTik] ip dhcp -server> print Flags: X - disabled, I - invalid # NAME INTERFACE RELAY ADDRESS -POOL LEASE-TIME ADD-ARP 0 dhcp-office ether1 dhcp -clients 02:00:00 [admin@MikroTik] ip dhcp -server>

Store Leases on Disk


Submenu level: /ip dhcp-server config

Description
Leases are always stored on disk on graceful shutdown and reboot. If on every lease change it is stored on disk, a lot of disk writes happen. There are no problems if it happens on a hard drive, but is very bad on Compact Flash (especially, if lease times are very short). To minimize writes on disk, all changes are flushed together every store-leases-disk seconds. If this time will be very short (immediately), then no changes will be lost even in case of hard reboots and power losts. But, on CF the re may be too many writes in case of short lease times (as in case of hotspot). If this time will be very long (never), then there will be no writes on disk, but information about active leases may be lost in case of power loss. In these cases dhcp server may give out the same ip address to another client, if first one will not respond to ping requests.

Property Description
store-leases-disk (time-interval | immediately | never; default: 5min) - how frequently lease changes should be stored on disk

DHCP Networks
Submenu level: /ip dhcp-server network

Property Description
address (IP address/netmask) - the network DHCP server(s) will lend addresses from boot-file-name (text) - Boot file name Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 43

dhcp-option (text) - add additional DHCP options from /ip dhcp-server option list. You cannot redefine parameters which are already defined in this submenu: Subnet-Mask (code 1) - netmask Router (code 3) - gateway Domain-Server (code 6) - dns-server Domain-Name (code 15) - domain NETBIOS-Name-Server - wins-server dns-server (text) - the DHCP client will use these as the default DNS servers. Two comma -separated DNS servers can be specified to be used by DHCP client as primary and secondary DNS servers domain (text) - the DHCP client will use this as the 'DNS dom ain' setting for the network adapter gateway (IP address; default: 0.0.0.0) - the default gateway to be used by DHCP clients netmask (integer: 0..32; default: 0) - the actual network mask to be used by DHCP client 0 - netmask from network address is to be used next-server (IP address) - IP address of next server to use in bootstrap wins-server (text) - the Windows DHCP client will use these as the default WINS servers. Two comma separated WINS servers can be specified to be used by DHCP client as prima ry and secondary WINS servers

Notes
The address field uses netmask to specify the range of addresses the given entry is valid for. The actual netmask clients will be using is specified in netmask property.

DHCP Server Leases


Submenu level: /ip dhcp-server lease

Description
DHCP server lease submenu is used to monitor and manage server's leases. The issued leases are showed here as dynamic entries. You can also add static leases to issue the definite client (determined by MAC address) the specified IP address. Generally, the DHCP lease it allocated as follows: 1. an unused lease is in waiting state 2. if a client asks for an IP address, the server chooses one 3. if the client will receive statically assigned address, the lease becomes offered, and then bound with the respective lease time 4. if the client will receive a dynamic address (taken from an IP address pool), the router sends a ping packet and waits for answer for 0.5 seconds. During this time, the lease is marked testing 5. in case, the address does not re spond, the lease becomes offered, and then bound with the respective lease time 6. in other case, the lease becomes busy for the lease time (there is a command to retest all busy addresses), and the client's request remains unanswered (the client will try ag ain shortly) A client may free the leased address. When the dynamic lease is removed, and the allocated address is returned to the address pool. But the static lease becomes busy until the client will reacquire the address. Note that the IP addresses assigned statically are not probed.

Property Description
active-address (read-only: IP address) - actual IP address for this lease active-client-id (read-only: text) - actual client-id of the client active-mac-address (read-only: MAC address) - actual MAC address of the client active-server (read-only: list) - actual dhcp server, which serves this client address (IP address) - specify ip address (or ip pool) for static lease 0.0.0.0 - use pool from server agent-circuit-id (read-only: text) - circuit ID of DHCP relay agent agent-remote-id (read-only: text) - Remote ID, set by DHCP relay agent Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

44

block-access (yes | no; default: no) - block access for this client (drop packets from this client) client-id (text; default: "") - if specified, must match DHCP ' client identifier' option of the request expires-after (read-only: time) - time until lease expires host-name (read-only: text) - shows host name option from last received DHCP request lease-time (time; default: 0s) - time that the client may use an add ress 0s - lease will never expire mac-address (MAC address; default: 00:00:00:00:00:00) - if specified, must match MAC address of the client radius (read-only: yes | no) - shows, whether this dynamic lease is authenticated by RADIUS or not rate-limit (read-only: text; default: "") - sets rate limit for active lease. Format is: rx -rate[/tx-rate] [rx-burstrate[/tx-burst-rate] [rx-burst-threshold[/tx-burst-threshold] [rx-burst-time[/tx-burst-time]]]]. All rates should be numbers with optional 'k' (1,000s) or 'M' (1,000,000s). If tx-rate is not specified, rx-rate is as tx-rate too. Same goes for tx-burst-rate and tx-burst-threshold and tx-burst-time. If both rx-burst-threshold and tx-burst-threshold are not specified (but burst-rate is specified), rx-rate and tx-rate is used as burst thresholds. If both rx -burst-time and tx-burst-time are not specified, 1s is used as default. rx-rate (integer; default: 0) - maximal receive bitrate to the client (for users it is upload bitrate)) 0 - no limitation server (read-only: name) - server name which serves this client status (read-only: waiting | testing | authorizing | busy | offered | bound) - lease status: waiting - not used static lease testing - testing whether this address is used or not (only for dynamic l eases) by pinging it with timeout of 0.5s authorizing - waiting for response from radius server busy - this address is assigned statically to a client or already exists in the network, so it can not be leased offered - server has offered this lease to a client, but did not receive confirmation from the client bound - server has received client's confirmation that it accepts offered address, it is using it now and will free the address not later, than the lease time will be over tx-rate (integer; default: 0) - maximal transmit bitrate to the client (for users it is download bitrate)) 0 - no limitation

Command Description
check-status - Check status of a given busy dynamic lease, and free it in case of no response make-static - convert a dynamic lease to static one

Notes
If rate-limit is specified, a simple queue is added with corresponding parameters when lease enters bound state. Arp entry is added right after adding of queue is done (only if add -arp is enabled for dhcp server). To be sure, that client cannot use his ip address without getting dhcp lease and thus avoiding rate -limit, reply-only mode must be used on that ethernet interface. Even though client address may be changed (with adding a new item) in lease print list, it will not change for the client. It is true for any changes in the DHCP server configuration because of the nature of the DHCP protocol. Client tries to renew assigned IP address only when half a lease time is past (it tries to renew several times). Only when full lease time is past and IP address was not renewed, new lease is asked (rebind operation). the deault mac-address value will never work! You should specify a correct MAC address there.

Example
To assign 10.5.2.100 static IP address for the existing DHCP client (sho wn in the lease table as item #0): [admin@MikroTik] ip dhcp -server lease> print Flags: X - disabled, H - hotspot, D - dynamic # ADDRESS MAC -ADDRESS EXPIRES -AFTER SERVER STATUS 0 D 10.5.2.90 00:04:EA:C6:0E:40 1h48m59s switch bound 1 D 10.5.2.91 00:04:EA:99:63:C0 1h42m51s switch bound [admin@MikroTik] ip dhcp -server lease> add copy -from=0 address=10.5.2.100 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 45

[admin@MikroTik] ip dhcp -server lease> print Flags: X - disabled, H - hotspot, D - dynamic # ADDRESS MAC -ADDRESS EXPIRES -AFTER SERVER 1 D 10.5.2.91 00:04:EA:99:63:C0 1h42m18s switch 2 10.5.2.100 00:04:EA:C6:0E:40 1h48m26s switch [admin@MikroTik] ip dhcp -server lease>

STATUS bound bound

DHCP Alert
Submenu level: /ip dhcp-server alert

Description
To find any rogue DHCP servers as soon as they appear in your network, DHCP Alert tool can be used. It will monitor ethernet for all DHCP replies and check, whether this re ply comes from a valid DHCP server. If reply from unknown DHCP server is detected, alert gets triggered: [admin@MikroTik] ip dhcp -server alert>/log print 00:34:23 dhcp,critical,error,warning,info,debug dhcp alert on Public: discovered unknown dhcp serv er, mac 00:02:29:60:36:E7, ip 10.5.8.236 [admin@MikroTik] ip dhcp -server alert> When the system alerts about a rogue DHCP server, it can execute a custom script. As DHCP replies can be unicast, rogue dhcp detector may not receive any offer to other dhcp cl ients at all. To deal with this, rogue dhcp server acts as a dhcp client as well - it sends out dhcp discover requests once a minute

Property Description
alert-timeout (none/time; default: none) - time, after which alert will be forgotten. If after that t ime the same server will be detected, new alert will be generated none - infinite time interface (name) - interface, on which to run rogue DHCP server finder invalid-server (read-only: text) - list of MAC addresses of detected unknown DHCP servers. Serv er is removed from this list after alert-timeout on-alert (text) - script to run, when an unknown DHCP server is detected valid-server (text) - list of MAC addresses of valid DHCP servers

Notes
All alerts on an interface can be cleared at any time usi ng command: /ip dhcp-server alert reset-alert <interface> Note, that e-mail can be sent, using /system logging action add target=email

DHCP Option
Submenu level: /ip dhcp-server option

Description
With help of DHCP Option, it is possible to define add itional custom options for DHCP Server.

Property Description
code (integer: 1..254) - dhcp option code. All codes are available at http://www.iana.org/assignments/bootp dhcp-parameters Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 46 Referensi : Download :www.mikrotik.com

name (name) - descriptive name of the option value (text) - parameter's value in form of a string. If the string begins with "0x", it is assumed as a hexadecimal value

Notes
The defined options you can use in /ip dhcp-server network submenu According to the DHCP protocol, a parameter is returned to the DHCP client only if it requests this parameter, specifying the respective code in DHCP request Parameter -List (code 55) attribute. If the code is not included in Parameter-List attribute, DHCP server will not send it to the DHCP client.

Example
This example shows how to set DHCP server to reply on DHCP client's Hostname request (code 12) with value Host-A. Add an option named Option-Hostname with code 12 (Hostname) and value Host-A: [admin@MikroTik] ip dhcp -server option> add name=Hostname code=12 \ value="Host-A" [admin@MikroTik] ip dhcp-server option> print # NAME CODE VALUE 0 Option-Hostname 12 Host -A [admin@MikroTik] ip dhcp -server option> Use this option in DHCP server network list: [admin@MikroTik] ip dhcp -server network> add address=10.1.0.0/24 \ \... gateway=10.1.0.1 dhcp -option=Option-Hostname dns-server=159.148.60.20 [admin@MikroTik] ip dhcp -server network> print detail 0 address=10.1.0.0/24 gateway=10.1.0.1 dns -server=159.148.60.20 dhcp-option=Option-Hostname [admin@MikroTik] ip dhcp -server network> Now the DHCP server will reply with its Hostname Host-A to DHCP client (if requested)

DHCP Relay
Submenu level: /ip dhcp-relay

Description
DHCP Relay is just a proxy that is able to receive a DHCP request and resend it to the real DHCP server

Property Description
dhcp-server (text) - list of DHCP servers' IP addresses which should the DHCP requests be forwarded to delay-threshold (time; default: none) - if secs field in DHCP packet is smaller than delay -threshold, then this packet is ignored interface (name) - interface name the DHCP relay will be working on local-address (IP address; default: 0.0.0.0) - the unique IP address of this DHCP relay needed for DHCP server to distinguish relays: 0.0.0.0 - the IP address will be chosen automatically name (name) - descriptive name for relay

Notes

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

47

DHCP relay does not choose the particular DHCP server in the dhcp -server list, it just sent to all the listed servers.

Example
To add a DHCP relay named relay on ether1 interface resending all received requests to the 10.0.0.1 DHCP server: [admin@MikroTik] ip dhcp -relay> add name=relay interface=ether1 \ \... dhcp-server=10.0.0.1 disabled=no [admin@MikroTik] ip dhcp -relay> print Flags: X - disabled, I - invalid # NAME INTERFACE DHCP -SERVER LOCALADDRESS 0 relay ether1 10.0.0.1 0.0.0.0 [admin@MikroTik] ip dhcp -relay>

Question&Answer-Based Setup
Command name: /ip dhcp-server setup

Questions
addresses to give out (text) - the pool of IP addresses DHCP server should lease to the clients dhcp address space (IP address/netmask; default: 192.168.0.0/24) - network the DHCP server will lease to the clients dhcp relay (IP address; default: 0.0.0.0) - the IP address of the DHCP relay between the DHCP server and the DHCP clients dhcp server interface (name) - interface to run DHCP server on dns servers (IP address) - IP address of the appropriate DNS server to be propagated to the DHCP clients gateway (IP address; default: 0.0.0.0) - the default gateway of the leased network lease time (time; default: 3d) - the time the lease will be valid

Notes
Depending on current settings and answers to the previous questions, default values of following q uestions may be different. Some questions may disappear if they become redundant (for example, there is no use of asking for 'relay' when the server will lend the directly connected network)

Example
To configure DHCP server on ether1 interface to lend addresses from 10.0.0.2 to 10.0.0.254 which belong to the 10.0.0.0/24 network with 10.0.0.1 gateway and 159.148.60.2 DNS server for the time of 3 days: [admin@MikroTik] ip dhcp -server> setup Select interface to run DHCP server on dhcp server interface: ether 1 Select network for DHCP addresses dhcp address space: 10.0.0.0/24 Select gateway for given network gateway for dhcp network: 10.0.0.1 Select pool of ip addresses given out by DHCP server Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 48

addresses to give out: 10.0.0.2 -10.0.0.254 Select DNS servers dns servers: 159.148.60.20 Select lease time lease time: 3d [admin@MikroTik] ip dhcp -server> The wizard has made the following configuration based on the answers above: [admin@MikroTik] ip dhcp -server> print Flags: X - disabled, I - invalid # NAME INTERFACE RELAY ADDRESS -POOL LEASE-TIME ADD-ARP 0 dhcp1 ether1 0.0.0.0 dhcp_pool1 3d no [admin@MikroTik] ip dhcp -server> network print # ADDRESS GATEWAY DNS -SERVER DOMAIN 0 10.0.0.0/24 10.0.0.1 159.148.60.20

WINS-SERVER

[admin@MikroTik] ip dhcp -server> /ip pool print # NAME RANGES 0 dhcp_pool1 10.0.0.2 -10.0.0.254 [admin@MikroTik] ip dhcp-server>

Application Examples
Dynamic Addressing, using DHCP -Relay
Let us consider that you have several IP networks 'behind' other routers, but you want to keep all DHCP servers on a single router. To do this, you need a DHCP relay on your network which relies DHCP requests from clients to DHCP server. This example will show you how to configure a DHCP server and a DHCP relay which serve 2 IP networks 192.168.1.0/24 and 192.168.2.0/24 that are behind a router DHCP-Relay.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

49

IP addresses of DHCP-Server: [admin@DHCP-Server] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 192.168.0.1/24 192.168.0.0 192.168.0.255 To -DHCP-Relay 1 10.1.0.2/24 10.1.0.0 10.1.0.255 Public [admin@DHCP-Server] ip address> IP addresses of DHCP-Relay: [admin@DHCP-Relay] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 192.168.0.1/24 192.168.0.0 192.168.0.255 To -DHCP-Server 1 192.168.1.1/24 192.168.1.0 192.168.1.255 Local1 2 192.168.2.1/24 192.168.2.0 192.168.2.255 Local2 [admin@DHCP-Relay] ip address> To setup 2 DHCP Servers on DHCP-Server router add 2 pools. For networks 192.168.1.0/24 and 192.168.2.0: /ip pool add name=Local1 -Pool ranges=192.168.1.11 -192.168.1.100 /ip pool add name=Local1 -Pool ranges=192.168.2.11 -192.168.2.100 [admin@DHCP-Server] ip pool> print # NAME RANGES 0 Local1-Pool 192.168.1.11 -192.168.1.100 1 Local2-Pool 192.168.2.11 -192.168.2.100 [admin@DHCP-Server] ip pool> Create DHCP Servers: /ip dhcp-server add interface=To -DHCP-Relay relay=192.168.1.1 \ address-pool=Local1-Pool name=DHCP-1 disabled=no /ip dhcp-server add interface=To -DHCP-Relay relay=192.168.2.1 \ address-pool=Local2-Pool name=DHCP-2 disabled=no Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 50

[admin@DHCP-Server] ip dhcp-server> print Flags: X - disabled, I - invalid # NAME INTERFACE RELAY ADDRESS -POOL LEASE-TIME ADD-ARP 0 DHCP-1 To-DHCP-Relay 192.168.1.1 Local1 -Pool 3d00:00:00 1 DHCP-2 To-DHCP-Relay 192.168.2.1 Local2 -Pool 3d00:00:00 [admin@DHCP-Server] ip dhcp-server> Configure respective networks: /ip dhcp-server network add address=192.168.1.0/24 gateway=192.168.1.1 \ dns-server=159.148.60.20 /ip dhcp-server network add addre ss=192.168.2.0/24 gateway=192.168.2.1 \ dns-server 159.148.60.20 [admin@DHCP-Server] ip dhcp-server network> print # ADDRESS GATEWAY DNS -SERVER WINS-SERVER DOMAIN 0 192.168.1.0/24 192.168.1.1 159.148.60.20 1 192.168.2.0/24 192.168.2.1 159.148.60.20 [admin@DHCP-Server] ip dhcp-server network> Configuration of DHCP-Server is done. Now let's configure DHCP-Relay: /ip dhcp-relay add name=Local1 -Relay interface=Local1 \ dhcp-server=192.168.0.1 local -address=192.168.1.1 disabled=no /ip dhcp-relay add name=Local2 -Relay interface=Local2 \ dhcp-server=192.168.0.1 local -address=192.168.2.1 disabled=no [admin@DHCP-Relay] ip dhcp-relay> print Flags: X - disabled, I - invalid # NAME INTERFA CE DHCP-SERVER LOCALADDRESS 0 Local1-Relay Local1 192.168.0.1 192.168.1.1 1 Local2-Relay Local2 192.168.0.1 192.168.2.1 [admin@DHCP-Relay] ip dhcp-relay>

IP Address assignment, using Fr eeRADIUS Server


Let us consider that we want to assign IP addresses for clients, using the RADIUS server.

We assume that you already have installed FreeRADIUS. Just add these lines to specified files: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 51

users file: 00:0B:6B:31:02:4B Auth -Type := Local, Password == "" Framed-IP-Address = 192.168.0.55 clients.conf file client 172.16.0.1 { secret = MySecret shortname = Server } Configure Radius Client on Route rOS: /radius add service=dhcp address=172.16.0.2 secret=MySecret [admin@DHCP-Server] radius> print detail Flags: X - disabled 0 service=dhcp called -id="" domain="" address=172.16.0.2 secret="MySecret" authentication -port=1812 accounting -port=1813 timeout=00:00:00.300 accounting-backup=no realm="" [admin@DHCP-Server] radius> Setup DHCP Server: 1. Create an address pool: /ip pool add name=Radius -Clients ranges=192.168.0.11 -192.168.0.100 2. Add a DHCP server: /ip dhcp-server add address -pool=Radius-Clients use-radius=yes interface=Local \ disabled=no 3. Configure DHCP networks: /ip dhcp-server network add address=192.168.0.0/24 gateway=192.168.0.1 \ dns-server=159.148.147.194,159.148.60.20 Now the client with MAC address 00:0B:6B:31:02:4B will always receive IP address 192.168.0.55. Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

52

BAB VIII Bandwidth Control


General Information
Summary
Bandwidth Control is a set of mechanisms that control data rate allocation, delay variability, timely delivery, and delivery reliability. The MikroTik RouterOS supports the follow ing queuing disciplines: PFIFO - Packets First-In First-Out BFIFO - Bytes First-In First-Out SFQ - Stochastic Fairness Queuing RED - Random Early Detect PCQ - Per Connection Queue HTB - Hierarchical Token Bucket

Specifications
Packages required: system License required: Level1 (limited to 1 queue) , Level3 Submenu level: /queue Standards and Technologies: None Hardware usage: significant

Related Documents
Software Package Management IP Addresses and ARP Mangle

Description
Quality of Service (QoS) means that the router should prioritize and shape network traffic. QoS is not so much about limiting, it is more about providing quality. Below are list ed the some features of MikroTik RouterOS Bandwidth Control mechanism: limit data rate for certain IP adresses, subnets, protocols, ports, and other parameters limit peer-to-peer traffic prioritize some packet flows over others use queue bursts for faster WEB browsing apply queues on fixed time intervals share available traffic among users equally, or depending on the load of the channel The queuing is applied on packets leaving the router through a real interface (i.e., the queues are applied on the outgoing interface, regarding the traffic flow), or any of the 3 additional virtual interfaces (global -in, global-out, global-total). The QoS is performed by means of dropping packets. In case of TCP protocol, the dropped packets will be resent so there is no need to worry that with shaping we lose some TCP information. The main terms used to describe the level of QoS for network applications, are: queuing discipline (qdisc) - an algorithm that holds and maintains a queue of packets. It specifies the order of the outgoing packets (it means that queuing discipline can reorder packets) and which packets to drop if there is no space for them Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 53

CIR (Committed Information Rate) - the guaranteed data rate. It means that traffic rate, not exceeding this value should always be delivered MIR (Maximal Information Rate) - the maximal data rate router will provide Priority - the order of importance in what traffic will be processed. You can give priority to some traffic in order it to be handeled before some other traff ic Contention Ratio - the ratio to which the defined data rate is shared among users (when data rate is allocated to a number of subscribers). It is the number of subscribers that have a single speed limitation, applied to all of them together. For exampl e, the contention ratio of 1:4 means that the allocated data rate may be shared between no more than 4 users Before sending data over an interface, it is processed with a queuing discipline. By default, queuing disciplines are set under /queue interface for each physical interface (there is no default queuing discipline for virtual interfaces). Once we add a queue (in /queue tree) to a physical interface, the interface default queue, defined in /queue interface, for that particular interface gets ignored. It means - when a packet does not match any filter, it is sent through the interface with the highest priority. Scheduler and Shaper qdiscs We can classify queuing disciplines by their influence to packet flow: schedulers - queuing disciplines only resche dule packets regarding their algorithm and drop packets which 'do not fit in the queue'. Scheduler queuing disciplines are: PFIFO, BFIFO, SFQ, PCQ, RED shapers - queuing disciplines that also perform the limitation. Shapers are PCQ and HTB Virtual Interfaces There are 3 virtual interfaces in RouterOS, in addition to real interfaces: global-in - represents all the input interfaces in general (INGRESS queue). Please note that queues attached to global-in apply to traffic that is received by the router, bef ore the packet filtering. global-in queueing is executed just after mangle and dst -nat global-out - represents all the output interfaces in general. Queues attached to it apply before the ones attached to a specific interface global-total - represents a virtual interface through which all the data, going through the router, is passing. When attaching a qdisc to global -total, the limitation is done in both directions. For example, if we set a total-max-limit to 256000, we will get upload+download=256kbps ( maximum) Introduction to HTB HTB (Hierarchical Token Bucket) is a classful queuing discipline that is useful for applying different handling for different kinds of traffic. Generally, we can set only one queue for an interface, but in RouterOS queues are attached to the main Hierarchical Token Bucket (HTB) and thus have some properties derived from that parent queue. For example, we can set a maximum data rate for a workgroup and then distribute that amount of traffic between the members of that workgroup . HTB qdisc in detail: HTB terms: queuing discipline (qdisc) - an algorithm that holds and maintains a queue of packets. It specifies the order of the outgoing packets (it mea ns that queuing discipline can reorder packets). Qdisc also decides which packets to drop if there is no space for them filter - a procedure that classifies packets. The filter is responsible for classifying packets so that they are put in the corresponding qdiscs level - position of a class in the hierarchy inner class - a class that has one or more child -classes attached to it. Inner classes do not store any packets, but they do traffic shaping. The class also does not have its own priority leaf class - a class that has a parent but does not have any child -classes. Leaf classes are always located at level 0 of the hierarchy. Each leaf class has a qdisc, attached to it self feed - an object that represents the exit for the packets from all the classes active at its level of the hierarchy. It consists of 8 self slots self slot - an element of a self feed that corresponds to each particular priority. All classes, active at the same level, of one priority are attached to one self slot that they are using to send packets out through active class (at a particular level) - a class that is attached to a self slot at the given level inner feed - similar to self feed object, which consists of inner self slots, present on each inner class inner feed slot - similar to self slot. Each inner feed consists of inner slots which represent a priority Each class has a parent and may have one or more children. Classes that do not have children, are put at level 0, where queues are maintained, and are called 'leaf class es' Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 54

Each class in the hierarchy can prioritize and shape traffic. There are 2 main parameters in RouterOS which refer to shaping and one - to prioritizing: limit-at - data rate that is guaranteed to a class (CIR) max-limit - maximal data rate that is allowed for a class to reach (MIR) priority - order in which classes are served at the same level (8 is the lowest priority, 1 is the highest) Each HTB class can be in one of 3 states, depending on data rate that it consumes: green - a class the actual rate of which is equal or less than limit-at. At this state, the class is attached to self slot at the corresponding priority at its level, and is allowed to satisfy its limit -at limitation regardless of what limitations its parents have. For example, if we hav e a leaf class with limitat=512000 and its parent has max-limit=limit-at=128000, the class will get its 512kbps! yellow - a class the actual rate of which is greater than limit-at and equal or less than max-limit. At this state, the class is attached to the inner slot of the corresponding priority of its parent's inner feed, which, in turn, may be attached to either its parent's inner slot of the same priority (in case the parent is also yellow), or to its own level self slot of the same priority (in case the parent is green). Upon the transition to this state, the class 'disconnects' from self feed of its level, and 'connects' to its parent's inner feed red - a class the actual rate of which exceeds max-limit. This class cannot borrow rate from its paren t class Priorities When a leaf class wants to send some traffic (as they are the only classes that hold packets), HTB checks its priority. It will begin with the highest priority and the lowest level and proceed until the lowest priority at highest level is reached: As you can see from the picture, leaf -classes which are at the green state, will always have a higher priority than those which are borrowing because their priority is at a lower level (level0). In this picture, Leaf1 will be served only after Leaf2, although it has a higher priority (7) than Leaf1 (8). In case of equal priorities and equal states, HTB serves these classes, using round robin algorithm. HTB Examples Here are some examples on how the HTB works. Imagine the following scenario - we have 3 different kinds of traffic, marked in /ip firewall mangle (packet_mark1, packet_mark2 and packet_mark3), and now have bulit a HTB hierarchy: [admin@MikroTik] queue tree> a dd name=ClassA parent=Local max -limit=2048000 [admin@MikroTik] queue tree> add name=ClassB parent=ClassA max limit=1024000 [admin@MikroTik] queue tree> add name=Leaf1 parent=ClassA max -limit=2048000 \ \... limit-at=1024000 packet-mark=packet_mark1 priority =8 [admin@MikroTik] queue tree> add name=Leaf2 parent=ClassB max -limit=1024000 \ \... limit-at=256000 packet-mark=packet_mark2 priority=7 [admin@MikroTik] queue tree> add name=Leaf3 parent=ClassB max -limit=1024000 \ \... limit-at=768000 packet-mark=packet_mark3 priority=8 [admin@MikroTik] queue tree> print Flags: X - disabled, I - invalid 0 name="ClassA" parent=Local packet -mark="" limit-at=0 queue=default priority=8 max -limit=2048000 burst -limit=0 burst-threshold=0 burst-time=0s 1 name="ClassB" parent=ClassA packet -mark="" limit-at=0 queue=default priority=8 max -limit=1024000 burst -limit=0 burst-threshold=0 burst-time=0s name="Leaf1" parent=ClassA packet -mark=packet_mark1 limit -at=1024000 queue=default priority=8 max -limit=2048000 burst-limit=0 burst-threshold=0 burst-time=0s name="Leaf2" parent=ClassB packet -mark=packet_mark2 limit -at=256000 55

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

queue=default priority=7 max -limit=1024000 burst -limit=0 burst-threshold=0 burst-time=0s name="Leaf3" p arent=ClassB packet -mark=packet_mark3 limit -at=768000 queue=default priority=8 max -limit=1024000 burst -limit=0 burst-threshold=0 burst-time=0s [admin@MikroTik] queue tree> Now let us describe some scenarios, using this HTB hierarchy. 4. Imagine a situation when there have packets arrived at Leaf1 and Leaf2. Because of this, Leaf1 attaches itself to this level's (Level 0) self slot with priority=8 and Leaf2 attaches to self slot with priority=7. Leaf3 has nothing to send, so it does nothing. This is a simple situation: there are active classes (Leaf1 and Leaf2) at Level 0, and as they both are in green state, they are processed in order of their priorities - at first, we serve Leaf2, then Leaf1. Now assume that Leaf2 has to send more than 256kbps, for this reason, it attaches itself to its parent's (ClassB) inner feed, which recursively attaches itself to Level1 self slot at priority=7. Leaf1 continues to be at green state - it has to send packets, but not faster than 1Mbps. Leaf3 still has nothing to send. This is a very interesting situation because Leaf1 gets a higher priority than Leaf2 (when it i s in the green state), although we have configured it for a lower priority (8) than Leaf2. It is because Leaf2 has disconnected itself from self feed at Level 0 and now is borrowing from its parent (ClassB) which has attached to self feed at Level 1. And b ecause of this, the priority of Leaf2 'has traveled to Level1'. Remember that at first, we serve those classes which are at the lowest level with the highest priority, then continuing with the next level, and so on. Consider that Leaf1 has reached its max -limit and changed its state to red, and Leaf2 now uses more than 1Mbps (and less than 2Mbps), so its parent ClassB has to borrow from ClassA and becomes yellow. Leaf3 still has no packets to send. This scenario shows that Leaf1 has reached its max -limit, and cannot even borrow from its parent (ClassA). Leaf2 has hierarchical reached Level2 and borrows from ClassB which recursively must borrow from ClassA because it has not enough rate available. As Leaf3 has no packets to send, the only one class who sends them, is Leaf2. Assume that Leaf2 is borrowing from ClassB, ClassB from ClassA, but ClassA reaches its max -limit (2Mbps). In this situation Leaf2 is in yellow state, but it cannot borrow (as Class B cannot borrow from Class A). Finally, let's see what happens, if Leaf1, Leaf2, Leaf3 and ClassB are in the yellow state, and ClassA is green. Leaf1 borrows from ClassA, Leaf2 and Leaf3 from ClassB, and ClassB also borrows from ClassA. Now all the priorities have 'moved' to Level2. So Leaf2 is on the highest priority and is served at first. As Leaf1 and Leaf3 are at the same priority (8) on the same level (2), they are served, using the round robin algorithm. Bursts Bursts are used to allow higher data rates for a short period of time. Every 1/16 part of the burst-time, the router calculates the average data rate of each class over the last burst-time seconds. If this average data rate is less than burst-threshold, burst is enabled and the actual data rate reaches burst-limit bps, otherwise the actual data rate falls to max-limit or limit-at. Let us consider that we have a setup, where max-limit=256000, burst-time=8, burst-threshold=192000 and burst-limit=512000. When a user is starting to download a file via HTTP, we can observe such a situation: At the beginning the average data rate over the last 8 seconds is 0bps because before applying the queue rule no traffic was passed, using this rule. Since this average data rate is less than burst-threshold (192kbps), burst is allowed. After the first second, the average data rate is (0+0+0+0+0+0+0+512)/8=64kbps, which is under burst-threshold. After the second second, average data rate is (0+0+0+0+0+0+512+512)/8=128kbps. After the third second comes the breakpoint whe n the average data rate becomes larger than burst-threshold. At this moment burst is disabled and the current data rate falls down to max-limit (256kbps). HTB in RouterOS Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 56 4

5.

6.

7.

8.

There are 4 HTB trees maintained by RouterOS: global-in global-total global-out interface queue When adding a simple queue, it creates 3 HTB classes (in global -in, global-total and global-out), but it does not add any classes in interface queue. Queue tree is more flexible - you can add it to any of these HTB's. When packet travels through the router, it passesall 4 HTB trees - global-in, global-total, global-out and interface queue. If it is directed to the router, it passes global -in and global-total HTB queues. If packets are sent from the router, they are traversing global -total, global-out and interface queues

Additional Resources
http://linux-ip.net/articles/Traffic-Control-HOWTO/overview.html http://luxik.cdi.cz/~devik/qos/htb/ http://www.docum.org/docum.org/docs/

Queue Types
Submenu level: /queue type

Description
In this submenu you can create your custom queue types. Afterwards, you will be ab le to use them in /queue tree, /queue simple or /queue interface. PFIFO and BFIFO These queuing disciplines are based on the FIFO algorithm (First -In First-Out). The difference between PFIFO and BFIFO is that one is measured in packets and the other one i n bytes. There is only one parameter called pfifo-limit (bfifo-limit) which defines how much data a FIFO queue can hold. Every packet that cannot be enqueued (if the queue is full), is dropped. Large queue sizes can increase latency. Use FIFO queuing disciplines if you haven't a congested link SFQ Stochastic Fairness Queuing (SFQ) cannot limit traffic at all. Its main idea is to equalize traffic flows (TCP sessions or UDP streams) when your link is completely full. The fairness of SFQ is ensured by hashing and round -robin algorithms. Hashing algorithm divides the session traffic over a limited number of subqueues. After sfq-perturb seconds the hashing algorithm changes and divides the session traffic to other subqueues. The round -robin algorithm dequeues pcq-allot bytes from each subqueue in a turn. The whole SFQ queue can contain 128 packets and there are 10 24 subqueues available for these packets. Use SFQ for congested links to ensure that some connections do not starve PCQ To solve some SFQ imperfectness, Per Connection Queuing (PCQ) was created. It is the only classless queuing type that can do limitation. It is an improved version of SFQ without its stohastic nature. PCQ also creates subqueues, regarding the pcq-classifier parameter. Each subqueue has a data rate limit of pcq-rate and size of pcq-limit packets. The total size of a PCQ queue cannot be grea ter than pcq-total-limit packets. The following example demonstrates the usage of PCQ with packets, classified by their source address. If you classify the packets by src-address then all packets with different source IP addresses will be grouped into different subqueues. Now you can do the limitation or equalization for each subqueue with the pcq-rate parameter. Perhaps, the most significant part is to decide to which interface shou ld we attach this queue. If we will attach it to the Local interface, all traffic from the Public interface will be grouped by src -address (probably it's not what we want), but if we attach it to the Public interface, all traffic from our clients will be g rouped by src-address - so we can easily limit or equalize upload for clients. To equalize rate among subqueues, classified by the pcq-classifier, set the pcq-rate to 0! Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 57 Referensi : Download :www.mikrotik.com

PCQ can be used to dynamically equalize or shape traffic for multiple users, using lit tle administration. RED Random Early Detection is a queuing mechanism which tries to avoid network congestion by controlling the average queue size. When the average queue size reaches red-min-threshold, RED randomly chooses which arriving packet to drop. The probability how many packets will be dropped increases when the average queue size becomes larger. If the average queue size reaches red-max-threshold, the packets are dropped. However, there may be cases when the real queue size (not average) is much greater than red-max-threshold, then all packets which exceed red-limit are dropped. Mainly, RED is used on congested links with high data rates. Works well with TCP protocol, but not so well with UDP.

Property Description
bfifo-limit (integer; default: 15000) - maximum number of bytes that the BFIFO queue can hold kind (bfifo | pcq | pfifo | red | sfq) - which queuing discipline to use bfifo - Bytes First-In, First-Out pcq - Per Connection Queue pfifo - Packets First-In, First-Out red - Random Early Detection sfq - Stohastic Fairness Queuing name (name) - associative name of the queue type pcq-classifier (dst-address | dst-port | src-address | src-port; default: "") - a classifier by which PCQ will group its subqueues. Can be used several classifiers at once, e.g., src -address,src-port will group all packets with different source address and source -ports into separate subqueues pcq-limit (integer; default: 50) - number of packets that can hold a single PCQ sub -queue pcq-rate (integer; default: 0) - maximal data rate allowed for each PCQ sub -queue. Value 0 means that there is no limitation set pcq-total-limit (integer; default: 2000) - number of packets that can hold the wh ole PCQ queue pfifo-limit (integer) - maximum number of packets that the PFIFO queue can hold red-avg-packet (integer; default: 1000) - used by RED for average queue size calculations red-burst (integer) - value in bytes which is used for determining ho w fast the average queue size will be influenced by the real queue size. Larger values will slow down the calculation by RED - longer bursts will be allowed red-limit (integer) - value in bytes. If the real queue size (not average) exceeds this value then all packets above this value are dropped red-max-threshold (integer) - value in bytes. It is the average queue size at which packet marking probability is the highest red-min-threshold (integer) - average queue size in bytes. When average RED queue size reaches this value, packet marking becomes possible sfq-allot (integer; default: 1514) - amount of bytes that a subqueue is allowed to send before the next subqueue gets a turn (amount of bytes which can be sent from a subqueue in a single round -robin turn) sfq-perturb (integer; default: 5) - time in seconds. Specifies how often to change SFQ's hashing algorithm

Interface Default Queues


Submenu level: /queue interface

Description
In order to send packets over an interface, they have to be enqueued in a queue even if you do not want to limit traffic at all. Here you can specify the queue type which will be used for transmitting data. Note that if other queues are applied for a particular packet, then these settings are not used!

Property Description
interface (read-only: name; default: name of the interface) - name of the interface Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 58

queue (name; default: default) - queue type which will be used for the interface

Example
Set the wireless interface to use wireless-default queue: [admin@MikroTik] queue i nterface> set 0 queue=wireless -default [admin@MikroTik] queue interface> print # INTERFACE QUEUE 0 wlan1 wireless -default [admin@MikroTik] queue interface>

Simple Queues
Description
The simpliest way to limit data rate for specific IP addresses and /or subnets, is to use simple queues. You can also use simple queues to build advanced QoS applications. They have useful integrated features: Peer-to-peer traffic queuing Applying queue rules on chosen time intervals Priorities Using multiple packet marks from /ip firewall mangle Shaping of bidirectional traffic (one limit for the total of upload + download)

Property Description
burst-limit (integer/integer) - maximum data rate which can be reached while the burst is active in form of in/out (target upload/download) burst-threshold (integer/integer) - used to calculate whether to allow burst. If the average data rate over the last burst-time seconds is less than burst-threshold, the actual data rate may reach burst-limit. set in form of in/out (target upload/download) burst-time (integer/integer) - used to calculate average data rate, in form of in/out (target upload/download) direction (none both upload download) - traffic flow directions, affected by this queue none - the queue is effectively ina ctive both - the queue limits both target upload and target download upload - the queue limits only target upload, leaving the download rates unlimited download - the queue limits only target download, leaving the upload rates unlimited dst-address (IP address/netmask) - destination address to match dst-netmask (netmask) - netmask for dst-address interface (text) - interface, this queue applies to (i.e., the interface the target is connected to) limit-at (integer/integer) - guaranteed data rate to this queue in form of in/out (target upload/download) max-limit (integer/integer) - data rate which can be reached if there is enough bandwidth available, in form of in/out (target upload/download) name (text) - descriptive name of the queue p2p (any | all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | winmx) which type of P2P traffic to match all-p2p - match all P2P traffic any - match any packet (i.e., do not check this property) packet-marks (name; default: "") - packet mark to match from /ip firewall mangle. More packet marks are separated by a comma (","). parent (name) - name of the parent queue in the hierarchy. Can be only other simple queue priority (integer: 1..8) - priority of the queue. 1 is the highest, 8 - the lowest queue (name/name; default: default/default) - name of the queue from /queue type in form of in/out target-addresses (IP address/netmask) - limitation target IP addresses (source addresses). To use multiple addresses, separate them with comma

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

59

time (time-time,sat | fri | thu | wed | tue | mon | sun{+}; default: "") - limit queue effect to a specified time period total-burst-limit (integer) - burst limit for global-total queue total-burst-threshold (integer) - burst threshold for global-total queue total-burst-time (time) - burst time for global-total queue total-limit-at (integer) - limit-at for global-total queue (limits cumulative upload + download to total-limit-at bps) total-max-limit (integer) - max-limit for global-total queue (limits cumulative upload + download to total-maxlimit bps) total-queue (name) - queuing discipline to use for global-total queue

Queue Trees
Submenu level: /queue tree

Description
The queue trees should be used when you want to use sophisticat ed data rate allocation based on protocols, ports, groups of IP addresses, etc. At first you have to mark packet flows with a mark under /ip firewall mangle and then use this mark as an identifier for packet flows in queue trees.

Property Description
burst-limit (integer) - maximum data rate which can be reached while the burst is active burst-threshold (integer) - used to calculate whether to allow burst. If the average data rate over the last burst time seconds is less than burst-threshold, the actual data rate may reach burst-limit burst-time (time) - used to calculate average data rate flow (text) - packet flow which is marked in /ip firewall mangle. Current queue parameters apply only to packets which are marked with this flow mark limit-at (integer) - guaranteed data rate to this queue max-limit (integer) - data rate which can be reached if there is enough bandwidth available name (text) - descriptive name for the queue parent (text) - name of the parent queue. The top -level parents are the avai lable interfaces (actually, main HTB). Lower level parents can be other queues priority (integer: 1..8) - priority of the queue. 1 is the highest, 8 - the lowest queue (text) - name of the queue type. Types are defined under /queue type. This parameter applies only to the leaf queues in the tree hierarchy

Application Examples
Example of emulating a 128Kibps/64Kibps Line
Assume, we want to emulate a 128Kibps download and 64Kibps upload line, connecting IP network 192.168.0.0/24. The network is served through the Local interface of customer's router. The basic network setup is in the following diagram:

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

60

To solve this situation, we will use simple queues. IP addresses on MikroTik router: [admin@MikroTik] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 192.168.0.254/24 192.168.0.0 192.168.0.255 Local 1 10.5.8.104/24 10.5.8. 0 10.5.8.255 Public [admin@MikroTik] ip address> And routes: [admin@MikroTik] ip route> print Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf # DST-ADDRESS G GATEWAY DISTANCE INTERFACE 0 ADC 10.5.8.0/24 Public 1 ADC 192.168.0.0/24 Local 2 A S 0.0.0.0/0 r 10.5.8.1 Public [admin@MikroTik] ip route> Add a simple queue rule, which will lim it the download traffic to 128Kib/s and upload to 64Kib/s for clients on the network 192.168.0.0/24, served by the interface Local: [admin@MikroTik] queue simple> add name=Limit -Local interface=Local \ \... target-address=192.168.0.0/24 max -limit=65536/131072 [admin@MikroTik] queue simple> print Flags: X - disabled, I - invalid, D - dynamic 0 name="Limit-Local" target-addresses=192.168.0.0/24 dst address=0.0.0.0/0 interface=Local parent=none priority=8 queue=default/default limit-at=0/0 max-limit=65536/131072 total -queue=default [admin@MikroTik] queue simple> Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 61

The max-limit parameter cuts down the maximum available bandwidth. From the clients' point of view, the value 65536/131072 means that they will get maximum of 131072bps for download and 65536bps for upload. The target-addresses parameter defines the target network (or networks, separated by a comma) to which the queue rule will be applied. Now see the traffic load: [admin@MikroTik] interface> monitor -traffic Local received-packets-per-second: 7 received-bits-per-second: 68kbps sent-packets-per-second: 13 sent-bits-per-second: 135kbps [admin@MikroTik] interface> Probably, you want to exclude the server from being limited, if so, add a queue for it without any li mitation (max-limit=0/0 which means no limitation) and move it to the beginning of the list: [admin@MikroTik] queue simple> add name=Server target addresses=192.168.0.1/32 \ \... interface=Local [admin@MikroTik] queue simple> print Flags: X - disabled, I - invalid, D - dynamic 0 name="Limit-Local" target-addresses=192.168.0.0/24 dst address=0.0.0.0/0 interface=Local parent=none priority=8 queue=default/default limit-at=0/0 max-limit=65536/131072 total -queue=default name="Server" targe t-addresses=192.168.0.1/32 dst -address=0.0.0.0/0 interface=Local parent=none priority=8 queue=default/default limit-at=0/0 max-limit=0/0 total-queue=default [admin@MikroTik] queue simple> mo 1 0 [admin@MikroTik] queue simple> print Flags: X - disabled, I - invalid, D - dynamic 0 name="Server" target -addresses=192.168.0.1/32 dst -address=0.0.0.0/0 interface=Local parent=none priority=8 queue=default/default limit-at=0/0 max-limit=0/0 total-queue=default 1 name="Limit-Local" target-addresses=192.168.0.0/24 dst address=0.0.0.0/0 interface=Local parent=none priority=8 queue=default/default limit-at=0/0 max-limit=65536/131072 total -queue=default [admin@MikroTik] queue simple> 1

Queue Tree Example With Masquerading


In the previous example we dedicated 128Kib/s download and 64Kib/s upload traffic for the local network. In this example we will guarantee 256Kib/s download (128Kib/s for the server, 64Kib/s for the Workstation and also 64Kib/s for the Laptop) and 128Kib/s for u pload (64/32/32Kib/s, respectivelly) for local network devices. Additionally, if there is spare bandwidth, share it among users equally. For example, if we turn off the laptop, share its 64Kib/s download and 32Kib/s upload to the Server and Workstation. When using masquerading, you have to mark the outgoing connection with new-connection-mark and take the mark-connection action. When it is done, you can mark all packets which belong to this connection with the new-packet-mark and use the mark-packet action.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

62

5.

At first, mark the Server's download and upload traffic. With the first rule we will mark the outgoing connection and with the second one, all packets, which belong to this connection: [admin@MikroTik] ip firewall mangle> add src -address=192.168.0.1/32 \ \... action=mark-connection new-connection-mark=server-con chain=prerouting [admin@MikroTik] ip firewall mangle> add connection -mark=server-con \ \... action=mark-packet new-packet-mark=server chain=prerouting [admin@MikroTik] ip firewall mangle> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=prerouting src -address=192.168.0.1 action=mark -connection new-connection-mark=server-con chain=prerouting connection-mark=server-con action=mark-packet new-packet-mark=server [admin@MikroTik] ip firewall mangle> The same for Laptop and Workstation: [admin@MikroTik] ip firewall mangle> add src -address=192.168.0.2 \ \... action=mark-connection new-connection-mark=lap_works-con chain=prerouting [admin@MikroTik] ip firewall mangle> add src -address=192.168.0.3 \ \... action=mark-connection new-connection-mark=lap_works-con chain=prerouting [admin@MikroTik] ip firewall mangle> add connection -mark=lap_workscon \ \... action=mark-packet new-packet-mark=lap_work chain=prerouting [admin@MikroTik] ip firewall mangle> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=prerouting src -address=192.168.0.1 action=mark -connection new-connection-mark=server-con 63 1

6.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

chain=prerouting connection -mark=server-con action=mark-packet new-packet-mark=server chain=prerouting src -address=192.168.0.2 action=mark -connection new-connection-mark=lap_works-con chain=prerouting src -address=192.168.0.3 action=mark -connection new-connection-mark=lap_works-con

7.

4 chain=prerouting connection -mark=lap_works-con action=markpacket new-packet-mark=lap_work [admin@MikroTik] ip firewall mangle> As you can see, we marked connections that belo ng for Laptop and Workstation with the same flow. In /queue tree add rules that will limit Server's download and upload: [admin@MikroTik] queue tree> add name=Server -Download parent=Local \ \... limit-at=131072 packet-mark=server max-limit=262144 [admin@MikroTik] queue tree> add name=Server -Upload parent=Public \ \... limit-at=65536 packet-mark=server max-limit=131072 [admin@MikroTik] queue tree> print Flags: X - disabled, I - invalid 0 name="Server-Download" parent=Local packet -mark=server limitat=131072 queue=default priority=8 max -limit=262144 burst -limit=0 burst-threshold=0 burst-time=0s 1 name="Server-Upload" parent=Public packet -mark=server limitat=65536 queue=default priority=8 max -limit=131072 burst -limit=0 burst-threshold=0 burst-time=0s [admin@MikroTik] queue tree> And similar config for Laptop and Workstation: [admin@MikroTik] queue tree> add name=Laptop -Wkst-Down parent=Local \ \... packet-mark=lap_work limit -at=65535 max-limit=262144 [admin@MikroTik] queue tree> add n ame=Laptop-Wkst-Up parent=Public \ \... packet-mark=lap_work limit -at=32768 max-limit=131072 [admin@MikroTik] queue tree> print Flags: X - disabled, I - invalid 0 name="Server-Download" parent=Local packet -mark=server limitat=131072 queue=default priority=8 max-limit=262144 burst -limit=0 burst-threshold=0 burst-time=0s 1 name="Server-Upload" parent=Public packet -mark=server limitat=65536 queue=default priority=8 max -limit=131072 burst -limit=0 burst-threshold=0 burst-time=0s 2 name="Laptop-Wkst-Down" parent=Local packet -mark=lap_work limit at=65535 queue=default priority=8 max -limit=262144 burst -limit=0 burst-threshold=0 burst-time=0s 3 name="Laptop-Wkst-Up" parent=Public packet -mark=lap_work limit at=32768 queue=default priority=8 max -limit=131072 burst -limit=0 burst-threshold=0 burst-time=0s [admin@MikroTik] queue tree>

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

64

Equal bandwidth sharing among users


This example shows how to equally share 10Mibps download and 2Mibps upload among active users in the network 192.168.0.0/24. If Host A is downloading 2 Mibps, Host B gets 8 Mibps and vice versa. There might be situations when both hosts want to use maximum bandwidth (10 Mibps), then they will receive 5 Mibps each, the same goes for upload. This setup is also valid for more than 2 users.

At first, mark all traffic, coming from local network 192.168.0.0/24 with a mark users: /ip firewall mangle add chain=forward src -address=192.168.0.0/24 \ action=mark-connection new-connection-mark=users-con /ip firewall mangle add connection -mark=users-con action=mark-packet \ new-packet-mark=users chain=forward Now we will add 2 new PCQ types. The first, called pcq-download will group all traffic by destination address. As we will attach this queue type to the Local interface, it will create a dynamic queue for each destination address (user) which is downloading to the network 192.168.0.0/24. The second type, called pcq-upload will group the traffic by source address. We will attach this queue to the Public interface so it will make one dynamic queue for each user who is uploading to Internet from the local network 192.168.0.0/24. /queue type add name=pcq -download kind=pcq pcq -classifier=dst-address /queue type add name=pcq -upload kind=pcq pcq -classifier=src-address Finally, make a queue tree for download traffic: /queue tree add name=Download parent=Local max -limit=10240000 /queue tree add parent=Download queue=pcq -download packet-mark=users And for upload traffic: /queue tree add name=Upload parent=Public max -limit=2048000 /queue tree add parent=Upload queue=pcq -upload packet-mark=users

Note! If your ISP cannot guarantee you a fixed amount of traffic, you can use just one queue for upload and one for download, attached directly to the interface:
/queue tree add parent=Local queue=pcq -download packet-mark=users /queue tree add parent=Public queue=pcq -upload packet-mark=users

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

65

BAB IX Filter
General Information
Summary
The firewall implements packet filtering and thereby provides security functions that are used to manage data flow to, from and through the router. Along with the Network Address Translation it serve as a tool for preventing unauthorized access to directly attached networks an d the router itself as well as a filter for outgoing traffic.

Quick Setup Guide


To add a firewall rule which drops all TCP packets that are destined to port 135 and going through the router, use the following command: /ip firewall filter add chain=forward dst-port=135 protocol=tcp action=drop To deny acces to the router via Telnet (protocol TCP, port 23), type the following command: /ip firewall filter add chain=input protocol=tcp dst -port=23 action=drop To only allow not more than 5 simultaneous connectio ns from each of the clients, do the following: /ip firewall filter add chain=forward protocol=tcp tcp -flags=syn connection-limit=6,32 action=drop

Specifications
Packages required: system License required: Level1 (P2P filters limited to 1) , Level3 Submenu level: /ip firewall filter Standards and Technologies: IP, RFC2113 Hardware usage: Increases with filtering rules count

Related Documents
Software Package Management IP Addresses and ARP Routes, Equal Cost Multipath Routing, Policy Routing NAT Mangle Packet Flow

Firewall Filter
Submenu level: /ip firewall filter

Description
Network firewalls keep outside threats away from sensitive data available inside the network. Whenever different networks are joined together, there is always a threat that someone from outside of your network will Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 66

break into your LAN. Such break -ins may result in private data being stolen and distributed, valuable data being altered or destroyed, or entire hard drives being erased. Firewalls are used as a means of preventing or minimizing the security risks inherent in connecting to other networks. Properly configured firewall plays a key role in efficient and secure network infrastrure deployment. MikroTik RouterOS has very powerful firewall implement ation with features including: stateful packet filtering peer-to-peer protocols filtering traffic classification by: source MAC address IP addresses (network or list) and address types (broadcast, local, multicast, unicast) port or port range IP protocols protocol options (ICMP type and code fields, TCP flags, IP options and MSS) interface the packet arrived from or left through internal flow and connection marks ToS (DSCP) byte packet content rate at which packets arrive and sequence numbers packet size packet arrival time and much more! General Filtering Principles The firewall operates by means of firewall rules. A rule is a definitive form expression that tells the router what to do with a particular IP packet. Each rule consists of two parts that are the matcher which matches traffic flow against given conditions and the action which defines what to do with the mathched packets. Rules are organized in chains for better management. The filter facility has three default chains: input, forward and output that are responsible for traffic coming from, throurh and to the router, respectively. New user -defined chains can be added, as necessary. Since these chains have no default traffic to match, rules with action=jump and relevant jump-target should be added to one or more of the three default chains. Filter Chains As mentioned before, the firewall filtering rules are grouped together in chains. It allows a packet to be matched against one common criterion in one chain, and then passed over for processing against some other common criteria to another chain. For example a packet should be matched against the IP address:port pair. Of course, it could be achieved by adding as many rules with IP address:port match as required to the forward chain, but a better way could be to add one rule that matches traffic from a particular IP address, e.g.: /ip firewall filter add src-address=1.1.1.2/32 jump -target="mychain" and in case of successfull match passes control over the IP packet to some other chain, id est mychain in this example. Then rules that perform matching against separate ports can be added to mychain chain without specifying the IP addresses. There are three predefined chains, which cannot be deleted: input - used to process packets entering t he router through one of the interfaces with the destination IP address which is one of the router's addresses. Packets passing through the router are not processed against the rules of the input chain forward - used to process packets passing through the router output - used to process packets originated from the router and leaving it through one of the interfaces. Packets passing through the router are not processed against the rules of the output chain When processing a chain, rules are taken from the chain in the order they are listed there from top to bottom. If a packet matches the criteria of the rule, then the specified action is performed on it, and no more rules are processed in that chain (the exception is the passthrough action). If a packet has not matched any rule within the chain, then it is accepted.

Property Description
action (accept | add-dst-to-address-list | add-src-to-address-list | drop | jump | log | passthrough | reject | return | tarpit; default: accept) - action to undertake if the packet matches the rule accept - accept the packet. No action is taken, i.e. the packet is passed through and no more rules are applied to it Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 67 Referensi : Download :www.mikrotik.com

add-dst-to-address-list - adds destination address of an IP packet to the address list specified by address-list parameter add-src-to-address-list - adds source address of an IP packet to the address list specified by address-list parameter drop - silently drop the packet (without sending the ICMP reject message) jump - jump to the chain specified by the valu e of the jump-target parameter log - each match with this action will add a message to the system log passthrough - ignores this rule and goes on to the next one reject - reject the packet and send an ICMP reject message return - passes control back to the chain from where the jump took place tarpit - captures and holds incoming TCP connections (replies with SYN/ACK to the inbound TCP SYN packet) address-list (name) - specifies the name of the address list to collect IP addresses from rules having action=add-dst-to-address-list or action=add-src-to-address-list actions. These address lists could be later used for packet matching address-list-timeout (time; default: 00:00:00) - time interval after which the address will be removed from the address list specified by address-list parameter. Used in conjunction with add-dst-to-address-list or add-srcto-address-list actions 00:00:00 - leave the address in the address list forever chain (forward | input | output | name) - specifies the chain to put a part icular rule into. As the different traffic is passed through different chains, always be careful in choosing the right chain for a new rule. If the input does not match the name of an already defined chain, a new chain will be created comment (text) - a descriptive comment for the rule. A comment can be used to identify rules form scripts connection-bytes (integer-integer) - matches packets only if a given amount of bytes has been transfered through the particular connection 0 - means infinity, exempli gratia: connection-bytes=2000000-0 means that the rule matches if more than 2MB has been transfered through the relevant connection connection-limit (integer,netmask) - restrict connection limit per address or address block connection-mark (name) - matches packets marked via mangle facility with particular connection mark connection-state (estabilished | invalid | new | related) - interprets the connection tracking analysis data for a particular packet estabilished - a packet which belongs to an existing connection, exempli gratia a reply packet or a packet which belongs to already replied connection invalid - a packet which could not be identified for some reason. This includes out of memory condition and ICMP errors which do not correspond to any known connection. It is generally advised to drop these packets new - a packet which begins a new TCP connection related - a packet which is related to, but not part of an existing connection, such as ICMP errors or a packet which begins FTP data connection ( the later requires enabled FTP connection tracking helper under /ip firewall service-port) connection-type (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp) - matches packets from related connections based on information from their connection tracking helpers. A relevant connection helper must be enabled under /ip firewall service-port content (text) - the text packets should contain in order to match the rule dst-address (IP address/netmask | IP address-IP address) - specifies the address range an I P packet is destined to. Note that console converts entered address/netmask value to a valid network address, i.e.: 1.1.1.1/24 is converted to 1.1.1.0/24 dst-address-list (name) - matches destination address of a packet against user -defined address list dst-address-type (unicast | local | broadcast | multicast) - matches destination address type of the IP packet, one of the: unicast - IP addresses used for one point to another point transmission. There is only one sender and one receiver in this case local - matches addresses assigned to router's interfaces broadcast - the IP packet is sent from one point to all other points in the IP subnetwork multicast - this type of IP addressing is responsible for transmission from one or more points to a set of ot her points dst-limit (integer/time{0,1},integer,dst-address | dst-port | src-address{+},time{0,1}) - limits the packet per second (pps) rate on a per destination IP or per destination port base. As opposed to the limit match, every destination IP address / destination port has it's own limit. The options are as follows (in order of appearance): Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 68

Count - maximum average packet rate, measured in packets per second (pps), unless followed by Time option Time - specifies the time interval over which the packet rate is measured Burst - number of packets to match in a burst Mode - the classifier(-s) for packet rate limiting Expire - specifies interval after which recorded IP addresses / ports will be deleted dst-port (integer: 0..65535-integer: 0..65535{*}) - destination port number or range hotspot (multiple choice: from-client | auth | local-dst | http) - matches packets received from clients against various Hot-Spot. All values can be negated from-client - true, if a packet comes from HotSpot client auth - true, if a packet comes from authenticted client local-dst - true, if a packet has local destination IP address hotspot - true, if it is a TCP packet from client and either the transparent proxy on port 80 is enabled or the client has a proxy address con figured and this address is equal to the address:port pair of the IP packet icmp-options (integer:integer) - matches ICMP Type:Code fields in-interface (name) - interface the packet has entered the router through ipv4-options (any | loose-source-routing | no-record-route | no-router-alert | no-source-routing | no-timestamp | none | record-route | router-alert | strict-source-routing | timestamp) - match ipv4 header options any - match packet with at least one of the ipv4 options loose-source-routing - match packets with loose source routing option. This option is used to route the internet datagram based on information supplied by the source no-record-route - match packets with no record route option. This option is used to route the internet datagram based on information supplied by the source no-router-alert - match packets with no router alter option no-source-routing - match packets with no source routing option no-timestamp - match packets with no timestamp option record-route - match packets with record route option router-alert - match packets with router alter option strict-source-routing - match packets with strict source routing option timestamp - match packets with timestamp jump-target (forward | input | output | name) - name of the target chain to jump to, if the action=jump is used limit (integer/time{0,1},integer) - restricts packet match rate to a given limit. Usefull to reduce the amount of log messages Count - maximum average packet rate, measured in packets per second (pps), un less followed by Time option Time - specifies the time interval over which the packet rate is measured Burst - number of packets to match in a burst log-prefix (text) - all messages written to logs will contain the prefix specified herein. Used in conju nction with action=log nth (integer,integer: 0..15,integer{0,1}) - match a particular Nth packet received by the rule. One of 16 available counters can be used to count packets Every - match every Every+1th packet. For example, if Every=1 then the rule matches every 2nd packet Counter - specifies which counter to use. A counter increments each time the rule containing nth match matches Packet - match on the given packet number. The value by obvious reasons must be between 0 and Every. If this option is used for a given counter, then there must be at least Every+1 rules with this option, covering all values between 0 and Every inclusively. out-interface (name) - interface the packet will leave the router through p2p (all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | warez | winmx) matches packets from various peer -to-peer (P2P) protocols packet-mark (text) - matches packets marked via mangle facility with particular packet mark packet-size (integer: 0..65535-integer: 0..65535{0,1}) - matches packet of the specified size or size range in bytes Min - specifies lower boundary of the size range or a standalone value Max - specifies upper boundary of the size range phys-in-interface (name) - matches the bridge port physical input device added to a bridge device. It is only useful if the packet has arrived through the bridge phys-out-interface (name) - matches the bridge port physical output device added to a bridge device. It is only useful if the packet will leave the router through the bridge Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 69

protocol (ddp | egp | encap | ggp | gre | hmp | icmp | idrp -cmtp | igmp | ipencap | ipip | ipsec -ah | ipsec-esp | isotp4 | ospf | pup | rdp | rspf | st | tcp | udp | vmtp | xns -idp | xtp | integer) - matches particular IP protocol specified by protocol name or number. You should specify this setting if you want to specify ports psd (integer,time,integer,integer) - attempts to detect TCP and UDP scans. It is advised to assign lower weight to ports with high numbers to reduce the frequency of false positives, such as from passive mode FTP transfers WeightThreshold - total weight of the latest TCP/UDP packets with different destination ports coming from the same host to be treated as port scan sequence DelayThreshold - delay for the packets with different destination ports coming from the same host to be treated as possible port scan subsequence LowPortWeight - weight of the packets with privileged (<=1024) destination port HighPortWeight - weight of the packet with n on-priviliged destination port random (integer: 1..99) - matches packets randomly with given propability reject-with (icmp-admin-prohibited | icmp-echo-reply | icmp-host-prohibited | icmp-host-unreachable | icmpnet-prohibited | icmp-network-unreachable | icmp-port-unreachable | icmp-protocol-unreachable | tcp-reset | integer) - alters the reply packet of reject action routing-mark (name) - matches packets marked by mangle facility with particular routing mark src-address (IP address/netmask | IP address-IP address) - specifies the address range an IP packet is originated from. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24 src-address-list (name) - matches source address of a packet against user-defined address list src-address-type (unicast | local | broadcast | multicast) - matches source address type of the IP packet, one of the: unicast - IP addresses used for one point to another point transmission. There is only one sender and one receiver in this case local - matches addresses assigned to router's interfaces broadcast - the IP packet is sent from one point to all other points in the IP subnetwork multicast - this type of IP addressing is responsible for transmiss ion from one or more points to a set of other points src-mac-address (MAC address) - source MAC address src-port (integer: 0..65535-integer: 0..65535{*}) - source port number or range tcp-flags (ack | cwr | ece | fin | psh | rst | syn | urg) - tcp flags to match ack - acknowledging data cwr - congestion window reduced ece - ECN-echo flag (explicit congestion notification) fin - close connection psh - push function rst - drop connection syn - new connection urg - urgent data tcp-mss (integer: 0..65535) - matches TCP MSS value of an IP packet time (time-time,sat | fri | thu | wed | tue | mon | sun{+}) - allows to create filter based on the packets' arrival time and date or, for locally generated packets, departure time and date tos (max-reliability | max-throughput | min-cost | min-delay | normal) - specifies a match for the value of Type of Service (ToS) field of an IP header max-reliability - maximize reliability (ToS=4) max-throughput - maximize throughput (ToS=8) min-cost - minimize monetary cost (ToS=2) min-delay - minimize delay (ToS=16) normal - normal service (ToS=0)

Notes
Because the NAT rules are applied first, it is important to hold this in mind when setting up firewall rules, since the original packets might be already modified by the NAT

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

70

Filter Applications
Protect your RouterOS router
To protect your router, you should not only change admin's password but also set up packet filtering. All packets with destination to the router are processed against the ip firewall input chai n. Note, that the input chain does not affect packets which are being transferred through the router. / ip firewall filter add chain=input connection -state=invalid action=drop \ comment="Drop Invalid connections" add chain=input connection -state=established action=accept \ comment="Allow Established connections" add chain=input protocol=udp action=accept \ comment="Allow UDP" add chain=input protocol=icmp action=accept \ comment="Allow ICMP" add chain=input src -address=192.168.0.0/24 action=acce pt \ comment="Allow access to router from known network" add chain=input action=drop comment="Drop anything else"

Protecting the Customer's Network


To protect the customer's network, we should check all traffic which goes through router and block unwanted. For icmp, tcp, udp traffic we will create chains, where will be droped all unwanted packets: /ip firewall filter add chain=forward protocol=tcp connection -state=invalid \ action=drop comment="drop invalid connections" add chain=forward connec tion-state=established action=accept \ comment="allow already established connections" add chain=forward connection -state=related action=accept \ comment="allow related connections" Block IP addreses called "bogons": add chain=forward src -address=0.0.0.0/8 action=drop add chain=forward dst -address=0.0.0.0/8 action=drop add chain=forward src -address=127.0.0.0/8 action=drop add chain=forward dst -address=127.0.0.0/8 action=drop add chain=forward src -address=224.0.0.0/3 action=drop add chain=forward dst-address=224.0.0.0/3 action=drop Make jumps to new chains: add chain=forward protocol=tcp action=jump jump -target=tcp add chain=forward protocol=udp action=jump jump -target=udp add chain=forward protocol=icmp action=jump jump -target=icmp Create tcp chain and deny some tcp ports in it: add chain=tcp protocol=tcp dst -port=69 action=drop \ comment="deny TFTP" add chain=tcp protocol=tcp dst -port=111 action=drop \ comment="deny RPC portmapper" add chain=tcp protocol=tcp dst -port=135 action=drop \ comment="deny RPC portmapper" add chain=tcp protocol=tcp dst -port=137-139 action=drop \ comment="deny NBT" add chain=tcp protocol=tcp dst -port=445 action=drop \ comment="deny cifs" Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 71

add chain=tcp add chain=tcp NetBus" add chain=tcp add chain=tcp BackOriffice" add chain=tcp

protocol=tcp dst -port=2049 action=drop comment="deny NFS" protocol=tcp dst -port=12345-12346 action=drop comment="deny protocol=tcp dst -port=20034 action=drop comment="deny NetBus" protocol=tcp dst -port=3133 action=drop comment="den y protocol=tcp dst -port=67-68 action=drop comment="deny DHCP"

Deny udp ports in udp chain: add chain=udp protocol=udp add chain=udp protocol=udp portmapper" add chain=udp protocol=udp portmapper" add chain=udp protocol=udp add chain=udp protocol=udp add chain=udp protocol=udp BackOriffice"

dst -port=69 action=drop comment="deny TFTP" dst -port=111 action=drop comm ent="deny PRC dst -port=135 action=drop comment="deny PRC dst -port=137-139 action=drop comment="deny NBT" dst -port=2049 action=drop comment="deny NFS" dst -port=3133 action=drop comment="deny

Allow only needed icmp codes in icmp chain: add chain=icmp protocol=icmp icmp -options=0:0 action=accept \ comment="drop invalid connections" add chain=icmp protocol=icmp icmp-options=3:0 action=accept \ comment="allow established connections" add chain=icmp protocol=icmp icmp -options=3:1 action=accept \ comment="allow already established connections" add chain=icmp protocol=icmp icmp -options=4:0 action= accept \ comment="allow source quench" add chain=icmp protocol=icmp icmp -options=8:0 action=accept \ comment="allow echo request" add chain=icmp protocol=icmp icmp -options=11:0 action=accept \ comment="allow time exceed" add chain=icmp protocol =icmp icmp-options=12:0 action=accept \ comment="allow parameter bad" add chain=icmp action=drop comment="deny all other types" Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

72

BAB X Graphing
General Information
Summary
Graphing is a tool which is used for monitoring various RouterOS parameters over a period of time.

Specifications
Packages required: system, routerboard(optional) License required: Level1 Submenu level: /tool graphing Hardware usage: Not significant

Description
The Graphing tool can display graphics for: Routerboard health (voltage a nd temperature) Resource usage (CPU, Memory and Disk usage) Traffic which is passed through interfaces Traffic which is passed through simple queues Graphing consists of two parts - first part collects information and other part displays data in a Web page. To access the graphics, type http://[Router_IP_address]/graphs/ and choose a graphic to display in your Web browser. Data from the router is gathered every 5 minutes, but saved on the system drive every store-every time. After rebooting the router, graphing will display information that was last time saved on the disk before the reboot. RouterOS generates four graphics for each item: "Daily" Graph (5 Minute Average) "Weekly" Graph (30 Minute Average) "Monthly" Graph (2 Hour Average) "Yearly" Graph (1 Day Average) To access each graphic from a network, specify this network in allow-address parameter for the respective item.

General Options
Submenu level: /tool graphing

Property Description
store-every (5min | hour | 24hours; default: 5min) - how often to store information on system drive

Example
To store information on system drive every hour: /tool graphing set store -every=hour [admin@MikroTik] tool graphing> print store-every: hour Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 73

[admin@MikroTik] tool graphing>

Health Graphing
Submenu level: /tool graphing health

Description
This submenu provides information about RouterBoard's 'health' - voltage and temperature. For this option, you have to install the routerboard package:

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - network which is allowed to view graphs of router health store-on-disk (yes | no; default: yes) - whether to store information about traffic on system drive or not. If not, the information will be stored in RAM and will be lost after a rebo ot

Interface Graphing
Submenu level: /tool graphing interface

Description
Shows how much traffic is passed through an interface over a period of time.

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - IP address range which is allowed to view information about the interface. If a client PC not belonging to this IP address range tries to open http://[Router_IP_address]/graphs/ , it will not see this entry interface (name; default: all) - name of the interface which will be monitored store-on-disk (yes | no; default: yes) - whether to store information about traffic on system drive or not. If not, the information will be stored in RAM and will be lost after a reboot

Example
To monitor traffic which is passed through inter face ether1 only from local network 192.168.0.0/24, and write information on disk: [admin@MikroTik] tool graphing interface> add interface=ether1 \ \... allow-address=192.168.0.0/24 store -on-disk=yes [admin@MikroTik] tool graphing interface> print Flags: X - disabled # INTERFACE ALLOW -ADDRESS STORE -ON-DISK 0 ether1 192.168.0.0/24 yes [admin@MikroTik] tool graphing interface> Graph for interface ether1:

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

74

Simple Queue Graphing


Submenu level: /tool graphing queue

Description
In this submenu you can specify a queue from the /queue simple list to make a graphic for it.

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - IP address range which is allowed to view information about the queue. If a client PC not belonging to this IP address range tries to open http://[Router_IP_address]/graphs/ , it will not see this entry allow-target (yes | no; default: yes) - whether to allow access to web graphin g from IP range that is specified in /queue simple target-address simple-queue (name; default: all) - name of simple queue which will be monitored store-on-disk (yes | no; default: yes) - whether to store information about traffic on hard drive or not. I f not, the information will be stored in RAM and will be lost after a reboot

Example
Add a simple queue to Grapher list with simple -queue name queue1, allow limited clients to access Grapher from web, store information about traffic on disk: [admin@MikroTik] tool graphing queue> add simple -queue=queue1 allow address=yes \ \... store-on-disk=yes

Resource Graphing
Submenu level: /tool graphing resource

Description
Provides with router resource u sage information over a period of time: CPU usage Memory usage Disk usage

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - IP address range which is allowed to view information about the resource usage. If a client PC not b elonging to this IP address range tries to open http://[Router_IP_address]/graphs/ , it will not see this entry store-on-disk (yes | no; default: yes) - whether to store information about traffic on hard drive or not. If not, the information will be stored in RAM and will be lost after a reboot

Example
Add IP range 192.168.0.0/24 from which users are allowed to monitor Grapher's resource usage: [admin@MikroTik] tool graphing resource> add allow -address=192.168.0.0/24 \ \... store-on-disk=yes [admin@MikroTik] tool graphing resource> print Flags: X - disabled # ALLOW-ADDRESS STORE -ON-DISK 0 192.168.0.0/24 yes [admin@MikroTik] tool graphing resource> Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 75 Referensi : Download :www.mikrotik.com

BAB XI HotSpot Gateway


General Information
Summary
The MikroTik HotSpot Gateway enables provi ding of public network access for clients using wireless or wired network connections. HotSpot Gateway features: authentication of clients using local client database, or RADIUS server accounting using local database, or RADIUS server Walled-garden system (accessing some web pages without authorization)

Quick Setup Guide


The most noticeable difference in user experience setting up HotSpot system in version 2.9 from the previous RouterOS versions is that it has become in order of magnitude easier to set up a correctly working HotSpot system. Given a router with two interfaces: Local (where HotSpot clients are connected to) and Public, which is connected to the Internet. To set up HotSpot on the Local interface: 9. first, a valid IP config is required on both interfaces. This can be done with /setup command. In this example we will assume the configuration with DHCP server on the Local interface 10. valid DNS configuration must be set up in the /ip dns submenu 11. To put HotSpot on the Local interface, using the sam e IP address pool as DHCP server uses for that interface: /ip hotspot add interface=local address -pool=dhcp-pool-1 12. and finally, add at least one HotSpot user: /ip hotspot user add name=admin These simple steps should be sufficient to enable HotSpot syste m Please find many HotSpot How -to's, which will answer most of your questions about configuring a HotSpot gateway, at the end of this manual. It is still recommended that you read and understand all the Description section below before deploying a HotSpot system. If this does not work: check that /ip dns contains valid DNS servers, try to /ping www.mikrotik.com to see, that DNS resolving works make sure that connection tracking is enabled: /ip firewall connection tracking set enabled=yes

Specifications
Packages required: hotspot, dhcp(optional) License required: Level1 (Limited to 1 active user) , Level3 (Limited to 1 active user) , Level4 (Limited to 200 active users) , Level5 (Limited to 500 active users) , Level6 Submenu level: /ip hotspot Standards and Technologies: ICMP, DHCP Hardware usage: Not significant

Description
MikroTik HotSpot Gateway should have at least two network interfaces: 8. HotSpot interface, which is used to connect HotSpot clients Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 76

LAN/WAN interface, which is used to access network resources. For example, DNS and RADIUS server(s) should be accessible The diagram below shows a sample HotSpot setup.

9.

The HotSpot interface should have an IP address assigned to it. Physical network connection has to be established between the HotSpot user's computer and the gateway. It can be wireless (the wireless card should be registered to AP), or wired (the NIC card should be connected to a hub or a switch). Note that the most noticeable difference in user experience setting up HotSpot system in version 2.9 from the previous RouterOS versions is that it has become in order of magnitude easier to set up a correctly working HotSpot system. Introduction to HotSpot HotSpot is a way to authorize users to access some network resources. It does not provide traffic encryption. To log in, users may use almost any web browser (either HT TP or HTTPS protocol), so they are not required to install additional software. The gateway is accounting the uptime and amount of traffic each of its clients have used, and also can send this information to a RADIUS server. The HotSpot system may limit ea ch particular user's bitrate, total amount of traffic, uptime and some other parameters mentioned further in this document. The HotSpot system is targeted to provide authentication within a local network (to access the Internet), but may as well be used to authorize access from outer networks to access local resources. Configuring Walled Garden feature, it is possible to allow users to access some web pages without the need of prior authentication. Getting Address First of all, a client must get an IP addr ess. It may be set on the client statically, or leased from a DHCP server. The DHCP server may provide ways of binding lent IP addresses to clients MAC addresses, if required. The HotSpot system does not care how did a client get an address before he/she g ets to the HotSpot login page. Moreover, HotSpot server may automatically and transparently change any IP address (yes, meaning really any IP address) of a client to a valid unused address from the selected IP pool. This feature gives a possibility to provide a network access (for example, Internet access) to mobile clients that are not willing (or are disallowed, not qualified enough or otherwise unable) to change their networking settings. The users will not notice the translation (i.e., there will not be any changes in the users' config), but the router itself will see completely different (from what is actually set on each client) source IP addresses on packets sent from the clients (even firewall mangle table will 'see' the translated addresses). This t echnique is called one-to-one NAT, but is also known as "Universal Client" as that is how it was called in the RouterOS version 2.8. One-to-one NAT accepts any incoming address from a connected network interface and performs a network address translation so that data may be routed through standard IP networks. Clients may use any preconfigured addresses. If the one-to-one NAT feature is set to translate a client's address to a public IP address, then the client may even run a server or any other service tha t requires a public IP address. This NAT is changing source address of each packet just after it is received by the router (it is like source NAT that is performed earlier, so that even firewall mangle table, which normally 'sees' received packets unaltere d, can only 'see' the translated address). Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 77

Note also that arp mode must be enabled on the interface you use one -to-one NAT on. Before the authentication When enabling HotSpot on an interface, the system automatically sets up everything needed to show logi n page for all clients that are not logged in. This is done by adding dynamic destination NAT rules, which you can observe on a working HotSpot system. These rules are needed to redirect all HTTP and HTTPS requests from unauthorized users to the HotSpot se rvlet (i.e., the authentication procedure, e.g., the login page). Other rules that are also inserted, we will describe later in a special section of this manual. In most common setup, opening any HTTP page will bring up the HotSpot servlet login page (whic h can be customized extensively, as will be described later on). As normal user behavior is to open web pages by their DNS names, a valid DNS configuration should be set up on the HotSpot gateway itself (it is possible to reconfigure the gateway so that it will not require local DNS configuration, but such a configuration is impractical and thus not recommended). Walled Garden You may wish not to require authorization for some services (for example to let clients access the web server of your company without registration), or even to require authorization only to a number of services (for example, for users to be allowed to access an internal file server or another restricted area). This can be done by setting up Walled Garden system. When a not logged-in user requests a service allowed in the Walled Garden configuration, the HotSpot gateway does not intercept it, or in case of HTTP, simply redirects the request to the original destination (or to a specified parent proxy). When a user is logged in, there is no effect of this table on him/her. To implement the Walled Garden feature for HTTP requests, an embedded web proxy server has been designed, so all the requests from not authorized users are really going through this proxy. Note that the embedded proxy server does not have caching function yet. Also note that this embedded proxy server is in the system software package and does not require web-proxy package. It is configurable under /ip proxy Authentication There are currently 5 different authentication methods. You can use one or more of them simultaneously: HTTP PAP - simplest method, which shows the HotSpot login page and expect to get the authentication info (i.e. username and password) in plain text. Note that passwords are not being encrypted when transferred over the network. An another use of this method is the possibility of hard coded authentication information in the servlet's login page simply creating the appropriate link. HTTP CHAP - standard method, which includes CHAP challenge in the logi n page. The CHAP MD5 hash challenge is to be used together with the user's password for computing the string which will be sent to the HotSpot gateway. The hash result (as a password) together with username is sent over network to HotSpot service (so, pass word is never sent in plain text over IP network). On the client side, MD5 algorithm is implemented in JavaScript applet, so if a browser does not support JavaScript (like, for example, Internet Explorer 2.0 or some PDA browsers), it will not be able to au thenticate users. It is possible to allow unencrypted passwords to be accepted by turning on HTTP PAP authentication method, but it is not recommended (because of security considerations) to use that feature. HTTPS - the same as HTTP PAP, but using SSL pr otocol for encrypting transmissions. HotSpot user just send his/her password without additional hashing (note that there is no need to worry about plain text password exposure over the network, as the transmission itself is encrypted). In either case, HTTP POST method (if not possible, then - HTTP GET method) is used to send data to the HotSpot gateway. HTTP cookie - after each successful login, a cookie is sent to web browser and the same cookie is added to active HTTP cookie list. Next time the same user will try to log in, web browser will send http cookie. This cookie will be compared with the one stored on the HotSpot gateway and only if source MAC address and randomly generated ID match the ones stored on the gateway, user will be automatically logged in using the login information (username and password pair) was used when the cookie was first generated. Otherwise, the user will be prompted to log in, and in the case authentication is successful, old cookie will be removed from the local HotSpot activ e cookie list and the new one with different random ID and expiration time will be added to the list and sent to the web browser. It is also possible to erase cookie on user manual logoff (not in the default server pages). This method may only be used toge ther with HTTP PAP, HTTP CHAP or HTTPS methods as there would be nothing to generate cookies in the first place otherwise. MAC address - try to authenticate clients as soon as they appear in the hosts list (i.e., as soon as they have sent any packet to the HotSpot server), using client's MAC address as username HotSpot can authenticate users consulting the local user database or a RADIUS server (local database is consulted first, then - a RADIUS server). In case of HTTP cookie authentication via RADIUS se rver, the router Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 78

will send the same information to the server as was used when the cookie was first generated. If authentication is done locally, profile corresponding to that user is used, otherwise (in case RADIUS reply did not contain the group for that user) the default profile is used to set default values for parameters, which are not set in RADIUS access-accept message. For more information on how the interaction with a RADIUS server works, see the respective manual section. The HTTP PAP method also makes it possible to authenticate by requesting the page /login?username=username&password=password . In case you want to log in using telnet connection, the exact HTTP request would look like that: GET /login?username=username&password=password HTTP/1.0 (note that the request is case-sensitive) Authorization After authentication, user gets access to the Internet, and receives some limitations (which are user profile specific). HotSpot may also perform a one -to-one NAT for the client, so that a particular user would always receive the same IP address regardless of what PC is he/she working at. The system will automatically detect and redirect requests to a proxy server a client is using (if any; it may be set in his/her settings to use an unknown to us prox y server) to the proxy server embedded in the router. Authorization may be delegated to a RADIUS server, which delivers similar configuration options as the local database. For any user requiring authorization, a RADIUS server gets queried first, and if no reply received, the local database is examined. RADIUS server may send a Change of Authorization request according to standards to alter the previously accepted parameters. Advertisement The same proxy used for unauthorized clients to provide Walled -Garden facility, may also be used for authorized users to show them advertisement popups. Transparent proxy for authorized users allows to monitor http requests of the clients and to take some action if required. It enables the possibility to open status page even if client is logged in by mac address, as well as to show advertisements time after time When time has come to show an advertisement, the server redirects client's web browser to the status page. Only requests, which provide html content, are redirect ed (images and other content will not be affected). The status page displays the advertisement and next advertise -interval is used to schedule next advertisement. If status page is unable to display an advertisement for configured timeout starting from mom ent, when it is scheduled to be shown, client access is blocked within walled -garden (as unauthorized clients are). Client is unblocked when the scheduled page is finally shown. Note that if popup windows are blocked in the browser, the link on the status page may be used to open the advertisement manually. While client is blocked, FTP and other services will not be allowed. Thus requiring client to open an advertisement for any Internet activity not especially allowed by the Walled -Garden. Accounting The HotSpot system implement accounting internally, you are not required to do anything special for it to work. The accounting information for each user may be sent to a RADIUS server. Configuration menus /ip hotspot - HotSpot servers on particular interfaces (one server per interface). HotSpot server must be added in this menu in order for HotSpot system to work on an interface /ip hotspot profile - HotSpot server profiles. Settings, which affect login procedure for HotSpot clients are configured here. More than one HotSpot servers may use the same profile /ip hotspot host - dynamic list of active network hosts on all HotSpot interfaces. Here you can also find IP address bindings of the one -to-one NAT /ip hotspot ip-binding - rules for binding IP addresses to hosts on hotspot interfaces /ip hotspot service-port - address translation helpers for the one -to-one NAT /ip hotspot walled-garden - Walled Garden rules at HTTP level (DNS names, HTTP request substrings) /ip hotspot walled-garden ip - Walled Garden rules at IP level (IP addresses, IP protocols) /ip hotspot user - local HotSpot system users /ip hotspot user profile - local HotSpot system users profiles (user groups) /ip hotspot active - dynamic list of all authenticated HotSpot users /ip hotspot cookie - dynamic list of all valid HTTP cookies

Question&Answer-Based Setup
Command name: /ip hotspot setup Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 79

Questions
address pool of network (name) - IP address pool for the HotSpot network dns name (text) - DNS domain name of the HotSpot gateway (will be statically configured on the local DNS proxy dns servers (IP address,[IP address]) - DNS servers for HotSpot clients hotspot interface (name) - interface to run HotSpot on ip address of smtp server (IP address; default: 0.0.0.0) - IP address of the SMTP server to redirect SMTP requests (TCP port 25) to 0.0.0.0 - no redirect local address of network (IP address; default: 10.5.50.1/24) - HotSpot gateway address for the interface masquerade network (yes | no; default: yes) - whether to masquerade the HotSpot network name of local hotspot user (text; default: admin) - username of one automatically created user passphrase (text) - the passphrase of the certificate you are importing password for the user (text) - password for the automatically created user select certificate (name | none import-other-certificate) - choose SSL certificate from the list of the imported certificates none - do not use SSL import-other-certificate - setup the certificates not imported yet, and ask this question again

Notes
Depending on current settings and answers to the previous questions, default values of following questions may be different. Some questions may disappear if they become redundant

Example
To configure HotSpot on ether1 interface (which is already conf igured with address of 192.0.2.1/25), and adding user admin with password rubbish: [admin@MikroTik] > ip hotspot setup hotspot interface: ether1 local address of network: 192.0.2.1/24 masquerade network: yes address pool of network: 192.0.2.2 -192.0.2.126 select certificate: none ip address of smtp server: 0.0.0.0 dns servers: 192.0.2.254 dns name: hs.example.net name of local hotspot user: admin password for the user: rubbish [admin@MikroTik] >

HotSpot Interface Setup


Submenu level: /ip hotspot

Description
HotSpot system is put on individual interfaces. You can run completely different HotSpot configurations on different interfaces

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

80

Property Description
addresses-per-mac (integer | unlimited; default: 2) - number of IP addresses allowed to be bind w ith any particular MAC address (it is a small chance to reduce denial of service attack based on taking over all free IP addresses) unlimited - number of IP addresses per one MAC address is not limited address-pool (name | none; default: none) - IP address pool name for performing one -to-one NAT. You can choose not to use the one-to-one NAT none - do not perform one-to-one NAT for the clients of this HotSpot interface HTTPS (read-only: flag) - whether the HTTPS service is actually running on the interfa ce (i.e., it is set up in the server profile, and a valid certificate is imported in the router) idle-timeout (time | none; default: 00:05:00) - idle timeout (maximal period of inactivity) for unauthorized clients. It is used to detect, that client is not using outer networks (e.g. Internet), i.e., there is NO TRAFFIC coming from that client and going through the router. Reaching the timeout, user will be dropped of the host list, and the address used buy the user will be freed none - do not timeout idle users interface (name) - interface to run HotSpot on ip-of-dns-name (read-only: IP address) - IP address of the HotSpot gateway's DNS name set in the HotSpot interface profile keepalive-timeout (time | none; default: none) - keepalive timeout for unauth orized clients. Used to detect, that the computer of the client is alive and reachable. If check will fail during this period, user will be dropped of the host list, and the address used buy the user will be freed none - do not timeout unreachable users profile (name; default: default) - default HotSpot profile for the interface

Command Description
reset-html (name) - overwrite the existing HotSpot servlet with the original HTML files. It is used if you have changed the servlet and it is not working aft er that

Notes
addresses-per-mac property works only if address pool is defined. Also note that in case you are authenticating users connected through a router, than all the IP addresses will seem to have come from one MAC address.

Example
To add HotSpot system to the local interface, allowing the system to do one -to-one NAT for each client (addresses from the HS-real address pool will be used for the NAT): [admin@MikroTik] ip hotspot> add interface=local address -pool=HS-real [admin@MikroTik] ip hotspot> print Flags: X - disabled, I - invalid, S - HTTPS # NAME INTERFACE ADDRESS -POOL PROFILE IDLETIMEOUT 0 hs-local local HS -real default 00:05:00 [admin@MikroTik] ip hotspot>

HotSpot Server Profiles


Submenu level: /ip hotspot profile

Property Description
dns-name (text) - DNS name of the HotSpot server. This is the DNS name used as the name of the HotSpot server (i.e., it appears as the location of the login page). This name will automatically be added as a static DNS entry in the DNS cache Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 81 Referensi : Download :www.mikrotik.com

hotspot-address (IP address; default: 0.0.0.0) - IP address for HotSpot service html-directory (text; default: "") - name of the directory (accessible with FTP), which stores the HTML servlet pages (when changed, the default pages are automatically copied into specified directory if it does not exist already) http-cookie-lifetime (time; default: 3d) - validity time of HTTP cookies http-proxy (IP address; default: 0.0.0.0) - the address of the proxy server the HotSpot service will use as a proxy server for all those requests intercepted by Universal Proxy system and not defined in the /ip proxy direct list. If not specified, the address defined in parent-proxy parameter of /ip proxy. If that is absent too, the request will be resolved by the local proxy login-by (multiple choice: cookie | http-chap | http-pap | https | mac | trial; default: cookie,http-chap) - which authentication methods to use cookie - use HTTP cookies to authenticate, without asking use r credentials. Other method will be used in case the client does not have cookie, or the stored username and password pair are not valid anymore since the last authentication. May only be used together with other HTTP authentication methods (HTTP -PAP, HTTP-CHAP or HTTPS), as in the other case there would be no way for the cookies to be generated in the first place http-chap - use CHAP challenge-response method with MD5 hashing algorithm for hashing passwords. This way it is possible to avoid sending clear -text passwords over an insecure network. This is the default authentication method http-pap - use plain-text authentication over the network. Please note that in case this method will be used, your user passwords will be exposed on the local networks, so it will be possible to intercept them https - use encrypted SSL tunnel to transfer user communications with the HotSpot server. Note that in order this to work, a valid certificate must be imported into the router (see a separate manual on certificate management) mac - try to use client's MAC address first as its username. If the matching MAC address exists in the local user database or on the RADIUS server, the client will be authenticated without asking to fill the login form trial - does not require authentication for a certain amount of time radius-accounting (yes | no; default: yes) - whether to send RADIUS server accounting information on each user once in a while (the "while" is defined in the radius-interim-update property) radius-default-domain (text; default: "") - default domain to use for RADIUS requests. It allows to select different RADIUS servers depending on HotSpot server profile, but may be handful for single RADIUS server as well. radius-interim-update (time | received; default: received) - how often to sent cumulative accounting reports. 0s - same as received received - use whatever value received from the RADIUS server rate-limit (text; default: "") - Rate limitation in form of rx-rate[/tx-rate] [rx-burst-rate[/tx-burst-rate] [rxburst-threshold[/tx-burst-threshold] [rx-burst-time[/tx-burst-time]]]] from the point of view of the router (so "rx" is client upload, and "tx" is client download). All rates should be numbers with optional 'k' (1,000s) or 'M' (1,000,000s). If tx-rate is not specified, rx-rate is as tx-rate too. Same goes for tx-burst-rate and tx-burstthreshold and tx-burst-time. If both rx-burst-threshold and tx-burst-threshold are not specified (but burst -rate is specified), rx-rate and tx-rate is used as burst thresholds. If both rx-burst-time and tx-burst-time are not specified, 1s is used as default smtp-server (IP address; default: 0.0.0.0) - default SMTP server to be used to redirect unconditionally all user SMTP requests to split-user-domain (yes | no; default: no) - whether to split username from domain name when the username is given in "user@domain" or in "domain \user" format ssl-certificate (name | none; default: none) - name of the SSL certificate to use for HTTPS authentication. Not used for other authentication methods trial-uptime (time/time; default: 30m/1d) - is used only when authentication method is trial. Specifies the amount of time the user identified by MAC address can use hotspot services without authentication and the time, that has to pass that the user is allowed to use hotspot services again trial-user-profile (name; default: default) - is used only only when authentication method is trial. Specifies user profile, that trial users will use use-radius (yes | no; default: no) - whether to use RADIUS to authenticate HotSpot users

Notes

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

82

If dns-name property is not specified, hotspot-address is used instead. If hotspot-address is also absent, then both are to be detected automatically. In order to use RADIUS authentication, the /radius menu must be set up accordingly. Trial authentication method should allways be used together with one of the other authentication methods.

Example

HotSpot User Profiles


Submenu level: /ip hotspot user profile

Description
Article moved to: HotSpot AAA section

HotSpot Users
Submenu level: /ip hotspot user

Description
Article moved to: HotSpot AAA section

HotSpot Active Users


Submenu level: /ip hotspot active

Description
Article moved to: HotSpot AAA section

HotSpot Cookies
Submenu level: /ip hotspot cookie

Description
Cookies can be used for authentication in the Hotspot service

Property Description
domain (read-only: text) - domain name (if split from username) expires-in (read-only: time) - how long the cookie is valid mac-address (read-only: MAC address) - user's MAC address user (read-only: name) - username

Notes
There can be multiple cookies with the same MAC address. For example , there will be a separate cookie for each web browser on the same computer. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

83

Cookies can expire - that's the way how it is supposed to be. Default validity time for cookies is 3 days (72 hours), but it can be changed for each individual HotSpot server prof ile, for example : /ip hotspot profile set default http -cookie-lifetime=1d

Example
To get the list of valid cookies: [admin@MikroTik] ip hotspot cookie> print # USER DOMAIN MAC -ADDRESS EXPIRES -IN 0 ex 01:23:45:67:89:AB 23h54m16s [admin@MikroTik] ip hotspot cookie>

HTTP-level Walled Garden


Submenu level: /ip hotspot walled-garden

Description
Walled garden is a system which allows unauthorized use of some resources, but requires au thorization to access other resources. This is useful, for example, to give access to some general information about HotSpot service provider or billing options. This menu only manages Walled Garden for HTTP and HTTPS protocols. Other protocols can also be included in Walled Garden, but that is configured elsewhere (in /ip hotspot walled-garden ip; see the next section of this manual for details)

Property Description
action (allow | deny; default: allow) - action to undertake if a packet matches the rule: allow - allow the access to the page without prior authorization deny - the authorization is required to access this page dst-address (IP address) - IP address of the destination web server dst-host (wildcard; default: "") - domain name of the destinat ion web server (this is a wildcard) dst-port (integer; default: "") - the TCP port a client has send the request to method (text) - HTTP method of the request path (text; default: "") - the path of the request (this is a wildcard) server (name) - name of the HotSpot server this rule applied to src-address (IP address) - IP address of the user sending the request

Notes
Wildcard properties (dst-host and dst-path) match a complete string (i.e., they will not match "example.com" if they are set to "example"). Available wildcards are '*' (match any number of any characters) and '?' (match any one character). Regular expressions are also accepted here, but if the property should be treated as a regular expression, it should start with a colon (':'). Small hits in using regular expressions: \\ symbol sequence is used to enter \ character in console \. pattern means . only (in regular expressions single dot in pattern means any symbol) to show that no symbols are allowed before the given pattern, we use ^ symbol at the beginning of the pattern to specify that no symbols are allowed after the given pattern, we use $ symbol at the end of the pattern You can not use path property for HTTPS requests as router can not (and should not - that is what the HTTPS protocol was made for!) decrypt the request. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 84

Example
To allow unauthorized requests to the www.example.com domain's /paynow.html page: [admin@MikroTik] ip hotspot walled -garden> add path="/paynow.html" \ \... dst-host="www.example.com" [admin@MikroTik] ip hotspot walled-garden> print Flags: X - disabled, D - dynamic 0 dst-host="www.example.com" path="/paynow.html" action=allow [admin@MikroTik] ip hotspot walled -garden>

IP-level Walled Garden


Submenu level: /ip hotspot walled-garden ip

Description
This menu is manages Walled Garden for generic IP requests. See the previous section for managing HTTP and HTTPS protocol specific properties (like the actual DNS name, HTTP method and path used in requests).

Property Description
action (accept | drop | reject; default: accept) - action to undertake if a packet matches the rule: accept - allow the access to the page without prior authorization drop - the authorization is required to access this page reject - the authorization is required to access this page, in case the page will be accsessed withot authorization ICMP reject message host-unreachable will be generated dst-address (IP address) - IP address of the destination web server dst-host (text; default: "") - domain name of the destination web se rver (this is not a regular expression or a wildcard of any kind). The DNS name specified is resolved to a list of IP addresses when the rule is added, and all those IP addresses are used dst-port (integer; default: "") - the TCP or UDP port (protocol MUST be specified explicitly in the protocol property) a client has send the request to protocol (integer | ddp egp encap ggp gre hmp icmp idpr -cmtp igmp ipencap ipip ipsec -ah ipsec-esp iso-tp4 ospf pup rdp rspf st tcp udp vmtp xns -idp xtp) - IP protocol name server (name) - name of the HotSpot server this rule applied to src-address (IP address) - IP address of the user sending the request

Example

One-to-one NAT static address bindings


Submenu level: /ip hotspot ip-binding

Description
You can setup NAT translations statically based on either the original IP address (or IP network), or the original MAC address. You can also allow some addresses to bypass HotSpot authentication (i.e., they will be able work without having to log in to the network first) a nd completely block some addresses.

Property Description
address (IP address / [netmask]; default: "") - the original IP address or network of the client mac-address (MAC address; default: "") - the source MAC address of the client server (name|all; default: all) - the name of the server the client is connecting to Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

85

to-address (IP address; default: "") - IP address to translate the original client address to. If address property is given as network, this is the starting address for the translation (i.e., the first address is translated to to-address, address + 1 to to-address + 1, and so on) type (regular | bypassed | blocked) - type of the static binding entry regular - perform a one-to-one NAT translation according to the values set in this entry bypassed - perform the translation, but exclude the client from having to log in to the HotSpot system blocked - the translation will not be preformed, and all packets from the host will be dropped

Notes
This is an ordered list, so you can put more specif ic entries on the top of the list for them to override the more common that appear lower.

Active Host List


Submenu level: /ip hotspot host

Description
This menu shows all active network hosts that are connected to the HotSpot gateway. This list includes all oneto-one NAT translations

Property Description
address (read-only: IP address) - the original IP address of the client authorized (read-only: flag) - whether the client is successfully authenticated by the HotSpot system blocked (read-only: flag) - true, if access is blocked within walled -garden because of expired advertisement timeout bridge-port (read-only: name) - the actual physical interface, which the host is connected to. This is used when HotSpot service is put on a bridge interface to det ermine the host's actual port within the bridge. bypass-hotspot (read-only: flag) - whether the client does not need to be authorized by the HotSpot system bytes-in (read-only: integer) - how many bytes did the router receive from the client bytes-out (read-only: integer) - how many bytes did the router send to the client host-dead-time (read-only: time) - how long has the router not received any packets (including ARP replies, keepalive replies and user traffic) from this host idle-time (read-only: time) - the amount of time has the user been idle idle-timeout (read-only: time) - the exact value of idle-timeout that applies to this user. This property shows how long should the user stay idle for it to be logged off automatically keepalive-timeout (read-only: time) - the exact value of keepalive-timeout that applies to this user. This property shows how long should the user's computer stay out of reach for it to be logged off automatically mac-address (read-only: MAC address) - the actual MAC address of the user packets-in (read-only: integer) - how many packets did the router receive from the client packets-out (read-only: integer) - how many packets did the router send to the client server (read-only: name) - name of the server, which the host is connected to static (read-only: flag) - whether this translation has been taken from the static IP binding list to-address (read-only: IP address) - what address is the original IP address of the host translated to uptime (read-only: time) - current session time of the user (i.e., how long has the user been in the active host list)

Command Description
make-binding - copy a dynamic entry from this list to the static IP bindings list Input Parameters unnamed (name) - item number

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

86

comment (text) - custom comment to the static entry to be created type (regular | bypassed | blocked) - the type of the static entry

Service Port
Submenu level: /ip hotspot service-port

Description
Just like for classic NAT, the HotSpot embedded one -to-one NAT 'breaks' some protocols that are incompatible with address translation. To leave these protocols consistent, helper modules must be used. For the one -to-one NAT the only such a module is for FTP protocol.

Property Description
name (read-only: name) - protocol name ports (read-only: integer) - list of the ports on which the protocol is working

Example
To set the FTP protocol uses both 20 and 21 TCP port: [admin@MikroTik] ip hotspot service -port> print Flags: X - disabled # NAME PORTS 0 ftp 21 [admin@MikroTik] ip hotspot service -port> set ftp ports=20,21 [admin@MikroTik] ip hotspot service -port> print Flags: X - disabled # NAME PORTS 0 ftp 20 21 [admin@MikroTik] ip hotspot service -port>

Customizing HotSpot: Firewall Section


Description
Apart from the obvious dynamic entries in the /ip hotspot submenu itself (like hosts and active users), some additional rules are added in the firewall tables when activating a HotSpot service . Unlike RouterOS version 2.8, there are relatively few firewall rules added in the firewall as the main job is made by the one -to-one NAT algorithm. NAT rules From /ip firewall nat print dynamic command, you can get something like this (comments follow a fter each of the rules): 0 D chain=dstnat hotspot=from -client action=jump jump -target=hotspot Putting all HotSpot-related tasks for packets from all HotSpot clients into a separate chain 1 D chain=hotspot protocol=udp dst -port=53 action=redirect to-ports=64872 2 D chain=hotspot protocol=tcp dst -port=53 action=redirect to -ports=64872 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 87

Redirect all DNS requests to the HotSpot service. The 64872 port provides DNS service for all HotSpot users. If you want HotSpot server to listen also to an other port, add rules here the same way, changing dst-port property 3 D chain=hotspot protocol=tcp dst -port=80 hotspot=local -dst action=redirect to-ports=64873 Redirect all HTTP login requests to the HTTP login servlet. The 64873 is HotSpot HTTP servlet port. 4 D chain=hotspot protocol=tcp dst -port=443 hotspot=local -dst action=redirect to-ports=64875 Redirect all HTTPS login requests to the HTTPS login servlet. The 64875 is HotSpot HTTPS servlet port. 5 D chain=hotspot protoco l=tcp action=jump hotspot=!auth jump -target=hsunauth All other packets except DNS and login requests from unauthorized clients should pass through the hs-unauth chain 6 D chain=hotspot protocol=tcp action=jump hotspot=auth jump -target=hsauth And packets from the authorized clients - through the hs-auth chain 7 D ;;; www.mikrotik.com chain=hs-unauth dst-address=159.148.147.196 protocol=tcp dst -port=80 action=return First in the hs-unauth chain is put everything that a ffects TCP protocol in the /ip hotspot walled-garden ip submenu (i.e., everything where either protocol is not set, or set to TCP). Here we are excluding www.mikrotik.com from being redirected to the login page. 8 D chain=hs-unauth protocol=tcp dst -port=80 action=redirect to ports=64874 All other HTTP requests are redirected to the Walled Garden proxy server which listens the 64874 port. If there is an allow entry in the /ip hotspot walled-garden menu for an HTTP request, it is being forwarded to the destination. Otherwise, the request will be automatically redirected to the HotSpot login servlet (port 64873). 9 D chain=hs-unauth protocol=tcp dst -port=3128 action=redirect to ports=64874 10 D chain=hs-unauth protocol=tcp dst -port=8080 action=redire ct toports=64874 HotSpot by default assumes that only these ports may be used for HTTP proxy requests. These two entries are used to "catch" client requests to unknown proxies. I.e., to make it possible for the clients with unknown proxy settings to work with the HotSpot system. This feature is called "Universal Proxy". If it is detected that a client is using some proxy server, the system will automatically mark that packets with the http hotspot mark to work around the unknown proxy problem, as we will see later on. Note that the port used (64874) is the same as for HTTP requests in the rule #8 (so both HTTP and HTTP proxy requests are processed by the same code). 11 D chain=hs-unauth protocol=tcp dst -port=443 action=redirect to ports=64875 HTTPS proxy is listening on the 64875 port 12 D chain=hs-unauth protocol=tcp dst -port=25 action=jump jump -target=hssmtp Redirect for SMTP protocol may also be defined in the HotSpot configuration. In case it is, a redirect rule will be put in the hs-smtp chain. This is done so that users with unknown SMTP configuration would be able to send their mail through the service provider's (your) SMTP server instead of going to [possibly unavailable outside their network of origin] the SMTP server use rs have configured in their computers. 13 D chain=hs-auth protocol=tcp hotspot=http action=redirect to -ports=64874 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 88

Providing HTTP proxy service for authorized users. Authenticated user requests may need to be subject to the transparent proxying (the "Universal Proxy" technique and for the advertisement feature). This http mark is put automatically on the HTTP proxy requests to the servers detected by the HotSpot HTTP proxy (the one that is listening on the 64874 port) to be HTTP proxy requests to u nknown proxy servers. This is done so that users that have some proxy settings would use the HotSpot gateway instead of the [possibly unavailable outside their network of origin] proxy server users have configured in their computers. The mark is as well pu t on any HTTP requests done form the users whoose profile is configured to transparently proxy their requests. 14 D chain=hs-auth protocol=tcp dst -port=25 action=jump jump -target=hs-smtp Providing SMTP proxy for authorized users (the same as in ru le #12) Packet filter rules From /ip firewall filter print dynamic command, you can get something like this (comments follow after each of the rules): 0 D chain=forward hotspot=from -client,!auth action=jump jump -target=hsunauth Any packet that traverse the router from unauthorized client will be sent to the hs-unauth chain. The hs-unauth implements the IP-based Walled Garden filter. 1 D chain=forward hotspot=to -client,!auth action=jump jump -target=hsunauth-to Everything that comes to clients through the router, gets redirected to another chain, called hs-unauth-to. This chain should reject unauthorized requests to the clients 2 D chain=input hotspot=from -client action=jump jump -target=hs-input Everything that comes from clien ts to the router itself, gets to another chain, called hs-input. 3 D chain=hs-input protocol=udp dst -port=64872 action=accept 4 D chain=hs-input protocol=tcp dst -port=64872-64875 action=accept Allow client access to the local authentication and proxy services (as described earlier) 5 D chain=hs-input hotspot=!auth action=jump jump -target=hs-unauth All other traffic from unauthorized clients to the router itself will be treated the same way as the traffic traversing the routers 6 D chain=hs-unauth protocol=icmp action=return 7 D ;;; www.mikrotik.com chain=hs-unauth dst-address=159.148.147.196 protocol=tcp dst -port=80 action=return Unlike NAT table where only TCP -protocol related Walled Garden entries were added, in th e packet filter hsunauth chain is added everything you have set in the /ip hotspot walled-garden ip menu. That is why although you have seen only one entry in the NAT table, there are two rules here. 8 D chain=hs-unauth protocol=tcp action=reject reject -with=tcp-reset 9 D chain=hs-unauth action=reject reject -with=icmp-net-prohibited Everything else that has not been while -listed by the Walled Garden will be rejected. Note usage of TCP Reset for rejecting TCP connections. 10 D chain=hs-unauth-to action=reject reject -with=icmp-host-prohibited Reject all packets to the clients with ICMP reject message

Customizing HotSpot: HTTP Servlet Pages

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

89

Description
You can create a completely different set of servlet pages for each HotSpot server y ou have, specifying the directory it will be stored in html-directory property of a HotSpot server profile ( /ip hotspot profile). The default servlet pages are copied in the directory of your choice right after you create the profile. This directory can be accessed by connecting to the router with an FTP client. You can modify the pages as you like using the information from this section of the manual. Available Servlet Pages Main HTML servlet pages, which are shown to user: redirect.html - redirects user to another url (for example, to login page) login.html - login page shown to a user to ask for username and password. This page may take the following parameters: username - username password - either plain-text password (in case of PAP authentication) or MD5 hash of chapid variable, password and CHAP challenge (in case of CHAP authentication) dst - original URL requested before the redirect. This will be opened on successfull login popup - whether to pop-up a status window on successfull login radius<id> - send the attribute identified with <id> in text string form to the RADIUS server (in case RADIUS authentication is used; lost otherwise) radius<id>u - send the attribute identified with <id> in unsigned form to the RADIUS server (in case RADIUS authentication is used; lost otherwise) radius<id>-<vnd-id> - send the attribute identified with <id> and vendor ID <vnd -id> in text string form to the RADIUS server (in case RADIUS authentication is used; lost otherwise) radius<id>-<vnd-id>u - send the attribute identified with <id> and vendor ID <vnd -id> in unsigned form to the RADIUS server (in case RADIUS authentication is used; lost otherwise) md5.js - JavaScript for MD5 password hashing. Used together with http-chap login method alogin.html - page shown after client has logged in. It pops -up status page and redirects browser to originally requested page (before he/she was redirected to the HotSpot login page) status.html - status page, shows statistics for the client logout.html - logout page, shown after user is logged out. Shows final statistics about the finished session. This page may take the folllowing additional parameters: erase-cookie - whether to erase cookies from the HotSpot server on logout (makes impossible to log in with cookie next time from the same browser, might be useful in multiuser environments) error.html - error page, shown on fatal errors only Some other pages are available as well, if more control is needed: rlogin.html - page, which redirects client from some other URL t o the login page, if authorization of the client is required to access that URL rstatus.html - similarly to rlogin.html, only in case if the client is already logged in and the original URL is not known flogin.html - shown instead of login.html, if some error has happened (invalid username or password, for example) fstatus.html - shown instead of redirect, if status page is requested, but client is not logged in flogout.html - shown instead of redirect, if logout page is requested, but client is not log ged in Serving Servlet Pages The HotSpot servlet recognizes 5 different request types: 7. request for a remote host if user is logged in, the requested page is served if user is not logged in, but the destination host is allowed by walled garden, then the request is also served if user is not logged in, and the destination host is disallowed by walled garden, rlogin.html is displayed; if rlogin.html is not found, redirect.html is used to redirect to the login page 8. request for "/" on the HotSpot host if user is logged in, rstatus.html is displayed; if rstatus.html is not found, redirect.html is used to redirect to the status page if user is not logged in, rlogin.html is displayed; if rlogin.html is not found, redirect.html is used to redirect to the logi n page Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 90 Referensi : Download :www.mikrotik.com

request for "/login" page if user has successfully logged in (or is already logged in), alogin.html is displayed; if alogin.html is not found, redirect.html is used to redirect to the originally requested page or the status page (in case, original destination page was not given) if user is not logged in (username was not supplied, no error message appeared), login.html is showed if login procedure has failed (error message is supplied), flogin.html is displayed; if flogin.html is not found, login.html is used in case of fatal errors, error.html is showed 10. request for "/status" page if user is logged in, status.html is displayed if user is not logged in, fstatus.html is displayed; if fstatus.html is not found, redirect.html is used to redirect to the login page 11. request for '/logout' page if user is logged in, logout.html is displayed if user is not logged in, flogout.html is displayed; if flogout.html is not found, redirect.html is used to redirect to the login page Note that if it is not possible to meet a request using the pages stored on the router's FTP server, Error 404 is displayed There are many possibilities to customize what the HotSpot authentication pages look like: The pages are easily modifiable. They are stored on the router's FT P server in the directory you choose for the respective HotSpot server profile. By changing the variables, which client sends to the HotSpot servlet, it is possible to reduce keyword count to one (username or password; for example, the client's MAC addres s may be used as the other value) or even to zero (License Agreement; some predefined values general for all users or client's MAC address may be used as username and password) Registration may occur on a different server (for example, on a server that is able to charge Credit Cards). Client's MAC address may be passed to it, so that this information need not be written in manually. After the registration, the server may change RADIUS database enabling client to log in for some amount of time. To insert variable in some place in HTML file, the $(var_name) syntax is used, where the "var_name" is the name of the variable (without quotes). This construction may be used in any HotSpot HTML file accessed as '/', '/login', '/status' or '/logout', as well as any text or HTML file stored on the HotSpot server. For example, to show a link to the login page, following construction can be used: <a href="$(link-login)">login</a> Variables All of the Servlet HTML pages use variables to show user specific values. Variab le names appear only in the HTML source of the servlet pages - they are automatically replaced with the respective values by the HotSpot Servlet. For each variable there is an example of its possible value included in brackets. All the described variables are valid in all servlet pages, but some of them just might be empty at the time they are accesses (for example, there is no uptime before a user has logged in). Common server variables: hostname - DNS name or IP address (if DNS name is not given) of the HotSpot Servlet ("hotspot.example.net") identity - RouterOS identity name ("MikroTik") login-by - authentication method used by user plain-passwd - a "yes/no" representation of whether HTTP -PAP login method is allowed ("no") server-address - HotSpot server address ("10.5.50.1:80") server-name - name of hotspot server ssl-login - a "yes/no" representation of whether HTTPS method was used to access that servlet page ("no") server-name - HotSpot server name (set in the /ip hotspot menu, as the name property) interface-name - physical HotSpot interface name (in case of bridged interfaces, this will return the actual bridge port name) Links: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 91

9.

link-login - link to login page including original URL requested ("http://10.5.50.1/login?dst=http://www.example .com/") link-login-plain - link to login page, not including original URL requested ("http://10.5.50.1/login") link-logout - link to logout page ("http://10.5.50.1/logout") link-status - link to status page ("http://10.5.50.1/status") link-orig - original URL requested ("http://www.example.com/") General client information domain - domain name of the user ("mt.lv") interface-name - name of the physical interface, on which client is connected (in case of bridge, it will contain the name of bridge port ) ip - IP address of the client ("10.5.50.2") logged-in - "yes" if the user is logged in, otherwise - "no" ("yes") mac - MAC address of the user ("01:23:45:67:89:AB") trial - a "yes/no" representation of whether the user has access to trial time. If us ers trial time has expired, the value is "no" username - the name of the user ("John") User status information: idle-timeout - idle timeout ("20m" or "" if none) idle-timeout-secs - idle timeout in seconds ("88" or "0" if there is such timeout) limit-bytes-in - byte limit for send ("1000000" or " ---" if there is no limit) limit-bytes-out - byte limit for receive ("1000000" or " ---" if there is no limit) refresh-timeout - status page refresh timeout ("1m30s" or "" if none) refresh-timeout-secs - status page refresh timeout in seconds ("90s" or "0" if none) session-timeout - session time left for the user ("5h" or "" if none) session-timeout-secs - session time left for the user, in seconds ("3475" or "0" if there is such timeout) session-time-left - session time left for the user ("5h" or "" if none) session-time-left-secs - session time left for the user, in seconds ("3475" or "0" if there is such timeout) uptime - current session uptime ("10h2m33s") uptime-secs - current session uptime in secon ds ("125") Traffic counters, which are available only in status page: bytes-in - number of bytes received from the user ("15423") bytes-in-nice - user-friendly form of number of bytes received from the user ("15423") bytes-out - number of bytes sent to the user ("11352") bytes-out-nice - user-friendly form of number of bytes sent to the user ("11352") packets-in - number of packets received from the user ("251") packets-out - number of packets sent to the user ("211") remain-bytes-in - remaining bytes until limit-bytes-in will be reached ("337465" or " ---" if there is no limit) remain-bytes-out - remaining bytes until limit-bytes-out will be reached ("124455" or " ---" if there is no limit) Miscellaneous variables session-id - value of 'session-id' parameter in the last request var - value of 'var' parameter in the last request error - error message, if something failed ("invalid username or password") error-orig - original error message (without translations retrieved from errors.txt), if something failed ("invalid username or password") chap-id - value of chap ID ("\371") chap-challenge - value of chap challenge ("\357\015\330\013\021\234\145\245\303\253\142\246\133\175\375\316") popup - whether to pop-up checkbox ("true" or "false") advert-pending - whether an advertisement is pending to be displayed ("yes" or "no") RADIUS-related variables Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 92

radius<id> - show the attribute identified with <id> in text string form (in case RADIUS authentication was used; "" otherwise) radius<id>u - show the attribute identified with <id> in unsigned form (in case RADIUS authentication was used; "0" otherwise) radius<id>-<vnd-id> - show the attribute identified with <id> and vendor ID <vnd -id> in text string form (in case RADIUS authentication was used; "" o therwise) radius<id>-<vnd-id>u - show the attribute identified with <id> and vendor ID <vnd -id> in unsigned form (in case RADIUS authentication was used; "0" otherwise) Working with variables $(if <var_name>) statements can be used in theses pages. Foll owing content will be included, if value of <var_name> will not be an empty string. It is an equivalent to $(if <var_name> != "") It is possible to compare on equivalence as well: $(if <var_name> == <value>) These statements have effect until $(elif <var_name>), $(else) or $(endif). In general case it looks like this: some content, which will always be displayed $(if username == john) Hey, your username is john $(elif username == dizzy) Hello, Dizzy! How are you? Your administrator. $(elif ip == 10.1.2.3) You are sitting at that crappy computer, which is damn slow... $(elif mac == 00:01:02:03:04:05) This is an ethernet card, which was stolen few months ago... $(else) I don't know who you are, so lets live in peace. $(endif) other content, which will always b e displayed Only one of those expressions will be shown. Which one - depends on values of those variables for each client. Customizing Error Messages All error messages are stored in the errors.txt file within the respective HotSpot servlet direc tory. You can change and translate all these messages to your native language. To do so, edit the errors.txt file. You can also use variables in the messages. All instructions are given in that file. Multiple Versions of HotSpot Pages Multiple hotspot page sets for the same hotspot server are supported. They can be chosen by user (to select language) or automatically by JavaScript (to select PDA/regular version of HTML pages). To utilize this feature, create subdirectories in HotSpot HTML directory, and pl ace those HTML files, which are different, in that subdirectory. For example, to translate everything in Latvian, subdirectory "lv" can be created with login.html, logout.html, status.html, alogin.html, radvert.html and errors.txt files, which are translat ed into Latvian. If the requested HTML page can not be found in the requested subdirectory, the corresponding HTML file from the main directory will be used. Then main login.html file would contain link to "/lv/login?dst=$(link orig-esc)", which then displays Latvian version of login page: <a href="/lv/login?dst=$(link orig-esc)">Latviski</a> . And Latvian version would contain link to English version: <a href="/login?dst=$(link -orig-esc)">English</a> Another way of referencing directories is to specify 't arget' variable: <a href="$(link -login-only)?dst=$(link-origesc)&target=lv">Latviski</a> <a href="$(link -login-only)?dst=$(link-origesc)&target=%2F">English</a> After preferred directory has been selected (for example, "lv"), all links to local HotSpot pages will contain that path (for example, $(link-status) = "http://hotspot.mt.lv/lv/status" ). So, if all hotspot pages reference links using "$(link -xxx)" variables, then no more changes are to be made - each client will stay within the selected directory all the time.

Notes
Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 93

If you want to use HTTP-CHAP authentication method it is supposed that you include the doLogin() function (which references to the md5.js which must be already loaded) before the Submit action of the login form. Otherwise, CHAP login will fail. The resulting password to be sent to the HotSpot gateway in case of HTTP -CHAP method, is formed MD5 hashing the concatenation of the following: chap -id, the password of the user and chap -challenge (in the given order) In case if variables are to be used in link directly, then they must be escaped accordingly. For example, in login page, <a href="https://login.example.com/login?mac=$(mac)&user=$(username)">link</a> will not work as intended, if username will be "123&456= 1 2". In this case instead of $(user), its escaped version must be used: $(user-esc): <a href="https://login.server.serv/login?mac=$(mac -esc)&user=$(user-esc)">link</a>. Now the same username will be converted to "123%26456%3D1+2", which is the valid repre sentation of "123&456=1 2" in URL. This trick may be used with any variables, not only with $(username). There is a boolean parameter "erase -cookie" to the logout page, which may be either "on" or "true" to delete user cookie on logout (so that the user w ould not be automatically logged on when he/she opens a browser next time.

Example
With basic HTML language knowledge and the examples below it should be easy to implement the ideas described above. To provide predefined value as username, in login.html c hange: <type="text" value="$(username)> to this line: <input type="hidden" name="user" value="hsuser"> (where hsuser is the username you are providing) To provide predefined value as password, in login.html change: <input type="password"> to this line: <input type="hidden" name="password" value="hspass"> (where hspass is the password you are providing) To send client's MAC address to a registration server in form of: https://www.server.serv/register.html?mac=XX:XX:XX:XX:XX:XX change the Login button link in login.html to: https://www.server.serv/register.html?mac=$(mac) (you should correct the link to point to your server) To show a banner after user login, in alogin.html after $(if popup == 'true') add the following line: open('http://your.web.server/your -banner-page.html', 'my-bannername',''); (you should correct the link to point to the page you want to show) To choose different page shown after login, in login.html change: <input type="hidden" name="dst" value="$(link -orig)"> to this line: <input type="hidden" name="dst" value="http://your.web.server"> (you should correct the link to point to your server) To erase the cookie on logoff, in the page containing link to the logout (for example, in status.html) change: open('$(link-logout)', 'hotspot_logout', ... to this: open('$(link-logout)?erase-cookie=on', 'hotspot_logout', ... or alternatively add this line: <input type="hidden" name="erase -cookie" value="on"> before this one: <input type="submit" value="log off"> Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

94

An another example is making HotSpot to au thenticate on a remote server (which may, for example, perform creditcard charging): Allow direct access to the external server in walled -garden (either HTTP-based, or IP-based) Modify login page of the HotSpot servlet to redirect to the external authenti cation server. The external server should modify RADIUS database as needed Here is an example of such a login page to put on the HotSpot router (it is redirecting to https://auth.example.com/login.php, replace with the actual address of an external authent ication server): <html> <title>...</title> <body> <form name="redirect" action="https://auth.example.com/login.php" method="post"> <input type="hidden" name="mac" value="$(mac)"> <input type="hidden" name="ip" value="$(ip)"> <input type="hidden" name="user " value="$(username)"> <input type="hidden" name="link -login" value="$(link -login)"> <input type="hidden" name="link -orig" value="$(link -orig)"> <input type="hidden" name="error" value="$(error)"> </form> <script language="JavaScript"> <!-document.redirect.submit(); //--> </script> </body> </html> The external server can log in a HotSpot client by redirecting it back to the original HotSpot servlet login page, specifying the correct username and password Here is an example of such a page (it i s redirecting to https://hotspot.example.com/login, replace with the actual address of a HotSpot router; also, it is displaying www.mikrotik.com after successful login, replace with what needed): <html> <title>Hotspot login page</title> <body> <form name="login" action="https://hotspot.example.com/login" method="post"> <input type="text" name="username" value="demo"> <input type="password" name="password" value="none"> <input type="hidden" name="domain" value=""> <input type="hidden" name="dst" value="http: //www.mikrotik.com/"> <input type="submit" name="login" value="log in"> </form> </body> </html> Hotspot will ask RADIUS server whether to allow the login or not. If not allowed, alogin.html page will be displayed (it can be modified to do anythi ng!). If not allowed, flogin.html (or login.html) page will be displayed, which will redirect client back to the external authentication server. Note: as shown in these examples, HTTPS protocol and POST method can be used to secure communications.

Possible Error Messages


Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 95

Description
There are two kinds of errors: fatal non -fatal. Fatal errors are shown on a separate HTML page called error.html. Non-fatal errors are basically indicating incorrect user actions and are shown on the login form. General non-fatal errors: You are not logged in - trying to access the status page or log off while not logged in. Solution: log in already authorizing, retry later - authorization in progress. Client already has issued an authorization request which is not yet compl ete. Solution: wait for the current request to be completed, and then try again chap-missing = web browser did not send challenge response (try again, enable JavaScript) trying to log in with HTTP -CHAP method using MD5 hash, but HotSpot server does not know the challenge used for the hash. This may happen if you use BACK buttons in browser; if JavaScript is not enabled in web browser; if login.html page is not valid; or if challenge value has expired on server (more than 1h of inactivity). Solution: instructing browser to reload (refresh) the login page usually helps if JavaScript is enabled and login.html page is valid invalid username ($(username)): this MAC address is not yours - trying to log in using a MAC address username different from the actual user's MAC address. Solution: no - users with usernames that look like a MAC address (eg., 12:34:56:78:9a:bc) may only log in from the MAC address specified as their user name session limit reached ($(error -orig)) - depending on licence number of active h otspot clients is limited to some number. The error is displayed when this limit is reached. Solution: try to log in later when there will be less concurrent user sessions, or buy an another license that allows more simultaneous sessions hotspot service is shutting down - RouterOS is currently being restarted or shut down. Solution: wait until the service will be available again General fatal errors: internal error ($(error-orig)) - this should never happen. If it will, error page will be shown displaying this error message (error-orig will describe what has happened). Solution: correct the error reported configuration error ($(error -orig)) - the HotSpot server is not configured properly (error -orig will describe what has happened). Solution: correct the error reported cannot assign ip address - no more free addresses from pool - unable to get an IP address from an IP pool as there is no more free IP addresses in that pool. Solution: make sure there is a sufficient amount of free IP addresses in IP pool Local HotSpot user database non -fatal errors: invalid username or password - self-explanatory user $(username) is not allowed to log in from this MAC address - trying to log in from a MAC address different from specified in user database. Solution: log in from the correct MAC address or take out the limitation user $(username) has reached uptime limit - self-explanatory user $(username) has reached traffic limit - either limit-bytes-in or limit-bytes-out limit is reached no more sessions are allowed for user $(username) - the shared-users limit for the user's profile is reached. Solution: wait until someone with this username logs out, use different login name or extend the shared-users limit RADIUS client non-fatal errors: invalid username or password - RADIUS server has rejected the username and password sent to it without specifying a reason. Cause: either wrong username and/or password, or other error. Solution: should be clarified in RADIUS server's log files <error_message_sent_by_radius_server> - this may be any message (any text string) sent back by RADIUS server. Consult with your RADIUS server's documentation for further information RADIUS client fatal errors: RADIUS server is not responding - user is being authenticated by RADIUS server, but no response is received from it. Solution: check whether the RADIUS server is running and is reachable from the HotSpot router

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

96

HotSpot How-to's
Description
This section will focus on some simple examples of how to use your HotSpot system, as well as giv e some useful ideas. Setting up https authorization At first certificate must be present with decrypted private key: [admin@MikroTik] > /certificate print Flags: K - decrypted-private-key, Q - private-key, R - rsa, D - dsa 0 KR name="hotspot.example.net" subject=C=LV,L=Riga,O=MT,OU=dev,CN=hotspot.example.net, [email protected] issuer=C=LV,L=Riga,O=MT,OU=dev,CN=hotsot.example.net, [email protected] serial-number="0" [email protected] invalid-before=oct/27/2004 11:43:22 invalid -after=oct/27/2005 11:43:22 ca=yes Then we can use that certificate for hotspot: /ip hotspot profile set default login -by=cookie,http-chap,https \ ssl-certificate=artis. hotspot.mt.lv After that we can see, that HTTPS is running on hotspot interface: [admin@MikroTik] > /ip hotspot print Flags: X - disabled, I - invalid, S - HTTPS # NAME INTERFACE TIMEOUT 0 S hs-local local

ADDRESS -POOL PROFILE IDLEdefault 00:05:00

Bypass hotspot for some devices in hotspot network All IP binding entries with type property set to bypassed, will not be asked to authorize - it means that they will have login-free access: [admin@MikroTik] ip hotspot ip -binding> print Flags: X - disabled, P - bypassed, B - blocked # MAC-ADDRESS ADDRESS TO -ADDRESS SERVER 0 P 10.11.12.3 If all fields has been filled in the ip -binding table and type has been set to bypassed, then the IP address of this entry will be accessible from public interfaces immediately: [admin@MikroTik] ip hotspot ip -binding> print Flags: X - disabled, P - bypassed, B - blocked # MAC-ADDRESS ADDRESS TO-ADDRESS SERVER 0 P 10.11.12.3 1 P 00:01:02:03:04:05 10.11.12.3 10.11.12.3 hs -local [admin@MikroTik] ip hotspot ip -binding> .. host print Flags: S - static, H - DHCP, D - dynamic, A - authorized, P - bypassed # MAC-ADDRESS ADDRESS TO -ADDRESS SERVER IDLE TIMEOUT 0 SB 00:01:02:03:04:05 10.11.12.3 10.11.12.3 hs -local

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

97

BAB XII Address Lists


General Information
Summary
Firewall address lists allow to create a list of IP addres ses to be used for packet matching.

Specifications
Packages required: system License required: Level1 Submenu level: /ip firewall address-list Standards and Technologies: IP Hardware usage: Not significant

Related Documents
Software Package Management ../ip/address.php ../ip/route.php NAT Filter Packet Flow Packet Flow

Address Lists
Description
Firewall address lists allow user to create lists of IP addresses grouped together. Firewall filter, mangle and NAT facilities can use address lists to match packets against them. The address list records could be updated dynamically via the action=add-src-to-address-list or action=adddst-to-address-list items found in NAT mangle and filter facilities.

Property Description
list (name) - specify the name of the address list to add IP address to address (IP address/netmask | IP address-IP address) - specify the IP address or range to be added to the address list. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24

Example
The following example creates an address list of people thet are connecting to port 23 (telnet) on the router and drops all further traffic from them. Additionaly, the address list will contain o ne static entry of address=192.0.34.166/32 (www.example.com): Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 98

[admin@MikroTik] > /ip firewall address -list add list=drop_traffic address=192.0.34.166/32 [admin@MikroTik] > /ip firewall address -list print Flags: X - disabled, D - dynamic # LIST A DDRESS 0 drop_traffic 192.0.34.166 [admin@MikroTik] > /ip firewall mangle add chain=prerouting protocol=tcp dst-port=23 \ \... action=add-src-to-address-list address-list=drop_traffic [admin@MikroTik] > /ip firewall filter add action=drop chain=input sr caddress-list=drop_traffic [admin@MikroTik] > /ip firewall address -list print Flags: X - disabled, D - dynamic # LIST ADDRESS 0 drop_traffic 192.0.34.166 1 D drop_traffic 1.1.1.1 2 D drop_traffic 10.5.11.8 [admin@MikroTik] > As seen in the output of the last print command, two new dynamic entries appeared in the address list. Hosts with these IP addresses tried to initialize a telnet session to the router. Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBO ARD are trademarks of Mikrotikls SIA. Other trademarks and registered trademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

99

BAB XIII Mangle


General Information
Summary
The mangle facility allows to mark IP packets w ith special marks. These marks are used by various other router facilities to identify the packets. Additionaly, the mangle facility is used to modify some fields in the IP header, like TOS (DSCP) and TTL fields.

Specifications
Packages required: system License required: Level1 Submenu level: /ip firewall mangle Standards and Technologies: IP Hardware usage: Increases with count of mangle rules

Related Documents
Software Package Management IP Addresses and ARP Routes, Equal Cost Multipath Routing, Policy Routing NAT Filter Packet Flow

Mangle
Submenu level: /ip firewall mangle

Description
Mangle is a kind of 'marker' that marks packets for future processing with special marks. Many other facilities in RouterOS make use of these marks, e.g. queue trees and NAT. They identify a packet based on its mark and process it accordingly. The mangle marks exist only within the router, they are not transmitted across the network.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

100

Property Description
action (accept | add-dst-to-address-list | add-src-to-address-list | change-mss | change-tos | change-ttl | jump | log | mark-connection | mark-packet | mark-routing | passthrough | return | strip -ipv4-options; default: accept) action to undertake if the packet matches the rule accept - accept the packet. No action, i.e., th e packet is passed through and no more rules are applied to it add-dst-to-address-list - add destination address of an IP packet to the address list specified by address-list parameter add-src-to-address-list - add source address of an IP packet to the a ddress list specified by address-list parameter change-mss - change Maximum Segment Size field value of the packet to a value specified by the new-mss parameter change-tos - change Type of Service field value of the packet to a value specified by the new-tos parameter change-ttl - change Time to Live field value of the packet to a value specified by the new-ttl parameter jump - jump to the chain specified by the value of the jump-target parameter log - each match with this action will add a message to the system log mark-connection - place a mark specified by the new-connection-mark parameter on the entire connection that matches the rule mark-packet - place a mark specified by the new-packet-mark parameter on a packet that matches the rule mark-routing - place a mark specified by the new-routing-mark parameter on a packet. This kind of marks is used for policy routing purposes only passthrough - ignore this rule go on to the next one return - pass control back to the chain from where the jump took place strip-ipv4-options - strip IPv4 option fields from the IP packet address-list (name) - specify the name of the address list to collect IP addresses from rules having action=adddst-to-address-list or action=add-src-to-address-list actions. These address lists could be later used for packet matching address-list-timeout (time; default: 00:00:00) - time interval after which the address will be removed from the address list specified by address-list parameter. Used in conjunction with add-dst-to-address-list or add-srcto-address-list actions 00:00:00 - leave the address in the address list forever chain (forward | input | output | postrouting | prerouting) - specify the chain to put a particular rule into. As the different traffic is passed through different chains, always be careful in choosing the right chain for a new rule. If the input does not match the name of an already defined chain, a new chain will be created comment (text) - free form textual comment for the rule. A comment can be used to refer the particular rule from scripts connection-bytes (integer-integer) - match packets only if a given amount of bytes has been transfered through the particular connection 0 - means infinity, exempli gratia: connection-bytes=2000000-0 means that the rule matches if more than 2MB has been transfered through the relevant connection connection-limit (integer,netmask) - restrict connection limit per address or address block connection-mark (name) - match packets marked via mangle facility with particul ar connection mark connection-type (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp) - match packets from related connections based on information from their connection tracking helpers. A relevant connection helper must be enabled under /ip firewall service-port content (text) - the text packets should contain in order to match the rule dst-address (IP address/netmask | IP address-IP address) - specify the address range an IP packet is destined to. Note that console converts entered address/netmask value to a valid network address, i.e.: 1.1.1.1/24 is converted to 1.1.1.0/24 dst-address-list (name) - match destination address of a packet against user -defined address list dst-address-type (unicast | local | broadcast | multicast) - match destination address type of the IP packet, one of the: unicast - IP addresses used for one point to another point transmission. There is only one sender and one receiver in this case local - match addresses assigned to router's interfaces broadcast - the IP packet is sent from one point to all other points in the IP subnetwork multicast - this type of IP addressing is responsible for transmission from one or more points to a set of other points Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 101

dst-limit (integer/time{0,1},integer,dst-address | dst-port | src-address{+},time{0,1}) - limit the packet per second (pps) rate on a per destination IP or per destination port base. As opposed to the limit match, every destination IP address / destination port has it's own limit. The options are as follows (in order of appe arance): Count - maximum average packet rate, measured in packets per second (pps), unless followed by Time option Time - specifies the time interval over which the packet rate is measured Burst - number of packets to match in a burst Mode - the classifier(-s) for packet rate limiting Expire - specifies interval after which recorded IP addresses / ports will be deleted dst-port (integer: 0..65535-integer: 0..65535{*}) - destination port number or range hotspot (multiple choice: from-client | auth | local-dst | http) - match packets received from clients against various Hot-Spot. All values can be negated from-client - true, if a packet comes from HotSpot client auth - true, if a packet comes from authenticted client local-dst - true, if a packet has local destination IP address hotspot - true, if it is a TCP packet from client and either the transparent proxy on port 80 is enabled or the client has a proxy address configured and this address is equal to the address:port pair of the IP packet icmp-options (integer:integer) - match ICMP Type:Code fields in-interface (name) - interface the packet has entered the router through ipv4-options (any | loose-source-routing | no-record-route | no-router-alert | no-source-routing | no-timestamp | none | record-route | router-alert | strict-source-routing | timestamp) - match ipv4 header options any - match packet with at least one of the ipv4 options loose-source-routing - match packets with loose source routing option. This option is used to route the interne t datagram based on information supplied by the source no-record-route - match packets with no record route option. This option is used to route the internet datagram based on information supplied by the source no-router-alert - match packets with no router alter option no-source-routing - match packets with no source routing option no-timestamp - match packets with no timestamp option record-route - match packets with record route option router-alert - match packets with router alter option strict-source-routing - match packets with strict source routing option timestamp - match packets with timestamp jump-target (forward | input | output | postrouting | prerouting name) - name of the target chain to jump to, if the action=jump is used limit (integer/time{0,1},integer) - restrict packet match rate to a given limit. Usefull to reduce the amount of log messages Count - maximum average packet rate, measured in packets per second (pps), unless followed by Time option Time - specify the time interval over which the packet rate is measured Burst - number of packets to match in a burst log-prefix (text) - all messages written to logs will contain the prefix specified herein. Used in conjunction with action=log new-connection-mark (name) - specify the new value of the connection mark to be used in conjunction with action=mark-connection new-mss (integer) - specify MSS value to be used in conjunction with action=change-mss new-packet-mark (name) - specify the new value of the packet mark to be used in c onjunction with action=mark-packet new-routing-mark (name) - specify the new value of the routing mark used in conjunction with action=markrouting new-tos (max-reliability | max-throughput | min-cost | min-delay | normal integer) - specify TOS value to be used in conjunction with action=change-tos max-reliability - maximize reliability (ToS=4) max-throughput - maximize throughput (ToS=8) min-cost - minimize monetary cost (ToS=2) min-delay - minimize delay (ToS=16) normal - normal service (ToS=0) new-ttl (decrement | increment | set: integer) - specify the new TTL field value used in conjunction with action=change-ttl Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 102

decrement - the value of the TTL field will be decremented for value increment - the value of the TTL field will be incremented for value set: - the value of the TTL field will be set to value nth (integer,integer: 0..15,integer{0,1}) - match a particular Nth packet received by the rule. One of 16 available counters can be used to count packets Every - match every Every+1th packet. For example, if Every=1 then the rule matches every 2nd packet Counter - specifies which counter to use. A counter increments each time the rule containing nth match matches Packet - match on the given packet number. The value by obvious reasons must be b etween 0 and Every. If this option is used for a given counter, then there must be at least Every+1 rules with this option, covering all values between 0 and Every inclusively. out-interface (name) - match the interface name a packet left the router throu gh p2p (all-p2p | bit-torrent | direct-connect | edonkey | fasttrack | gnutella | soulseek | warez | winmx) - match packets belonging to connections of the above P2P protocols packet-mark (name) - match the packets marked in mangle with specific packet m ark packet-size (integer: 0..65535-integer: 0..65535{0,1}) - matches packet of the specified size or size range in bytes Min - specifies lower boundary of the size range or a standalone value Max - specifies upper boundary of the size range passthrough (yes | no; default: yes) - whether to let the packet to pass further (like action passthrough) after marking it with a given mark (property only valid if action is mark packet, connection or routing mark) phys-in-interface (name) - matches the bridge port physical input device added to a bridge device. It is only useful if the packet has arrived through the bridge protocol (ddp | egp | encap | ggp | gre | hmp | icmp | idrp -cmtp | igmp | ipencap | ipip | ipsec -ah | ipsec-esp | isotp4 | ospf | pup | rdp | rspf | st | tcp | udp | vmtp | xns-idp | xtp | integer) - matches particular IP protocol specified by protocol name or number. You should specify this setting if you want to specify ports psd (integer,time,integer,integer) - attempts to detect TCP and UD P scans. It is advised to assign lower weight to ports with high numbers to reduce the frequency of false positives, such as from passive mode FTP transfers WeightThreshold - total weight of the latest TCP/UDP packets with different destination ports comi ng from the same host to be treated as port scan sequence DelayThreshold - delay for the packets with different destination ports coming from the same host to be treated as possible port scan subsequence LowPortWeight - weight of the packets with privile ged (<=1024) destination port HighPortWeight - weight of the packet with non -priviliged destination port random (integer: 1..99) - matches packets randomly with given propability routing-mark (name) - matches packets marked with the specified routing ma rk src-address (IP address/netmask | IP address-IP address) - specifies the address range an IP packet is originated from. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24 src-address-list (name) - matches source address of a packet against user -defined address list src-address-type (unicast | local | broadcast | multicast) - matches source address type of the IP packet, one of the: unicast - IP addresses used for one point t o another point transmission. There is only one sender and one receiver in this case local - matches addresses assigned to router's interfaces broadcast - the IP packet is sent from one point to all other points in the IP subnetwork multicast - this type of IP addressing is responsible for transmission from one or more points to a set of other points src-mac-address (MAC address) - source MAC address src-port (integer: 0..65535-integer: 0..65535{*}) - source port number or range tcp-flags (multiple choice: ack | cwr | ece | fin | psh | rst | syn | urg) - tcp flags to match ack - acknowledging data cwr - congestion window reduced ece - ECN-echo flag (explicit congestion notification) fin - close connection psh - push function rst - drop connection Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 103

syn - new connection urg - urgent data tcp-mss (integer: 0..65535) - matches TCP MSS value of an IP packet time (time-time,sat | fri | thu | wed | tue | mon | sun{+}) - allows to create filter based on the packets' arrival time and date or, for locall y generated packets, departure time and date tos (max-reliability | max-throughput | min-cost | min-delay | normal) - specifies a match for the value of Type of Service (ToS) field of an IP header max-reliability - maximize reliability (ToS=4) max-throughput - maximize throughput (ToS=8) min-cost - minimize monetary cost (ToS=2) min-delay - minimize delay (ToS=16) normal - normal service (ToS=0)

Notes
Instead of making two rules if you want to mark a packet, connection or routing -mark and finish mangle table processing on that event (in other words, mark and simultaneously accept the packet), you may disable the set by default passthrough property of the marking rule. Usually routing-mark is not used for P2P, since P2P traffic always is routed over a default getaway.

Application Examples
Description
The following section discusses some examples of using the mangle facility.

Peer-to-Peer Traffic Marking


To ensure the quality of service for network connection, interactive traffic types such as VoIP and HTTP should be prioritized over non-interactive, such as peer-to-peer network traffic. RouterOS QOS implementation uses mangle to mark different types of traffic first, and then place them into queues with different limits. The following example enfor ces the P2P traffic will get no more than 1Mbps of the total link capacity when the link is heavily used by other traffic otherwice expanding to the full link capacity: [admin@MikroTik] > /ip firewall mangle add chain=forward \ \... p2p=all-p2p action=mark-connection new-connection-mark=p2p_conn [admin@MikroTik] > /ip firewall mangle add chain=forward \ \... connection-mark=p2p_conn action=mark -packet new-packet-mark=p2p [admin@MikroTik] > /ip firewall mangle add chain=forward \ \... connection-mark=!p2p_conn action=mark-packet new-packet-mark=other [admin@MikroTik] > /ip firewall mangle print Flags: X - disabled, I - invalid, D - dynamic 0 chain=forward p2p=all -p2p action=mark-connection new-connectionmark=p2p_conn 1 chain=forward connection -mark=p2p_conn action=mark -packet new-packetmark=p2p 2 chain=forward packet -mark=!p2p_conn action=mark -packet new-packetmark=other [admin@MikroTik] > [admin@MikroTik] > /queue tree add parent=Public packet -mark=p2p limitat=1000000 \ \... max-limit=100000000 priority=8 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 104

[admin@MikroTik] > /queue tree add parent=Local packet -mark=p2p limitat=1000000 \ \... max-limit=100000000 priority=8 [admin@MikroTik] > /queue tree add parent=Public packet -mark=other limitat=1000000 \ \... max-limit=100000000 priority=1 [admin@MikroTik] > /queue tree add parent=Local packet -mark=other limitat=1000000 \ \... max-limit=100000000 priority=1

Mark by MAC address


To mark traffic from a known MAC address which goes to the router or through i t, do the following: [admin@MikroTik] > / ip firewall mangle add chain=prerouting \ \... src-mac-address=00:01:29:60:36:E7 action=mark -connection newconnection-mark=known_mac_conn [admin@MikroTik] > / ip firewall mangle add chain=prerouting \ \... connection-mark=known_mac_conn action=mark -packet new-packetmark=known_mac

Change MSS
It is a well known fact that VPN links have smaller packet size due to incapsulation overhead. A large packet with MSS that exceeds the MSS of the VPN link should be fra gmented prior to sending it via that kind of connection. However, if the packet has DF flag set, it cannot be fragmented and should be discarded. On links that have broken path MTU discovery (PMTUD) it may lead to a number of problems, including problems w ith FTP and HTTP data transfer and e -mail services. In case of link with broken PMTUD, a decrease of the MSS of the packets coming through the VPN link solves the problem. The following example demonstrates how to decrease the MSS value via mangle: [admin@MikroTik] > /ip firewall mangle add out -interface=pppoe-out \ \... protocol=tcp tcp -flags=syn action=change -mss new-mss=1300 chain=forward [admin@MikroTik] > /ip firewall mangle print Flags: X - disabled, I - invalid, D - dynamic 0 chain=forward out -interface=pppoe-out protocol=tcp tcp -flags=syn action=change -mss new-mss=1300 [admin@MikroTik] > Copyright 1999-2006, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA. Other trademarks and registered t rademarks mentioned herein are properties of their respective owners.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

105

BAB XIV Graphing


General Information
Summary
Graphing is a tool which is used for monitoring various RouterOS parameters over a period of time.

Specifications
Packages required: system, routerboard(optional) License required: Level1 Submenu level: /tool graphing Hardware usage: Not significant

Description
The Graphing tool can display graphics for: Routerboard health (voltage and temperature) Resource usage (CPU, Memory and Disk usage) Traffic which is passed through interfaces Traffic which is passed through simple queues Graphing consists of two parts - first part collects information and other part displays data in a Web page. To access the graphics, type http://[Router_IP_address]/graphs/ and choose a graphic to display in your Web browser. Data from the router is gathered every 5 minutes, but saved on the system drive every store-every time. After rebooting the router, graphing will display information that was las t time saved on the disk before the reboot. RouterOS generates four graphics for each item: "Daily" Graph (5 Minute Average) "Weekly" Graph (30 Minute Average) "Monthly" Graph (2 Hour Average) "Yearly" Graph (1 Day Average) To access each graphic from a network, specify this network in allow-address parameter for the respective item.

General Options
Submenu level: /tool graphing

Property Description
store-every (5min | hour | 24hours; default: 5min) - how often to store information on system drive

Example
To store information on system drive every hour: /tool graphing set store -every=hour [admin@MikroTik] tool graphing> print store-every: hour Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 106

[admin@MikroTik] tool graphing>

Health Graphing
Submenu level: /tool graphing health

Description
This submenu provides information about RouterBoard's 'health' - voltage and temperature. For this option, you have to install the routerboard package:

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - network which is allowed to vi ew graphs of router health store-on-disk (yes | no; default: yes) - whether to store information about traffic on system drive or not. If not, the information will be stored in RAM and will be lost after a reboot

Interface Graphing
Submenu level: /tool graphing interface

Description
Shows how much traffic is passed through an interface over a period of time.

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - IP address range which is allowed to view information about the interface. If a client PC not belonging to this IP address range tries to open http://[Router_IP_address]/graphs/ , it will not see this entry interface (name; default: all) - name of the interface which will be monitored store-on-disk (yes | no; default: yes) - whether to store information about traffic on system drive or not. If not, the information will be stored in RAM and will be lost after a reboot

Example
To monitor traffic which is passed through interface ether1 only from local network 192.168.0.0/24, and write information on disk: [admin@MikroTik] tool graphing interface> add interface=ether1 \ \... allow-address=192.168.0.0/24 store -on-disk=yes [admin@MikroTik] tool graphing interface> print Flags: X - disabled # INTERFACE ALLOW -ADDRESS STORE-ON-DISK 0 ether1 192.168.0.0/24 yes [admin@MikroTik] tool graphing interface> Graph for interface ether1:

Simple Queue Graphing


Submenu level: /tool graphing queue

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

107

Description
In this submenu you can specify a queue from the /queue simple list to make a graphic for it.

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - IP address range which is allowed to view information about the queue. If a client PC not belonging to this IP address range tries to open http://[Router_IP_address]/graphs/ , it will not see this entry allow-target (yes | no; default: yes) - whether to allow access to web graphing from IP range that is specified in /queue simple target-address simple-queue (name; default: all) - name of simple queue which will be monitored store-on-disk (yes | no; default: yes) - whether to store information about traffic on hard drive or not. If not, the information will be stored in RAM and will be lost after a reboot

Example
Add a simple queue to Grapher list with simple -queue name queue1, allow limited clients to access Grapher from web, store information about traffic on disk: [admin@MikroTik] tool graphing queue> add simple -queue=queue1 allowaddress=yes \ \... store-on-disk=yes "Daily" graphic for queue1:

Resource Graphing
Submenu level: /tool graphing resource

Description
Provides with router resource usage information over a period of time: CPU usage Memory usage Disk usage

Property Description
allow-address (IP address/netmask; default: 0.0.0.0/0) - IP address range which is allowed to view information about the resource usage. If a client PC not belonging to this IP a ddress range tries to open http://[Router_IP_address]/graphs/ , it will not see this entry store-on-disk (yes | no; default: yes) - whether to store information about traffic on hard drive or not. If not, the information will be stored in RAM and will be l ost after a reboot

Example
Add IP range 192.168.0.0/24 from which users are allowed to monitor Grapher's resource usage: [admin@MikroTik] tool graphing resource> add allow -address=192.168.0.0/24 \ \... store-on-disk=yes [admin@MikroTik] tool graphing res ource> print Flags: X - disabled # ALLOW-ADDRESS STORE -ON-DISK 0 192.168.0.0/24 yes [admin@MikroTik] tool graphing resource>

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

108

BAB XV RouterBoard-specific functions


General Information
Summary
There are some features used to configure specif ic functions exist only in RouterBOARD series embedded routers: BIOS upgrading BIOS configuration Health monitoring (RouterBOARD 200 series only) LED control (may be used in scripting) Fan voltage control (on/off) (RouterBOARD 200 series only) Console reset jumper (RouterBOARD 200 series only)

Specifications
Packages required: routerboard License required: Level1 Submenu level: /system routerboard, /system health Standards and Technologies: Hardware usage: works only on RouterBOARD platform

BIOS upgrading
Submenu level: /system routerboard

Description
The BIOS is needed to recognize all the hardware and boot the system up. Newer BIOS versions might have support for more hardware, so it's generally a good idea to upgrade the BIOS once a newer versio n is available. The newest versions of BIOS firmware is included in the newest routerboard software package. BIOS firmware may also be uploaded to router's FTP server (the file is called wlb-bios.rom). This way, for example, BIOS firmware may be transferre d from one router to an another.

Property Description
current-firmware (read-only: text) - the version and build date of the BIOS already flashed model (read-only: text) - RouterBOARD model routerboard (read-only: yes | no) - whether the motherboard has been detected as a RouterBOARD serial-number (read-only: text) - RouterBOARD serial number upgrade-firmware (read-only: text) - the version and build date of the BIOS that is available for flashing

Command Description
upgrade - write the uploaded firmware to the BIOS (asks confirmation, and then reboots the router)

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

109

Example
To check the current and available firmware version numbers: [admin@MikroTik] system routerboard> print routerboard: yes model: 230 serial-number: 8524983 current-firmware: 1.3.4beta7 (Nov/12/2004 17:12:58) upgrade-firmware: 1.3.4beta7 (Nov/16/2004 17:02:35) [admin@MikroTik] system routerboard> To upgrade the BIOS version: [admin@MikroTik] > system routerboard upgrade Firmware upgrade re quires reboot of the router. Continue? [y/n] y Firmware upgrade can take up to 20s. Do NOT turn off the power!

BIOS Configuration
Submenu level: /system routerboard bios

Description
In addition to BIOS own setup possibilities, it is possible to co nfigure BIOS parameters in RouterOS condole

Property Description
baud-rate (1200 | 2400 | 4800 | 9600 | 19200 | 38400 | 57600 | 115200; default: 9600) - initian bitrate of the onboard serial port beep-on-boot (yes | no; default: yes) - whether to beep during boot procedure (to indicate that it has succeeded) boot-delay (time: 0s..10s; default: 1s) - how much time to wait for a key storke while booting boot-device (etherboot-ide | etherboot-only | ide-only | try-etherboot-once) - specifies from which device the RouterBoard will boot etherboot-ide - boot from etherboot, if it fails, boot from ide etherboot-only - boot only from etherboot ide-only - boot only from ide try-etherboot-once - boot from etherboot once, then returns to previous settings cpu-mode (power-save | regular; default: power-save) - whether to enter CPU suspend mode in HTL instruction. Most OSs use HLT instruction during CPU idle cycle. When CPU is in suspend mode, it consumes less power, but in low-temperatire conditions it is recomm ended to choose regular mode, so that overall system temperature would be greater debug-level (none | low | high) - BIOS output debug level none - no debugging output low - show only some debugging information high - show all debugging information abou t the boot process enter-setup-on (any-key | delete-key; default: any-key) - which key will cause the BIOS to enter configuration mode during boot delay. Note that in some serial terminal programs, it is impossible to use Delete key to enter the setup - in this case it might be possible to do this with the Backspace key etherboot-timeot (time; default: 1m) - how much time to wait for booting from ethernet memory-settings (fail-safe | optimal; default: auto) - SDRAM memory speed optimal - the BIOS tries to determine the correct memory settings by itself fail-safe - use if you have memory-related errors (generally random, not reproducible errors and freezes). In this case, minimal timing parametrs are used, so most memory modules will work reliably memory-test (yes | no; default: no) - whether to testall the RAM during boot procedure. Regardless of the choice, hte first megabyte of the RAM will be tested anyway. Enabling this option may cause longer boot process Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 110

pci-backoff (enabled | disabled; default: enabled) - when enabled, external PCI masters can access system memory even when a CPU cycle has been retried. If you are experiencing uncommon problems with PCI/PCMCIA/CardBUS interfaces (including RouterBOARD is rebooting or hanging up once in a while), try to disable it vga-to-serial (yes | no; default: yes) - whether to map VGA output to the serial console. Should be enabled if working via serial terminal (gives much more output)

Example
To set high debug level with RAM test: [admin@MikroTik] system routerboard baud-rate: 9600 debug-level: low boot-delay: 00:00:01 enter-setup-on: any-key beep-on-boot: yes boot-device: ide-only etherboot-timeout: 00:01:00 vga-to-serial: yes memory-settings: optimal memory-test: no cpu-mode: power-save pci-backoff: enabled [admin@MikroTik] system routerboard [admin@MikroTik] system routerboard baud-rate: 9600 debug-level: high boot-delay: 00:00:01 enter-setup-on: any-key beep-on-boot: yes boot-device: ide-only etherboot-timeout: 00:01:00 vga-to-serial: yes memory-settings: optimal memory-test: no cpu-mode: power-save pci-backoff: enabled [admin@MikroTik] system routerboard bios> print

bios> set debug -level=high bios> print

bios>

System Health Monitoring


Submenu level: /system health

Description
LM87 health controller chip provides some measurments of temperature and voltage on RouterBOARD 200 series computers. Information becomes available not sooner than 2 minutes after boot up. It is not available if LM87 chip is not detected successfully. All values are 10 second averages, with short peak values ignored as likely read errors

Property Description
3.3v - +3.3V power line voltage 5v - +5V power line voltage board-temp - temperature of the PCI area core - CPU core voltage Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 111

cpu-temp - temperature of the CPU area lm87-temp - temperature of the LM87 chip state (read-only: enabled | disabled; default: disabled) - the current state of health monitoring (whether it is enabled or not) state-after-reboot (enabled | disabled; default: disabled) - the state of the health monitor after the reboot

Notes
You cannot change state on the fly, just control, whether the health control will be enabled after reboot All themperature values are in Celsius degrees

Example
To check system health: [admin@MikroTik] system core: 3.3v: 5v: lm87-temp: cpu-temp: board-temp: state: state-after-reboot: [admin@MikroTik] system health> print 1.32 3.26 4.97 -0.9 -0.9 -0.9 enabled enabled routerboard health>

LED Management or RB200


Command name: :led

Description
The four user LEDs of the RouterBOARD 200 series can be controlled from user -space scripts.

Property Description
led1 (yes | no; default: no) - whether the LED1 is on led2 (yes | no; default: no) - whether the LED2 is on led3 (yes | no; default: no) - whether the LED3 is on led4 (yes | no; default: no) - whether the LED3 is on length (time; default: 0s) - how long to hold the given combination 0s - no limit

Notes
The command does not imply a pause in execution. It works asynchronously, allowing execution to continue just after the command was entered, not waiting for LEDs to switch off. After the given time (length property) the LEDs will return to the default (off) condition. Any new :led command overrides the the previous state and resets the LED state after the length time interval.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

112

Example
To turn LED1 on for a minute: [admin@MikroTik] > :led led1=yes length=1m [admin@MikroTik] >

LED Management on RB500


Command name: /blink

Description
It is possible to blink with the only user LED (the red one, near the blue power LED) of ROuterBOARD 500 series boards

Property Description
duration (time; default: 10s) - how long to flash the red LED

Fan voltage control


Command name: /system routerboard fan-control

Description
On RouterBOARD 200 series you can control, whether the J11 fan 5V voltage output is enabled. This feature will only work with newest BIOS versions. This is useful in scripts to control some devices attached to the J11 connector.

Property Description
length (time; default: 0) - how long to hold the set state value, and then return to the prevoius state 0 - leave the state in the set mode until restart state (yes | no) - whether to enable the 5V output on pins 1 -2 of the J11 header

Console Reset Jumper


Description
The J16 jumper on the RouterBOARD 200 may be used as serial console reset pin. If it held short for at least 10 seconds, then: Serial console configuration is reset Serial port that serial console will pick by default (usually serial0) is set to 9600 baud 8 bit 1 stop bit no parity (default settings after installation) Special flag that prevents any other program except serial console to acquire this port is set Router is rebooted

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

113

BAB XVI Bandwidth Test


General Information
Summary
The Bandwidth Tester can be used to monitor the throughput only to a remote MikroTik router (either wired or wireless) and thereby help to discover network "bottlenecks".

Specifications
Packages required: system License required: Level1 Submenu level: /tool Standards and Technologies: TCP (RFC 793), UDP (RFC768) Hardware usage: significant

Related Documents
Software Package Management

Description
Protocol Description The TCP test uses the standard TCP protocol with acknowledgments and follows the TCP algorithm on how many packets to send according to latency, dropped packets, and other features in the TCP algorithm. Please review the TCP protocol for details on its internal speed settings and how to analyze its behavior. Statistics for throughput are calculated using the entire size of the TCP packet. As acknowledgments are an int ernal working of TCP, their size and usage of the link are not included in the throughput statistics. Therefore this statistic is not as reliable as the UDP statistic when estimating throughput. The UDP tester sends 110% or more packets than currently repo rted as received on the other side of the link. To see the maximum throughput of a link, the packet size should be set for the maximum MTU allowed by the links which is usually 1500 bytes. There is no acknowledgment required by UDP; this implementation mea ns that the closest approximation of the throughput can be seen. Usage Notes Caution! Bandwidth Test uses all available bandwidth (by default) and may impact network usability. Bandwidth Test uses much resources. If you want to test real throughput of a r outer, you should run bandwidth test through it not from or to it. To do this you need at least 3 routers connected in chain: the Bandwidth Server, the given router and the Bandwidth Client:

Note that if you use UDP protocol then Bandwidth Test counts IP header+UDP header+UDP data. In case if you use TCP then Bandwidth Test counts only TCP data (TCP header and IP header are not included).

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

114

Server Configuration
Submenu level: /tool bandwidth-server

Property Description
allocate-udp-ports-from - allocate UDP ports from authenticate (yes | no; default: yes) - communicate only with authenticated (by valid username and password) clients enable (yes | no; default: no) - enable client connections for bandwidth test max-sessions - maximal number of bandwidth -test clients

Notes
The list of current connections can be obtained in session submenu

Example
Bandwidth Server: [admin@MikroTik] tool bandwidth -server> print enabled: no authenticate: yes allocate-udp-ports-from: 2000 max-sessions: 10 [admin@MikroTik] tool> Active sessions: [admin@MikroTik] tool> bandwidth -server session print # CLIENT PROTOCOL DIRECTION USER 0 35.35.35.1 udp send admi n 1 25.25.25.1 udp send admin 2 36.36.36.1 udp send admin [admin@MikroTik] tool> To enable bandwidth-test server without client authentication: [admin@MikroTik] tool bandwidth -server> set enabled=yes authenticate=no [admin@MikroTik] tool bandwidth -server> print enabled: yes authenticate: no allocate-udp-ports-from: 2000 max-sessions: 10 [admin@MikroTik] tool>

Client Configuration
Command name: /tool bandwidth-test

Property Description
address (IP address) - IP address of destination host assume-lost-time (time; default: 0s) - assume that connection is lost if Bandwidth Server is not responding for that time direction (receive / transmit / both; default: receive) - the direction of the test do (name | string; default: "") - script source duration (time; default: 0s) - duration of the test 0s - test duration is not limited interval (time: 20ms..5s; default: 1s) - delay between reports (in seconds) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 115 Referensi : Download :www.mikrotik.com

local-tx-speed (integer; default: 0) - transfer test maximum speed (bits per second) 0 - no speed limitations local-tx-size (integer: 40..64000) - local transmit packet size in bytes password (text; default: "") - password for the remote user protocol (udp | tcp; default: udp) - protocol to use random-data (yes | no; default: no) - if random-data is set to yes, the payload of the bandwidth test packets will have incompressible random data so that links that use data compression will not distort the results (this is CPU intensive and random-data should be set to no for low speed CPUs) remote-tx-speed (integer; default: 0) - receive test maximum speed (bits per second) 0 - no speed limitations remote-tx-size (integer: 40..64000) - remote transmit packet size in bytes user (name; default: "") - remote user

Example
To run 15-second long bandwidth-test to the 10.0.0.211 host sending and receiving 1000-byte UDP packets and using username admin to connect [admin@MikroTik] tool> bandwidth -test 10.0.0.211 duration=15s direction=both \ \... size=1000 protocol=udp user=admin status: done testing duration: 15s tx-current: 3.62Mbps tx-10-second-average: 3.87Mbps tx-total-average: 3.53Mbps rx-current: 3.33Mbps rx-10-second-average: 3.68Mbps rx-total-average: 3.49Mbps [admin@MikroTik] tool>

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

116

BAB XVII Scripting Host


General Information
Summary
This manual provides introduction to RouterOS built -in powerful scripting language. Scripting host provides a way to automate some router maintenance tasks by means of executing user -defined scripts bounded to some event occurence. A script consists of configuration commands and expressions (ICE internal console expression). The configuration commands are standard RouterOS commands, e.g. /ip firewall filter add chain=forward protocol=gre action=drop that are described in the relevant manuals, while expressions are prefixed with : and are accessible from all submenus. The events used to trigger script execut ion include, but are not limited to the System Scheduler, the Traffic Monitoring Tool, and the Netwatch Tool generated events.

Specifications
Packages required: system License required: Level1 Submenu level: /system script Standards and Technologies: None Hardware usage: Not significant

Related Documents
Software Package Management ../appex/scripting1.php System Scheduler Network Monitor Traffic Monitor Serial Port Monitor

Console Command Syntax


Description
Console commands are made of the following parts, listed in the order yo u type them in console: prefix - indicates whether the command is an ICE, like : in :put or that the command path starts from the root menu level, like / in [admin@MikroTik] ip firewall mangle> /ping 10.0.0.1 path - a relative path to the desired menu lev el, like .. filter in [admin@MikroTik] ip firewall mangle> .. filter print path_args - this part is required to select some menu levels, where the actual path can vary across different user inputs, like mylist in [admin@MikroTik] ip firewall mangle> /rou teing prefix-list list mylist action - one of the actions available at the specified menu level, like add in Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 117

[admin@MikroTik] ip firewall mangle> /ip firewall filter add chain=forward action=drop unnamed parameter - these are required by some actions and should be entered in fixed order after the action name, like in 10.0.0.1 in [admin@MikroTik] ip firewall mangle> /ping 10.0.0.1 name[=value] - a sequence of parameter names followed by respective values, if required, like ssid=myssid in /interface wireless set wlan1 ssid=myssid

Notes
Variable substitution, command substitution and expressions are allowed only for path_args and unnamed parameter values. prefix, path, action and name[=value] pairs can be given only directly, as a word. Therefore, :put (1 + 2) is valid and :("pu" . "t") 3 is not.

Example
The parts of internal console commands are futher explained in the following examples: /ping 10.0.0.1 count=5 prefix / action ping unnamed parameter 10.0.0.1 name[=value] count=5 .. ip firewall rule inpu t path .. ip firewall rule path_args input :for i from=1 to=10 do={:put $i} prefix : action for unnamed parameter i pname[=value] from=1 to=10 do={:put $i} /interface monitor -traffic ether1,ether2,ipip1 prefix / path interface action monitor-traffic unnamed parameter ether1,ether2,ipip1

Expression Grouping
Description
This feature provides an easy way to execute commands from within one command level, by enclosing them in braces '{ }'.

Notes
Subsequent script commands are executed from the sam e menu level as the entire script. Consider the following example: [admin@MikroTik] ip route> /user { {... /ip route Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 118

{... print} Flags: X - disabled # NAME GROUP ADDRESS 0 ;;; system defaul t user admin full 0.0.0.0/0 1 uuu full 0.0.0.0/0 [admin@MikroTik] ip route> Although the current command level is changed to /ip route, it has no effect on next commands entered from prompt, therefore print command is still considered to be /user print.

Example
The example below demonstrates how to add two users to the user menu. [admin@MikroTik] ip route> /user { {... add name=x password=y group=write {... add name=y password=z group=read {... print} Flags: X - disabled # NAME ADDRESS 0 ;;; system default user admin 0.0.0.0/0 1 x 0.0.0.0/0 2 y 0.0.0.0/0 [admin@MikroTik] ip route>

GROUP

full write read

Variables
Description
RouterOS scripting language suports two types of variables, which are global (system wide) and local (accessible only within the current script), respectively. A variable can be referenced by '$' (dollar) sign followed by the name of the variable with the exception of set and unset commands that take variable name without preceding dollar sign. Variable names should be composed of contain letters, digits and ' -' character. A variable must be declared prior to using it in scripts. There are four types of declaration available: global - defined by global keyword, global variables can be accessed by all scripts and console logins on the same router. However, global variables are not kept across reboots. local - defined by local keyword, local variables are not shared with any othe r script, other instance of the same script or other console logins. The value of local variable value is lost when script finishes. loop index variables - defined within for and foreach statements, these variables are used only in do block of commands and are removed after command completes. monitor variables - some monitor commands that have do part can also introduce variables. You can obtain a list of available variables by placing :environment print statement inside the do block of commands. You can assign a new value to variable using set action. It takes two unnamed parameters: the name of the variable and the new value of the variable. If a variable is no longer needed, it's name can be freed by :unset command. If you free local variable, it's val ue is lost. If you free global variable, it's value is still kept in router, it just becomes inaccessible from current script.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

119

Notes
Loop variables "shadows" already introduced variables with the same name.

Example
[admin@MikroTik] ip route> / [admin@MikroTik] > :global g1 "this is global variable" [admin@MikroTik] > :put $g1 this is global variable [admin@MikroTik] >

Command Substitution and Return Values


Description
Some console commands are most useful if their output can be feed to other commands a s an argument value. In RouterOS console this is done by using the return values from commands. Return values are not displayed on the screen. To get the return value from a command, it should be enclosed in square brackets '[ ]'. Upon execution the return value of the the command will become the value of these brackets. This is called command substitution. The commands that produce return values are, but not limited to: find, which returns a reference to a particular item, ping, which returns the number of sucessful pings, time, which returns the measured time value, incr and decr, which return the new value of a variable, and add, which returns the internal number of newly created item.

Example
Consider the usage of find command: [admin@MikroTik] > /inter face [admin@MikroTik] interface> find type=ether [admin@MikroTik] interface> [admin@MikroTik] interface> :put [find type=ether] *1,*2 [admin@MikroTik] interface> This way you can see internal console numbers of items. Naturally, you can use them as argumen ts in other commands: [admin@MikroTik] interface> enable [find type=ether] [admin@MikroTik] interface>

Operators
Description
RouterOS console can do simple calculations with numbers, time values, IP addresses, strings and lists. To get result from an expression with operators, enclose it in parentheses '(' and ')'. The expression result serves as a return value for the parentheses.

Command Description
- - unary minus. Inverts given number value. - - binary minus. Substracts two numbers, two time values, two IP addresses or an IP address and a number ! - logical NOT. Unary operator, which inverts given boolean value Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 120

/ - division. Binary operator. Divides one number by another (gives number) or a time value by a number (gives time value). . - concatenation. Binary operator, concatenates two string or append one list to another or appends an element to a list. ^ - bitwise XOR. The argumens and the result are both IP addresses ~ - bit inversion. Unary operator, which inverts bits in IP address * - multiplication. Binary operator, which can multiply two numbers or a time value by a number. & - bitwise AND The argumens and the result are both IP addresses && - logical AND. Binary operator. The argumens and the result are both logical values + - binary plus. Adds two numbers, two time values or a number and an IP address. < - less. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value << - left shift. Binary operator, which shifts IP address by a given am ount of bits. The first argument is an IP address, the second is an integer and the result is an IP address. <= - less or equal. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value > - greater. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value >= - greater or equal. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value >> - right shift. Binary operator, which shifts IP address by a given amount of bits. The first argument is an IP address, the second is an integer and the result is an IP address. | - bitwise OR. The argumens and the result are both IP addresses || - logical OR. Binary operator. The argumens and the result are both logical values

Notes
When comparing two arrays note, that two arrays are equal only if their respective elements are equal.

Example
Operator priority and evaluation order [admin@MikroTik] ip firewall rule forward> :put (10 +1-6*2=11-12=2+(-3)=-1) false [admin@MikroTik] ip firewall rule forward> :put (10+1 -6*2=11-12=(2+(-3)=1)) true [admin@MikroTik] ip firewall rule forward logical NOT [admin@MikroTik] interface> :put (!true) false [admin@MikroTik] interface> :put (!(2>3)) true [admin@MikroTik] interface> unary minus [admin@MikroTik] interface> :put ( -1<0) true [admin@MikroTik] > 1 bit inversion [admin@MikroTik] interface> :put (~255.255.0.0) 0.0.255.255 [admin@MikroTik] interface> sum [admin@MikroTik] interface> :put (3ms + 5s) 00:00:05.003 [admin@MikroTik] interface> :put (10.0.0.15 + 0.0.10.0) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 121

cannot add ip address to ip address [admin@MikroTik] interface> :put (10.0.0.15 + 10) 10.0.0.25 [admin@MikroTik] interface> subtraction [admin@MikroTik] interface> :put (15 - 10) 5 [admin@MikroTik] interface> :put (10.0.0.15 - 10.0.0.3) 12 [admin@MikroTik] interface> :put (10.0.0.15 - 12) 10.0.0.3 [admin@MikroTik] interface> :put (15h - 2s) 14:59:58 [admin@MikroTik] interface> multiplication [admin@MikroTik] interface> :put (12s * 4) 00:00:48 [admin@MikroTik] interface> :put ( -5 * -2) 10 [admin@MikroTik] interface> division [admin@MikroTik] interface> :put (10s / 3) 00:00:03.333 [admin@MikroTik] interface> :put (5 / 2) 2 [admin@MikroTik] interface> [admin@MikroTik] > :put (0:0.10 / 3) 00:00:02 [admin@MikroTik] > comparison [admin@MikroTik] interface> :put (10.0.2.3<=2.0.3.10) false [admin@MikroTik] interface> :put (100000s>27h) true [admin@MikroTik] interface> :put (60s,1d!=1m,3600s) true [admin@MikroTik] interface> :put (bridge=routin g) false [admin@MikroTik] interface> :put (yes=false) false [admin@MikroTik] interface> :put (true=aye) false [admin@MikroTik] interface> logical AND, logical OR [admin@MikroTik] interface> :put ((yes && yes) || (yes && no)) true [admin@MikroTik] interface > :put ((no || no) && (no || yes)) false [admin@MikroTik] interface> bitwise AND, bitwise OR, bitwise XOR [admin@MikroTik] interface> :put (10.16.0.134 & ~255.255.255.0) 0.0.0.134 [admin@MikroTik] interface> shift operators [admin@MikroTik] interface> :put (~((0.0.0.1 << 7) - 1)) 255.255.255.128 [admin@MikroTik] interface> Concatenation [admin@MikroTik] interface> :put (1 . 3) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 122

13 [admin@MikroTik] 1,2,3 [admin@MikroTik] 13,4 [admin@MikroTik] 1,2,3,4 [admin@MikroTik] 14 [admin@MikroTik]

interface> :put (1,2 . 3) interface> :put (1 . 3,4) interface> :put (1,2 . 3,4) interface> :put ((1 . 3) + 1) interface>

Data types
Description
The RouterOS console differentiates between several data types, which are string, boolean, number, time interval, IP address, internal number and list. The console tries to convert any value to the most specific type first, backing if it fails. The order in which the console attempts to convert an entered value is presented below: list internal number number IP address time boolean string Internal scripting language supplies special functions to explicitly control type conversion. The toarray, tobool, toid, toip, tonum, tostr and totime functions convert a value accordingly to list, boolean, internal number, IP address, number, string or time. The number type is internally represented as 64 bit signed integer, so the value a number type variable can take is in range from -9223372036854775808 to 9223372036854775807. It is possible to input number value in hexadecimal form, by prefi xing it with 0x, e.g.: [admin@MikroTik] > :global MyVar 0x10 [admin@MikroTik] > :put $MyVar 16 [admin@MikroTik] > Lists are treated as comma separated sequence of values. Putting whitespaces around commas is not recommended, because it might confuse consol e about words' boundaries. Boolean values can be either true or false. Console also accepts yes for true, and no for false. Internal numbers are preceided * sign. Time intervals can be entered either using HH:MM:SS.MS notation, e.g.: [admin@MikroTik] > :pu t 01:12:1.01 01:12:01.010 [admin@MikroTik] > or as sequence of numbers, optionally followed by letters specifying the units of time measure ( d dor days, h for hours, m for minutes, s for seconds and ms for milliseconds), e.g.: [admin@MikroTik] > :put 2d11h 12 2d11:00:12 [admin@MikroTik] > As can bee seen, time values with omitted unit specificators are treated as expressed in seconds. Possible aliases for time units: d, day, days - one day, or 24 hours h, hour, hours - one hour m, min - one minute s - one second ms - one millisecond, id est 0.001 second The console also accepts time values with decimal point: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 123

[admin@MikroTik] > :put 0.1day1.2s 02:24:01.200 [admin@MikroTik] >

Command Reference
Description
RouterOS has a number of built -in console commands and expressions (ICE) that do not depend on the current menu level. These commands do not change configuration directly, but they are useful for automating various maintenance tasks. The full ICE list can be accessed by typing '?' after the ':' prefix ( therefore it can be safely assumed that all ICE have ':' prefix), for example: [admin@MikroTik] > : beep execute global list pick time toip typeof delay find if local put toarray tonum while do for led log resolve tobool tostr environment foreach len nothing set toid totime [admin@MikroTik] >

Command Description
beep - forces the built-in PC beeper to produce a signal for length seconds at frequency Hz. Input Parameters frequency (integer; default: 1000) - signal frequency measured in Hz length (time; default: 100ms) - signal length [admin@MikroTik] > :beep length=2s frequency=10000 [admin@MikroTik] > delay - does nothing for a given amount of time. Input Parameters delay-time (time) - amount of time to wait omitted - delay forever do - executes commands repeatedly until given conditions are met. If no parameters are given, do just executes its payload once, which does not make much use. If a logical conditio n is specified for the while parameter, it will be evaluated after executing commands, and in case it is true, do statement is executed again and again until false. The if parameter, if present, is evaluated only once before doing anything else, and if it is false then no action is taken Input Parameters unnamed (text) - actions to execute repeatedly while (yes | no) - condition, which is evaluated each time after the execution of enclosed statements if (yes | no) - condition, which is evaluated once bef ore the execution of enclosed statements [admin@MikroTik] > {:global i 10; :do {:put $i; :set i ($i - 1);} \ \... while (($i < 11) && ($i > 0)); :unset i;} 10 9 8 7 6 5 4 3 2 1 [admin@MikroTik] > environment print - prints information about variables that are currently initialised. All global variables in the system are listed under the heading Global Variables. All variables that are introduced in the current script Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 124

(variables introduced by :local or created by :for or :foreach statements) are listed under the heading Local Variables. Creating variables and displaying a list of them [admin@MikroTik] > :local A "This is a local variable" [admin@MikroTik] > :global B "This is a global one" [admin@MikroTik] > :environment print Global Variables B=This is a global one Local Variables A=This is a local variable [admin@MikroTik] > find - searches for substring inside a string or for an element with particular value inside an array, depending on argument types and returns position at which the value is found. The elements in list and characters in string are numbered from 0 upwards Input Parameters unnamed(text | list) - the string or value list the search will be performed in unnamed(text) - value to be searched for unnamed(integer) - position after which the search is started [admin@MikroTik] interface pppoe -server> :put [:find "13sdf1sdfss1sfsdf324333" ] 0 [admin@MikroTik] interface pppoe -server> :put [:find "13sdf1sdfss1sfsdf324333" 3 ] 1 [admin@MikroTik] interface pppoe -server> :put [:find "13sdf1sdfss1sfsdf324333" 3 3] 17 [admin@MikroTik] interface pppoe -server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 ] 4 [admin@MikroTik] interface pppoe -server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 3] 4 [admin@MikroTik] interface pppoe -server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 4] 5 [admin@MikroTik] interface pppoe -server> :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 5] 15 [admin@MikroTik] for - executes supplied commands over a given number of iterations, which is explicity set through from and to parameters Input Parameters unnamed (name) - the name of the loop counter variable from (integer) - start value of the loop counter variable to (integer) - end value of the loop counter variable step (integer; default: 1) - increment value. Depending on the loop counter variable start and end values, step parameter can be treated also as decrement do (text) - contains the command to be executed repeatedly [admin@MikroTik] > :for i from=1 to=100 step=37 do={:put ($i . " - " . 1000/$i)} 1 - 1000 38 - 26 75 - 13 [admin@MikroTik] > foreach - executes supplied commands for each element in list Input Parameters unnamed (name) - the name of the loop counter variable Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 125

in (list) - list of values over which to iterate do (text) - contains the command to be executed repeatedly Printing a list of available interfaces with their respective IP addresses :foreach i in=[/interface find type=ether ] \ \... do={:put ("+--" . [/interface get $i name]); \ \... :foreach j in=[/ip address find interface=$i] \... do={:put ("| ` --" . [/ip address get $j address])}} +--ether1 | `--1.1.1.3/24 | `--192.168.50.1/24 | `--10.0.0.2/24 +--ether2 | `--10.10.0.2/24 [admin@MikroTik] > global - declares global variable Input Parameters unnamed(name) - name of the variable unnamed(text) - value, which should be assigned to the variable [admin@MikroTik] > :global MyString "This is a string" [admin@MikroTik] > :global IPAddr 10.0.0.1 [admin@MikroTik] > :global time 0:10 [admin@MikroTik] > :environment print Global Variables IPAddr=10.0.0.1 time=00:10:00 MyString=This is a string Local Variables [admin@MikroTik] > if - conditional statement. If a given logical condition evaluates to true then the do block of commands is executed. Otherwice an optional else block is executed. Input Parameters unnamed(yes | no) - logical condition, which is evaluated once before the execution of enclosed statements do(text) - this block of commands is executed if the logical condition evaluates to true else(text) - this block of commands is executed if the logical condition evaluates to false Check if the firewall has any rules added [admin@MikroTik] > :if ([:len [/ip firewall filter find]] > 0) do={:put true} else={:put false} true [admin@MikroTik] > Check whether the gateway is reachabl e. In this example, the IP address of the gateway is 10.0.0.254 [admin@MikroTik] > :if ([/ping 10.0.0.254 count=1] = 0) do {:put "gateway unreachable"} 10.0.0.254 ping timeout 1 packets transmitted, 0 packets received, 100% packet loss gateway unreachable [admin@MikroTik] > led - allows to control the LEDs (Light Emitting Diodes) of the RouterBOARD 200 series embedded boards. This command is available only on RouterBoard 200 platform with the routerboard package installed Input Parameters led1(yes | no) - controls first LED led2(yes | no) - controls second LED led3(yes | no) - controls third LED led4(yes | no) - controls fourth LED length(time) - specifies the length of the action omitted - altar LED state forever Switch on LEDs 2 and 3 for 5 seconds [admin@MikroTik] > :led led2=yes led3=yes length=5s len - returns the number of characters in string or the number of elements in list depending on the type of the argument Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 126

Input Parameters unnamed(name) - string or list the length of which should be returned [admin@MikroTik] > :put [:len gvejimezyfopmekun] 17 [admin@MikroTik] > :put [:len gve,jim,ezy,fop,mek,un] 6 [admin@MikroTik] > list - displays a list of all available console commands that match given search key(s) Input Parameters unnamed(text) - first search key unnamed(text) - second search key unnamed(text) - third search key Display console commands that have hotspot, add and user parts in the command's name and path [admin@MikroTik] > :list user hotspot "add " List of console commands under "/" ma tching "user" and "hotspot" and "add ": ip hotspot profile add name= hotspot -address= dns-name= \ \... html-directory= rate-limit= http-proxy= smtp-server= \ \... login-by= http-cookie-lifetime= ssl-certificate= split -user-domain= \ \... use-radius= radius-accounting= radius -interim-update= copy-from= ip hotspot user add server= name= password= address= mac -address= \ \... profile= routes= limit -uptime= limit-bytes-in= limit-bytes-out= \ \... copy-from= comment= disabled= ip hotspot user profile add name= address-pool= session-timeout= \ \... idle-timeout= keepalive -timeout= status-autorefresh= \ \... shared-users= rate-limit= incoming-filter= outgoing-filter= \ \... incoming-mark= outgoing-mark= open-status-page= on-login= on-logout= copy-from= [admin@MikroTik] > local - declares local variable Input Parameters unnamed(name) - name of the variable unnamed(text) - value, which should be assigned to the variable [admin@MikroTik] > :local MyString "This is a string" [admin@MikroTik] > :local IPAddr 10.0.0.1 [admin@MikroTik] > :local time 0:10 [admin@MikroTik] > :environment print Global Variables Local Variables IPAddr=10.0.0.1 time=00:10:00 MyString=This is a string [admin@MikroTik] > log - adds a message specified by message parameter to the system logs. Input Parameters unnamed(name) - name of the logging facility to send message to unnamed(text) - the text of the message to be logged Send message to info log [admin@MikroTik] > :log info "Very Good thing happened. We have received our first packet!" [admin@MikroTik] > /log print follow ... 19:57:46 script,info Very Good thing happened. We have received our first packet! ... nothing - has no action, and returns value of type "nothing". In conditions nothing behaves as "false" Pick a symbol that does not exist from a string [admin@MikroTik] > :local string qwerty Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 127

[admin@MikroTik] > :if ([:pick $string 10]=[:nothing]) do={ {... :put "pick and nothing commands return the same value"} pick and nothing commands return the same value [admin@MikroTik] > pick - returns a range of elements or a substring depending on the type of input value Input Parameters unnamed(text | list) - the string or value list from which a substring or a subrange should be returned unnamed(integer) - start position of substring or subra nge unnamed(integer) - end position for substring or subrange [admin@MikroTik] > :set a 1,2,3,4,5,6,7,8 [admin@MikroTik] > :put [:len $a] 8 [admin@MikroTik] > :put [:pick $a] 1 [admin@MikroTik] > :put [:pick $a 0 4] 1,2,3,4 [admin@MikroTik] > :put [ :pick $a 2 4] 3,4 [admin@MikroTik] > :put [:pick $a 2] 3 [admin@MikroTik] > :put [:pick $a 5 1000000] 6,7,8 [admin@MikroTik] > :set a abcdefghij [admin@MikroTik] > :put [:len $a] 10 [admin@MikroTik] > :put [:pick $a] a [admin@MikroTik] > :put [:pick $a 0 4] abcd [admin@MikroTik] > :put [:pick $a 2 4] cd [admin@MikroTik] > :put [:pick $a 2] c [admin@MikroTik] > :put [:pick $a 5 1000000] fghij put - echoes supplied argument to the console Input Parameters unnamed(text) - the text to be echoed to the console Display the MTU of ether1 interface [admin@MikroTik] > :put [/interface get ether1 mtu] 1500 [admin@MikroTik] > resolve - returns IP address of the host resolved from the DNS name. The DNS settings shou ld be configured on the router (/ip dns submenu) prior to using this command. Input Parameters unnamed(text) - domain name to be resolved into an IP address DNS configuration and resolve command example [admin@MikroTik] ip route> /ip dns set primary -dns=159.148.60.2 [admin@MikroTik] ip route> :put [:resolve www.example.com] 192.0.34.166 set - assigns new value to a variable Input Parameters unnamed(name) - the name of the variable unnamed(text) - the new value of the variable Measuring time needed to re solve www.example.com [admin@MikroTik] > :put [:time [:resolve www.example.com ]] 00:00:00.006 [admin@MikroTik] > time - measures the amount of time needed to execute given console commands Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 128 Referensi : Download :www.mikrotik.com

Input Parameters unnamed(text) - the console commands to measure execution time of Measuring time needed to resolve www.example.com [admin@MikroTik] > :put [:time [:resolve www.example.com ]] 00:00:00.006 [admin@MikroTik] > while - executes given console commands repeatedly while the logical conditions is true Input Parameters unnamed(yes | no) - condition, which is evaluated each time before the execution of enclosed statements do(text) - console commands that should be executed repeatedly [admin@MikroTik] > :set i 0; :while ($i < 10) do={:put $i; :set i ($i + 1)}; 0 1 2 3 4 5 6 7 [admin@MikroTik] >

Special Commands
Description
Monitor It is possible to access values that are shown by most monitor actions from scripts. A monitor command that has a do parameter can be supplied either script name (see /system scripts), or console commands to execute. Get Most print commands produce values that are accessible from scripts. Such print commands have a corresponding get command on the same menu level. The get command accepts one parameter when working with regular values or two parameters when working with lists.

Notes
Monitor command with do argument can also be called directly from scripts. It will not print anything then, just execute the given script. The names of the properties that can be accessed by get are the same as shown by print command, plus names of item flags (like the disabled in the example below). You can use [T ab] key completions to see what properties any particular get action can return.

Example
In the example below monitor action will execute given script each time it prints stats on the screen, and it will assign all printed values to local variables with the same name: [admin@MikroTik] interface> monitor -traffic ether2 once do={:environment print} received-packets-per-second: 0 received-bits-per-second: 0bps sent-packets-per-second: 0 sent-bits-per-second: 0bps Global Variables Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 129

i=1 Local Variables sent-bits-per-second=0 received-packets-per-second=0 received-bits-per-second=0 sent-packets-per-second=0 [admin@MikroTik] interface>

Additional Features
Description
To include comment in the console script prefix it with '#'. In a line of script that starts with '#' all characters until the newline character are ignored. To put multiple commands on a single line separat e them with ';'. Console treats ';' as the end of line in scripts. Any of the {}[]"'\$ characters should be escaped in a reqular string with ' \' character. Console takes any character following '\' literally, without assigning any special meaning to it, ex cept for such cases: \a bell (alarm), character code 7 \b backspace, character code 8 \f form feed, character code 12 \n newline, character code 10 \r carriage return, character code 13 \t tabulation, character code 9 \v vertical tabulation, character code 11 \_ space, character code 32 Note that '\', followed by any amount of whitespace characters (spaces, newlines, carriage returns, tabulations), followed by newline is treated as a single whitespace, except inside quotes, w here it is treated as nothing. This is used by console to break up long lines in scripts generated by export commands.

Script Repository
Submenu level: /system script

Description
All scripts are stored in the /system script menu along with some service i nformation such as script name, script owner, number of times the script was executed and permissions for particular script. In RouterOS, a script may be automatically started in three different ways: via the scheduler on event occurence - for example, the netwatch tool generates an event if a network host it is configured to monitor becomes unaccessible by another script It is also possible to start a script manually via /system script run command.

Property Description
last-started (time) - date and time when the script has been last invoked. The argument is shown only if the run-count!=0. owner (name; default: admin) - the name of the user who created the script policy (multiple choice: ftp | local | policy | read | reboot | ssh | telnet | test | web | write; default: reboot,read,write,policy,test ) - the list of the policies applicable: ftp - user can log on remotely via ftp and send and retrieve files from the router local - user can log on locally via console policy - manage user policies, add and remove user read - user can retrieve the configuration Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 130

reboot - user can reboot the router ssh - user can log on remotely via secure shell telnet - user can log on remotely via telnet test - user can run ping, traceroute, bandwidth test web - user can log on remotely via http write - user can retrieve and change the configuration run-count (integer; default: 0) - script usage counter. This counter is incremented each time the script is executed. The counter will reset after reboot. source (text; default: "") - the script source code itself

Command Description
run (name) - executes a given script Input Parameters unnamed(name) - the name of the script to execute

Notes
You cannot do more in scripts than you are allowed to do by your current us er rights, that is, you cannot use disabled policies. For example, if there is a policy group in /user group which allows you ssh,local,telnet,read,write,policy,test,web and this group is assigned to your user name, then you cannot make a script that reboots the router.

Example
The following example is a script for writing message "Hello World!" to the info log: [admin@MikroTik] system script> add name="log -test" source={:log info "Hello World!"} [admin@MikroTik] system script> run log -test [admin@MikroTik] system script> print 0 name="log-test" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password last started=mar/20/2001 22:51:41 run-count=1 source=:log info "Hello World!" [admin@MikroTik] system script>

Task Management
Submenu level: /system script job

Description
This facility is used to manage the active or scheduled tasks.

Property Description
name (read-only: name) - the name of the script to be referenced when invoking it owner (text) - the name of the user who created the s cript source (read-only: text) - the script source code itself

Example
[admin@MikroTik] system script> job print Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 131

# SCRIPT OWNER 0 DelayeD admin

STARTED dec/27/2003 11:17:33

[admin@MikroTik] system script> You can cancel execution of a script by removing it from the job list [admin@MikroTik] system script> job remove 0 [admin@MikroTik] system script> job print [admin@MikroTik] system script>

Script Editor
Command name: /system script edit

Description
RouterOS console has a simple full-screen editor for scripts with support for multiline script writing. Keyboard Shortcuts Delete - deletes character at cursor position Ctrl+h, backspase - deletes character before cursor. Unindents line Tab - indents line Ctrl+b, LeftArrow - moves cursor left Ctrl+f, RightArrow - moves cursor right Ctrl+p, UpArrow - moves cursor up Ctrl+n, DownArrow - moves cursor down Ctrl+a, Home - moves cursor to the beginning of line or script Ctrl+e, End - moves cursor to the end of lin e or script Ctrl+y - inserts contents of buffer at cursor position Ctrl+k - deletes characters from cursor position to the end of line Ctrl+u - undoes last action Ctrl+o - exits editor accepting changes Ctrl+x - exits editor discarding changes

Command Description
edit (name) - opens the script specified by the name argument in full-screen editor

Notes
All characters that are deleted by backspace, delete or Ctrl+k keys are accumulated in the buffer. Pressing any other key finishes adding to this bu ffer (Ctrl+y can paste it's contents), and the next delete operation will replace it's contents. Undo doesn't change contents of cut buffer. Script editor works only on VT102 compatible terminals (terminal names "vt102", "linux", "xterm", "rxvt" are recognized as VT102 at the moment). Delete, backspace and cursor keys might not work with all terminal programs, use 'Ctrl' alternatives in such cases.

Example
The following example shows the script editor window with a sample script open: This script is used for writing message "hello" and 3 messages "kuku" to the system log.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

132

BAB XVIII UPS Monitor


General Information
Summary
The UPS monitor feature works with APC UPS units t hat support smart signaling over serial RS232 or USB connection. This feature enables the network administrator to monitor the UPS and set the router to gracefully handle any power outage with no corruption or damage to the router. The basic purpose of this feature is to ensure that the router will come back online after an extended power failure. To do this, the router will monitor the UPS and set itself to hibernate mode when the utility power is down and the UPS battery is has less than 10% of its battery power left. The router will then continue to monitor the UPS (while in hibernate mode) and then restart itself after when the utility power returns. If the UPS battery is drained and the router loses all power, the router will power back to full oper ation when the utility power returns. The UPS monitor feature on the MikroTik RouterOS supports hibernate and safe reboot on power and battery failure UPS battery test and run time calibration test monitoring of all "smart" mode status information supp orted by UPS logging of power changes

Specifications
Packages required: ups License required: Level1 Submenu level: /system ups Standards and Technologies: APC's smart protocol Hardware usage: Not significant

Related Documents
Software Package Management

Description
Cabling The APC UPS (BackUPS Pro or SmartUPS) requires a special serial cable. If no cable came with the UPS, a cable may be ordered from APC or one can be made "in -house". Use the following diagram: Router Side (DB9f) Signal Direction UPS Side (DB9m) 2 Receive IN 2 3 Send OUT 1 5 Ground 4 7 CTS IN 6 Note that you may also connect with USB if available.

UPS Monitor Setup


Submenu level: /system ups Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 133

Property Description
alarm-setting (delayed | immediate | low-battery | none; default: immediate) - UPS sound alarm setting: delayed - alarm is delayed to the on-battery event immediate - alarm immediately after the on -battery event low-battery - alarm only when the battery is low none - do not alarm load (read-only: percentage) - the UPS's output load as a percentage of full rated load in Watts. The typical accuracy of this measurement is 3% of the maximum of 105% manufacture-date (read-only: text) - the UPS's date of manufacture in the format "mm/dd/yy" (month, day, year) min-runtime (time; default: 5m) - minimal run time remaining. After a 'utility' failure, the router will monitor the runtime-left value. When the value reaches the min-runtime value, the router will go to hibernate mode 0 - the router will go to hibernate mode when the "battery low" signal is sent indicating that the battery power is below 10% model (read-only: text) - less than 32 ASCII character string consisting of the UPS model name (the words on the front of the UPS itself) nominal-battery-voltage (read-only: integer) - the UPS's nominal battery voltage rating (this is not the UPS's actual battery voltage) offline-time (time; default: 5m) - how long to work on batteries. The router waits that amount of time and then goes into hibernate mode until the UPS reports that the 'utility' power is back 0 - the router will go into hibernate mode according the min-runtime setting and 10% of battery power even t. In this case, the router will wait until the UPS reports that the battery power is below 10% port (name) - communication port of the router serial (read-only: text) - a string of at least 8 characters directly representing the UPS's serial number as s et at the factory. Newer SmartUPS models have 12 -character serial numbers version (read-only: text) - UPS version, consists of three fields: SKU number, firmware revision, country code. The county code may be one of the following: I - 220/230/240 Vac D - 115/120 Vac A - 100 Vac M - 208 Vac J - 200 Vac

Notes
In order to enable UPS monitor, the serial port should be available.

Example
To enable the UPS monitor for port serial1: [admin@MikroTik] system ups> add port=serial1 disabled=no [admin@MikroTik] system ups> print Flags: X - disabled, I - invalid 0 name="ups" port=serial1 offline -time=5m min-runtime=5m alarm-setting=immediate model="SMART -UPS 1000" version="60.11.I" serial="QS0030311640" manufacture -date="07/18/00" nominal-battery-voltage=24V [admin@MikroTik] system ups>

Runtime Calibration
Command name: /system ups rtc

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

134

Description
The rtc command causes the UPS to start a run time calibration until less than 25% of full battery capacity is reached. This command calibrates the returned run time value.

Notes
The test begins only if the battery capacity is 100%.

Example
[admin@MikroTik] system ups> rtc 0

UPS Monitoring
Command name: /system ups monitor

Property Description
battery-charge (percentage) - the UPS's remaining battery capacity as a percent of the fully charged condition battery-voltage - the UPS's present battery voltage. The typical accuracy of this measurement is 5% of the maximum value (depending on the UPS's nominal battery voltage) frequency (percentage) - when operating on-line, the UPS's internal operating frequency is synchronized to the line within variations within 3 Hz of the nominal 50 or 60 Hz. The typical accuracy of this measurement is 1% of the full scale value of 63 Hz line-voltage - the in-line utility power voltage load (percentage) - the UPS's output load as a percentage of full rated load in Watts. The typical accuracy of this measurement is 3% of the maximum of 105% low-battery - only shown when the UPS reports this status on-battery (yes | no) - Whether UPS battery is supplying power on-line (yes | no) - whether power is being provided by the external utility (power company) output-voltage - the UPS's output voltage overloaded-output - only shown when the UPS reports this status replace-battery - only shown when the UPS reports this status runtime-calibration-running - only shown when the UPS reports this status runtime-left (time) - the UPS's estimated remaining run time in minutes. You can query the UPS when it is operating in the on-line, bypass, or on-battery modes of operation. The UPS's remaining run time reply is based on available battery capacity and output load smart-boost-mode - only shown when the UPS reports this status smart-ssdd-mode - only shown when the UPS r eports this status transfer-cause (text) - the reason for the most recent transfer to on -battery operation (only shown when the unit is on-battery)

Example
When running on utility power: [admin@MikroTik] system ups> monitor 0 on-line: yes on-battery: no RTC-running: no runtime-left: 20m battery-charge: 100% battery-voltage: 27V line-voltage: 226V output-voltage: 226V load: 45% Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

135

temperature: frequency: replace-battery: smart-boost: smart-trim: overload: low-battery:

39C 50Hz no no no no no

[admin@MikroTik] system ups> When running on battery: [admin@MikroTik] system ups> monitor 0 on-line: no on-battery: yes transfer-cause: "Line voltage no tch or spike" RTC-running: no runtime-left: 19m offline-after: 4m46s battery-charge: 94% battery-voltage: 24V line-voltage: 0V output-voltage: 228V load: 42% temperature: 39C frequency: 50Hz replace-battery: no smart-boost: no smart-trim: no overload: no low-battery: no [admin@MikroTik] system ups>

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

136

BAB XIX IP Telephony


General Information
Summary
The MikroTik RouterOS IP Telephony featur e enables Voice over IP (VoIP) communications using routers equipped with the following voice port hardware: Quicknet LineJACK or PhoneJACK analog telephony cards ISDN cards Voicetronix OpenLine4 (was V4PCI) - 4 analog telephone lines cards Zaptel Wildcard X100P IP telephony card - 1 analog telephone line

Specifications
Packages required: telephony License required: Level1 Submenu level: /ip telephony Standards and Technologies: RTP Hardware usage: Pentium MMX level processor recommended

Related Documents
Package Management ISDN AAA

Description
IP telephony, known as Voice over IP (VoIP), is the transmission of telephone calls over a data network like one of the many networks that make up the Internet. There are four ways that you might talk to someone using VoIP: Computer-to-computer - This is certainly the easiest way to use VoIP, and you do n't have to pay for long-distance calls. Computer-to-telephone - This method allows you to call anyone (who has a phone) from your computer. Like computer-to-computer calling, it requires a software client. The software is typically free, but the calls ma y have a small per-minute charge. Telephone-to-computer - Allows a standard telephone user to initiate a call to a computer user. Telephone-to-telephone - Through the use of gateways, you can connect directly with any other standard telephone in the worl d. Suppoted hardware: Quicknet Technologies cards: Internet PhoneJACK (ISA or PCI) for connecting an analog telephone (FXS port) Internet LineJACK (ISA) for connecting an analog telephone line (FXO port) or a tele phone (FXS port) ISDN client cards (PCI) for connecting an ISDN line. See Device Driver List for the list of supported PCI ISDN cards Voicetronix OpenLine4 card for connecting four (4) analog telephone lines (FXO ports) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 137

Zaptel Wildcard X100P IP telephony card (from Linux Support Services) for connecting one analog telephone line (FXO port) Supported standards: MikroTik RouterOS supports IP Telephony in compliance with the International Telecommunications Union - Telecommunications (ITU-T) specification H.323v4. H.323 is a specification for transmitting multimedia (voice, video, and data) across an IP network. H.323v4 includes: H .245, H.225, Q.931, H.450.1, RTP(real-time protocol) The followong audio codecs are supported: G.711 (the 64 kbps Pulse code modulation (PCM) voice coding), G.723.1 (the 6.3 kbps compression technique that can be used for compressing audio signal at very low bit rate), GSM-06.10 (the 13.2 kbps coding), LPC-10 (the 2.5 kbps coding), G.729 and G.729a (the 8 kbps CS-ACELP software coding), G.728 (16 kbps coding technique, supported only on Quicknet LineJACK cards) In PSTN lines there is a known delay of the signal caused by switching and signal compressing devices of the telephone network (so, it depends on the distance between the peers), which is generally rather low. The delay is also present in IP networks. The main difference between a PSTN and an IP net work is that in IP networks that delay is more random. The actual packet delay may vary in order of magnutude in congested networks (if a network becomes congested, some packets may even be lost). Also packet reordering may take place. To prevent signal loss, caused by random jitter of IP networks and packet reordering, to corrupt audio signal, a jitter buffer is present in IP telephony devices. The jitter buffer is delaying the actual playback of a received packet forming The larger the jitter buffer, the larger the total delay, but fewer packets get lost due to timeout. The total delay from the moment of recording the voice signal till its playback is the sum of following three delay times: delay time at the recording point (approx. 38ms) delay time of the IP network (1..5ms and up) delay time at the playback point (the jitter delay)

Notes
Each installed Quicknet card requires IO memory range in the following sequence: the first card occupies addresses 0x300-0x31f, the second card 0x320 -0x33f, the third 0x340-0x35f, and so on. Make sure there is no conflict in these ranges with other devices, e.g., network interface cards, etc. Use the telephony logging feature to debug your setup.

Additional Resources
IP Telephony Online

General Voice port settings


Submenu level: /ip telephony voice-port

Description
This submenu is used for managing all IP telephony voice ports (linejack, phonejack, isdn, voip, voicetronix, zaptel)

Property Description
name (name) - assigned name of the voice port type (read-only: phonejack | linejack | phonejack-lite | phonejack-pci | voip | isdn | voicetronix | zaptel) - type of the installed telephony voice port: phonejack - Quicknet PhoneJACK (ISA) linejack - Quicknet LineJACK (ISA) phonejack-lite - Quicknet PhoneJACK Lite Linux Edition (ISA) phonejack-pci - Quicknet PhoneJACK (PCI) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 138

voip - generic Voice over IP port isdn - ISDN cards voicetronix - Voicetronix OpenLine4 zaptel - Zaptel Wildcard X100P autodial (integer; default: "") - number to be dialed automatically, if call is coming in from this voice port

Notes
If autodial does not exactly match an item in /ip telephony numbers, there can be two possibilities: if autodial is incomplete, rest of the number is asked (local voice port) or incoming call is denied (VoIP) if autodial is invalid, line is hung up (PSTN line), busy tone is played (POTS) or incoming call is denied (VoIP)

Voicetronix Voice Ports


Submenu level: /ip telephony voice-port voicetronix

Property Description
name (name) - name given by the user or the default one autodial (integer; default: "") - phone number which will be dialed immediately after the handset has been lifted. If this number is incomplete, then the remaining part has to be dialed on the dial-pad. If the number is incorrect, the line is hung up. If the number is correct, then the appropriate number is dialed (the direct -call mode is used - the line is picked up only after the remote party answers the call) playback-volume (integer: -48..48; default: 0) - playback volume in dB 0 - 0dB meand no change to signal level record-volume (integer: -48..48; default: 0) - record volume in dB 0 - 0dB meand no change to signal level region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs) agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs) detect-cpt (yes | no; default: no) - automatically detect call progress tones balance-registers (integer: 0..255; default: 199) - registers which depend on telephone line impedance. Can be adjusted to get best echo cancellation. Should be changed only if echo cancellation on voicetronix card does not work good enough. Echo cancellation problems can imply DTMF and busy -tone detection failures. The value has to be in format bal1[,bal3[,bal2]], where bal1, bal2, bal3 - balance registers. bal1 has to be in interval 192..248 (0xC0..0xF8). The others should be in interval 0..255 (0x00..0xFF) balance-status (read-only: integer; default: unknown) - shows quality of hardware echo cancellation in dB loop-drop-detection (yes | no; default: yes) - automatically clear call when loop drop is detected

Command Description
test-balance - current balance-registers value is tested once. Result is placed in balance-status parameter. Balance can be tested only when line is off -hook. It won't work if line is on -hook or there is an established connection Input Parameters unnamed (name) - port name to test balance of find-best-balance - series of test-balance is executed with different balance-registers values. During the tests balance-registers are updated to the best values found Input Parameters unnamed (name) - port name to find best balance of clear-call - terminate a current call established with the specified voice port Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 139 Referensi : Download :www.mikrotik.com

Input Parameters unnamed (name) - port name to clear call with show-stats - show voice port statistics Input Parameters unnamed (name) - port name show statistics of Return Values round-trip-delay (time) - maximal time of packet round trip packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port) bytes-sent (integer) - number of bytes sent by this card (these packets are digitalized input of the voice p ort) sent-time (text) - minimal/average/maximal intervals between packets sent packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port) bytes-received (integer) - number of bytes received by this card (these packets form analog output of the voice port) received-time (text) - minimal/average/maximal intervals between packets received average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. The value shown is never less than 30ms, although the actual delay time could be less. If the shown value is >40ms, then it is close (+/ -1ms) to the actual delay time. monitor - monitor status of the voice port Input Parameters unnamed (name) - port name to monitor Return Values status (on-hook | off-hook | ring | connection | busy) - current state of the port: on-hook - the handset is onhook, no activity off-hook - the handset is off-hook, the number is being dialed ring - call in progress, direction of the call is shown by the direction property connection - the connection has been established busy - the connection has been terminated, the handset is still off -hook directiopn (ip-to-port | port-to-ip) - direction of the call ip-to-port - call from the IP network to the voice card port-to-ip - call from the voice card to an IP address phone-number (integer) - the phone number being dialed remote-party-name (text) - name and IP address of the remote party codec (name) - CODEC used for the audio connection duration (time) - duration of the phone call

Notes
As some Voicetronix cards fail to detect loop drop correctly, with loop-drop-detection you can manage whether loop drop detection feature is enabled. The effect of not working loop -drop detection is call terminated at once when connection is established. Some tips for testing balance registers: test is sensitive to noise from the phone, so it's recommended to cover mouth piece durin g it; find-best-balance can be interrupted by clear-call command; once best balance-registers value is known, it can be set manually to this best value for all voicetronix voice ports, which will use the same telephone line.

LineJack Voice Ports


Submenu level: /ip telephony voice-port linejack

Property Description
name (name) - name given by the user or the default one autodial (integer; default: "") - phone number which will be dialed immediately after the handset has been lifted. If this number is incomplete, then the remaining part has to be dialed on the dial -pad. If the number is Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 140

incorrect, the line is hung up (FXO "line" port) or busy tone is played (FXS "phone" port). If the number is correct, then the appropriate number is dialed. If it is an i ncomming call from the PSTN line, then the direct -call mode is used - the line is picked up only after the remote party answers the call playback-volume (integer: -48..48; default: 0) - playback volume in dB 0 - 0dB meand no change to signal level record-volume (integer: -48..48; default: 0) - record volume in dB 0 - 0dB meand no change to signal level ring-cadence (text) - a 16-symbol ring cadence for the phone, each symbol lasts 0.5 seconds, + means ringing, means no ringing region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones aec (yes | no) - whether echo detection and cancellation is enabled aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection aec-nlp-threshold (off | low | medium | high; default: low) - level of cancellation of silent sounds aec-attenuation-scaling (integer: 0..10; default: 4) - factor of additional echo attenua tion aec-attenuation-boost (integer: 0..90; default: 0) - level of additional echo attenuation software-aec (yes | no) - software echo canceller (experimental, for most of the cards) agc-on-playback (yes | no; default: no) - automatic gain control on pl ayback (can not be used together with hardware voice codecs) agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs) detect-cpt (yes | no; default: no) - automatically detect call progress tones

Command Description
blink - blink the LEDs of the specified voice port for five seconds after it is invoked. This command can be used to locate the respective card from several linejack cards Input Parameters unnamed (name) - card name to blink the LED of clear-call - terminate a current call established with the specified voice port Input Parameters unnamed (name) - port name to clear call with show-stats - show voice port statistics Input Parameters unnamed (name) - port name show statistics of Return Values round-trip-delay (time) - maximal time of packet round trip packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port) bytes-sent (integer) - number of bytes sent by this c ard (these packets are digitalized input of the voice port) sent-time (text) - minimal/average/maximal intervals between packets sent packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port) bytes-sent (integer) - number of bytes received by this card (these packets form analog output of the voice port) sent-time (text) - minimal/average/maximal intervals between packets received average-jitter-delay (time) - approximate delay time from t he moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. The value shown is never less than 30ms, although the actual delay time could be less. If the shown value is >40ms, then it is close (+/ -1ms) to the actual delay time. monitor - monitor status of the voice port Input Parameters unnamed (name) - port name to monitor Return Values status (on-hook | off-hook | ring | connection | busy) - current state of the port: on-hook - the handset is onhook, no activity off-hook - the handset is off-hook, the number is being dialed ring - call in progress, direction of the call is shown by the direction property connection - the connection has been established busy - the connection has been terminated, the h andset is still off-hook port (phone | line) - the active port of the card phone - telephone connected to the card (POTS FXS port) line Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 141

line connected to the card (PSTN FXO port) directiopn (ip-to-port | port-to-ip) - direction of the call ip-to-port - call from the IP network to the voice card port-to-ip - call from the voice card to an IP address line-status (plugged | unplugged) - state of the PSTN line plugged - the telephone line is connected to the PSTN port of the card unplugged - there is no working line connected to the PSTN port of the card phone-number (integer) - the phone number being dialed remote-party-name (text) - name and IP address of the remote party codec (name) - CODEC used for the audio connection duration (time) - duration of the phone call

Notes
When telephone line is connected to the 'line' port, green LED next to the port should be lit in some seconds. If telephone line disappear, the LED next to the 'line' port will change its state to red in an hour or when the line is activated (i.e. when somebody calls to/from it). When telephone line is plugged in the 'phone' port before the router is turned on, red LED next to the port will be lit. WARNING: do not plug telephone line into the 'phone' port when the router is running and green LED next to the port is lit - this might damage the card. The status of the 'phone' port is only detected on system startup.

PhoneJack Voice Ports


Submenu level: /ip telephony voice-port phonejack

Property Description
name (name) - name given by the user or the default one type (read-only: phonejack | phonejack-lite | phonejack-pci) - type of the card autodial (integer; default: "") - phone number which will be dialed immediately after the handset has been lifted. If this number is incomplete, then the remaining part has to be dialed on the dial -pad. If the number is incorrect, busy tone is played. If the number is correct, then the appropriate number is dialed playback-volume (integer: -48..48; default: 0) - playback volume in dB 0 - 0dB meand no change to signal level record-volume (integer: -48..48; default: 0) - record volume in dB 0 - 0dB meand no change to signal level ring-cadence (text) - a 16-symbol ring cadence for the phone, each symbol lasts 0.5 seconds, + means ringing, means no ringing region (name; default: us) - regional setting for the voice port. This setting is used for generating the dial tones aec (yes | no) - wheteher echo detection and cancellation is enabled aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection aec-nlp-threshold (off | low | medium | high; default: low) - level of cancellation of silent sounds aec-attenuation-scaling (integer: 0..10; default: 4) - factor of additional echo attenuation aec-attenuation-boost (integer: 0..90; default: 0) - level of additional echo attenuation software-aec (yes | no) - software echo canceller (experimental, for most of the cards) agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used t ogether with hardware voice codecs) agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs) detect-cpt (yes | no; default: no) - automatically detect call progress tones

Command Description
clear-call - terminate a current call established with the specified voice port Input Parameters unnamed (name) - port name to clear call with show-stats - show voice port statistics Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 142

Input Parameters unnamed (name) - port name show statistics of Return Values round-trip-delay (time) - maximal time of packet round trip packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port) bytes-sent (integer) - number of bytes sent by this card (th ese packets are digitalized input of the voice port) sent-time (text) - minimal/average/maximal intervals between packets sent packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port) bytes-sent (integer) - number of bytes received by this card (these packets form analog output of the voice port) sent-time (text) - minimal/average/maximal intervals between packets received average-jitter-delay (time) - approximate delay time from the mome nt of receiving an audio packet from the IP network till it is played back over the telephony voice port. The value shown is never less than 30ms, although the actual delay time could be less. If the shown value is >40ms, then it is close (+/ -1ms) to the actual delay time. monitor - monitor status of the voice port Input Parameters unnamed (name) - port name to monitor Return Values status (on-hook | off-hook | ring | connection | busy) - current state of the port: on-hook - the handset is onhook, no activity off-hook - the handset is off-hook, the number is being dialed ring - call in progress, direction of the call is shown by the direction property connection - the connection has been established busy - the connection has been terminated, the handset is still off-hook port (phone | line) - the active port of the card phone - telephone connected to the card (POTS FXS port) line line connected to the card (PSTN FXO port) directiopn (ip-to-port | port-to-ip) - direction of the call ip-to-port - call from the IP network to the voice card port-to-ip - call from the voice card to an IP address line-status (plugged | unplugged) - state of the PSTN line plugged - the telephone line is connected to the PSTN port of the card unplugged - there is no working line connected to the PSTN port of the card phone-number (integer) - the phone number being dialed remote-party-name (text) - name and IP address of the remote party codec (name) - CODEC used for the audio connection duration (time) - duration of the phone call

Zaptel Voice Ports


Submenu level: /ip telephony voice-port zaptel

Property Description
name (name) - name given by the user or the default one autodial (integer; default: "") - phone number which will be dialed immediately after the handset ha s been lifted. If this number is incomplete, then the remaining part has to be dialed on the dial -pad. If the number is incorrect, the line is hung up. If the number is correct, then the appropriate number is dialed (the direct -call mode is used - the line is picked up only after the remote party answers the call) playback-volume (integer: -48..48; default: 0) - playback volume in dB 0 - 0dB meand no change to signal level record-volume (integer: -48..48; default: 0) - record volume in dB 0 - 0dB meand no change to signal level region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones aec (yes | no) - wheteher echo detection and cance llation is enabled aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection aec-nlp-threshold (off | low | medium | high; default: low) - level of cancellation of silent sounds aec-attenuation-scaling (integer: 0..10; default: 4) - factor of additional echo attenuation aec-attenuation-boost (integer: 0..90; default: 0) - level of additional echo attenuation Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 143

software-aec (yes | no) - software echo canceller (experimental, for most of the cards) agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs) agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs) detect-cpt (yes | no; default: no) - automatically detect call progress tones

Command Description
clear-call - terminate a current call established with the specified voice port Input Parameters unnamed (name) - port name to clear call with show-stats - show voice port statistics Input Parameters unnamed (name) - port name show statistics of Return Values round-trip-delay (time) - maximal time of packet round trip packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of th e voice port) bytes-sent (integer) - number of bytes sent by this card (these packets are digitalized input of the voice port) sent-time (text) - minimal/average/maximal intervals between packets sent packets-received (integer) - number of packets recei ved by this card (these packets form analog output of the voice port) bytes-sent (integer) - number of bytes received by this card (these packets form analog output of the voice port) sent-time (text) - minimal/average/maximal intervals between packets r eceived average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. The value shown is never less than 30ms, although the actual delay time could be less. If the shown value is >40ms, then it is close (+/ -1ms) to the actual delay time. monitor - monitor status of the voice port Input Parameters unnamed (name) - port name to monitor Return Values status (on-hook | off-hook | ring | connection | busy) - current state of the port: on-hook - the handset is onhook, no activity off-hook - the handset is off-hook, the number is being dialed ring - call in progress, direction of the call is shown by the direction property connection - the connection has been established busy - the connection has been terminated, the handset is still off -hook directiopn (ip-to-port | port-to-ip) - direction of the call ip-to-port - call from the IP network to the voice card port-to-ip - call from the voice card to an I P address line-status (plugged | unplugged) - state of the PSTN line plugged - the telephone line is connected to the PSTN port of the card unplugged - there is no working line connected to the PSTN port of the card phone-number (integer) - the phone number being dialed remote-party-name (text) - name and IP address of the remote party codec (name) - CODEC used for the audio connection duration (time) - duration of the phone call

ISDN Voice Ports


Submenu level: /ip telephony voice-port isdn

Property Description
name (name) - name given by the user or the default one msn (integer) - telephone number of the ISDN voice port (ISDN MSN number) lmsn (text) - msn pattern to listen on. It determines which calls from the ISDN line this voice port should answer. If left empty, msn is used Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 144

autodial (integer; default: "") - phone number which will be dialed immediately on each incoming ISDN call. If this number contains 'm', then it will be replaced by originally called (ISDN) telephone number. If this number is incomplete, then the remaining part has to be dialed by the caller. If the number is incorrect, call is refused. If the number is correct, then the appropriate number is dialed. For that direct -call mode is used - the line is picked up only after the re mote party answers the call playback-volume (integer: -48..48; default: 0) - playback volume in dB 0 - 0dB meand no change to signal level record-volume (integer: -48..48; default: 0) - record volume in dB 0 - 0dB meand no change to signal level region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones aec (yes | no) - wheteher echo detection and cancellation is enabled aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection software-aec (yes | no) - software echo canceller (experimental, for most of the cards) agc-on-playback (yes | no; default: no) - automatic gain control on playback (can n ot be used together with hardware voice codecs) agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs)

Command Description
clear-call - terminate a current call established with the specified voice port Input Parameters unnamed (name) - port name to clear call with show-stats - show voice port statistics Input Parameters unnamed (name) - port name show statistics of Return Values round-trip-delay (time) - maximal time of packet r ound trip packets-sent (integer) - number of packets sent by this card (these packets are input of the voice port) bytes-sent (integer) - number of bytes sent by this card (these packets are input of the voice port) sent-time (text) - minimal/average/maximal intervals between packets sent packets-received (integer) - number of packets received by this card (these packets form output of the voice port) bytes-sent (integer) - number of bytes received by this card (these packets form output of the voice p ort) sent-time (text) - minimal/average/maximal intervals between packets received average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. The value shown is never less than 30ms, although the actual delay time could be less. If the shown value is >40ms, then it is close (+/ -1ms) to the actual delay time. monitor - monitor status of the voice port Input Parameters unnamed (name) - port name to monitor Return Values status (on-hook | off-hook | ring | connection | busy) - current state of the port: on-hook - the handset is onhook, no activity off-hook - the handset is off-hook, the number is being dialed ring - call in progress, direction of the call is shown by the direction property connection - the connection has been established busy - the connection has been terminated, the handset is still off -hook directiopn (ip-to-port | port-to-ip) - direction of the call ip-to-port - call from the IP network to the voice card port-to-ip - call from the voice card to an IP address phone-number (integer) - the phone number being dialed remote-party-name (text) - name and IP address of the remote party codec (name) - CODEC used for the audio conne ction duration (time) - duration of the phone call

Notes
Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 145

In contrary to analog voice ports phonejack, linejack, voicetronix, zaptel), which are as many as the number of cards installed, the isdn ports can be added as many as desired. There is a possibility to enter some special symbols in lmsn property. Meaning of the special symbols: ; - separates pattern entries (more than one pattern can be specified this way) ? - matches one character * - matches zero or more characters [ ] - matches any single character from the set in brackets [^ ] - matches any single character not from the set in brackets

Voice Port for Voice over IP (voip)


Submenu level: /ip telephony voice-port voip

Description
The voip voice ports are virtual ports, which designate a v oip channel to another host over the IP network. You must have at least one voip voice port to be able to make calls to other H.323 devices over IP network.

Property Description
name (name) - name given by the user or the default one remote-address (IP address; default: 0.0.0.0) - IP address of the remote party (IP telephone or gateway) associated with this voice port. If the call has to be performed through this voice port, then the specified IP address is called. If there is an incoming call from the sp ecified IP address, then the parameters of this voice port are used. If there is an incoming call from an IP address, which is not specified in any of the voip voice port records, then the default record is used. If there is no default record, then default values are used 0.0.0.0 - the record with this IP address will specify the default values for an incomming call autodial (integer) - phone number which will be added in front of the telephone number received over the IP network. In most cases it should be blank jitter-buffer (time: 0..1000ms; default: 100ms) - size of the jitter buffer 0 - the size of it is adjusted automatically during the conversation, to keep amount of lost packets under 1% silence-detection (yes | no; default: no) - whether silence is detected and no audio data is sent over the IP network during the silence period prefered-codec (name; default: none) - the preferred codec to be used for this voip voice port. If possible, the specified codec will be used none - there is no preferred codec defined for this port, so whichever codec advised by the remote peer will be used (if it is supported) fast-start (yes | no; default: yes) - allow or disallow the fast start. The fast start allows establishing the audio connection in a shorter time. However, not all H.323 endpoints support this feature. Therefore, it should be turned off, if there are problems to establish telephony connection using the fast start mode

Numbers
Description
This is the so-called "routing table" for voice calls. T his table assigns numbers to the voice ports.The main function of the numbers routing table is to determine: to which voice port route the call what number to send over to the remote party

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

146

Property Description
dst-pattern (integer) - pattern of the telephone number. Symbol '.' designate any digit, symbol '_' (only as the last one) designate any symbols (i.e. any number of characters can follow, ended with '#' button) voice-port (name) - voice port to be used when calling the specified telephone number prefix (integer) - prefix, which will be used to substitute the known part of the dst-pattern, i.e., the part containing digits. The dst-pattern argument is used to determine which voice port to be used, whereas the prefix argument designates the number to dial over the voice port (be sent over to the remote party). If the remote party is an IP telephony gateway, then the number will be used for making the call

Notes
More than one entry can be added with exactly the same dst-pattern. If first one of them is already busy, next one with the same dst-pattern is used. Telephony number entries can be moved, to select desired order.

Example
Let us consider the following example for the number table: [admin@MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE -PORT PREFIX 0 12345 XX 1 1111. YY 2 22... ZZ 333 3 ... QQ 55 [admin@MikroTik] ip telephony numbers> We will analyze the Number Received (nr) - number dialed at the telephone, or received over the line, the Voice Port (vp) - voice port to be used for the call, and the Num ber to Call (nc) - number to be called over the Voice Port. If nr=55555, it does not match any of the destination patterns, therefore it is rejected If nr=123456, it does not match any of the destination patterns, therefore it is rejected If nr=1234, it does not match any of the destination patterns (incomplete for record #0), therefore it is rejected If nr=12345, it matches the record #0, therefore number "" is dialed over the voice port XX If nr=11111, it matches the record #1, therefore number "1" is dialed over the voice port YY If nr=22987, it matches the record #2, therefore number "333987" is dialed over the voice port ZZ If nr=22000, it matches the record #2, therefore number "333000" is dialed over the voice port ZZ If nr=444, it matches the record #3, therefore number "55444" is dialed over the voice port QQ Let us add a few more records: [admin@MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE -PORT PREFIX 0 12345 XX 1 1111. YY 2 22... ZZ 333 3 ... QQ 55 4 222 KK 44444 5 3.. LL 553 [admin@MikroTik] ip telephony numbers> If nr=222 => the best match is the record #4 => nc=44444, vp=KK (note: the 'best match' means that it has the most coinciding digits between the nr and des tination pattern). If nr=221 => incomplete record #2 => call is rejected Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 147

If nr=321 => the best match is the record #5 => nc=55321, vp=LL If nr=421 => matches the record #3 => nc=55421, vp=QQ If nr=335 => the best match is the record #5 => nc=55321, vp= LL Let us add a few more records: [admin@MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE -PORT PREFIX 0 12345 XX 1 1111. YY 2 22... ZZ 333 3 ... QQ 55 4 222 KK 44444 5 3.. LL 553 6 33... MM 33 7 11. NN 7711 [admin@MikroTik] ip telephony numbers> If nr=335 => incomplete record #6 => the call is re jected. The nr=335 fits perfectly both the record #3 and #5. The #5 is chosen as the 'best match' candidate at the moment. Furthermore, there is record #6, which has two matching digits (more than for #3 or #5). Therefore the #6 is chosen as the 'best matc h'. However, the record #6 requires five digits, but the nr has only three. Two digits are missing, therefore the number is incomplete. Two additional digits would be needed to be entered on the dialpad. If the number is sent over from the network, it is r ejected. If nr=325 => matches the record #5 => nc=55325, vp=LL If nr=33123 => matches the record #6 => nc=33123, vp=MM If nr=123 => incomplete record #0 => call is rejected If nr=111 => incomplete record #1 => call is rejected If nr=112 => matches the record #7 => nc=77112, vp=NN If nr=121 => matches the record #3 => nc=55121, vp=QQ It is impossible to add the following records: # DST-PATTERN VOICE -PORT PREFIX reas on: 11 DD conflict with record # 1 and # 7 11.. DD conflict with record # 7 111 DD conflict with record # 1 22. DD conflict with record # 2 ..... DD conflict with record # 3

Regional Settings
Submenu level: /ip telephony region

Description
Regional settings are used to adjust the voice port properties to the PSTN system or the PBX. For example, to detect hang-up from line, there has to be correct regional setting (correct busy -tone-frequency and busy-tonecadence). Without that, detect -cpt parameter the voice port has to be enabled. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 148

Property Description
name (name) - name of the regional setting busy-tone-cadence (integer: 0..30000; default: 500,500) - busy tone cadence in ms 0 - end of cadence busy-tone-frequency (integer: 20..2000integer: -24..6; default: 440x0) - frequency and volume gain of busy tone, Hz x dB data-access-arrangement (australia | france | germany | japan | uk | us; default: us) - ring voltage, impedance setting for line-jack card dial-tone-frequency (integer: 20..2000integer: -24..6; default: 440x0) - frequency and volume gain of dial tone, Hz x dB dtmf-tone-cadence (integer: 0..30000; default: 180,60) - Dual Tone Multi Frequency tone cadence in ms 0 - end of cadence dtmf-tone-volume (integer: -24..6; default: -3,-3) - Dual Tone Multi Frequency tone volume in dB ring-tone-cadence (integer: 0..30000; default: 1000,2000) - Ring tone cadence in ms 0 - end of cadence ring-tone-frequency (integer: 20..2000integer: -24..6; default: 440x0) - frequency and volume gain of busy tone, Hz x dB

Notes
To generate a tone, frequency and cadence arguments are used. The dialtone always is continuous signal, therefore it does not have the cadence argument. In order to detect dialtone, it should be at least 100ms long. There are 10 pre-defined regions, which can not be deleted (but may be changed)

Audio CODECs
Submenu level: /ip telephony codec

Description
CODECs are listed according to their priority of use. The highest priority is at the top. CODECs can be enabled, disabled and moved within the list. When connecting with other H.323 systems, the protocol will negotiate the CODEC which both of them support according to the priority order. The hardware codecs (/hw) are built -in CODECs supported by some cards. The choice of the CODEC type is based on the throughput and speed of the network. Better audio quality can be achieved by using CODEC requiring higher network throughput. The highest audio quality can be achieved by using the G.711-uLaw CODEC requiring 64kb/s throughput for each direction of the call. It is used mostly within a LAN. The G.723.1 CODEC is the most popular one to be used for audio connections over the Internet. It requires only 6.3kb/s throughput for each direction of the call.

Example
[admin@MikroTik] ip telephony codec> print Flags: X - disabled # NAME 0 G.723.1-6.3k/sw 1 G.728-16k/hw 2 G.711-ALaw-64k/hw 3 G.711-uLaw-64k/hw 4 G.711-uLaw-64k/sw 5 G.711-ALaw-64k/sw 6 G.729A-8k/sw 7 GSM-06.10-13.2k/sw 8 LPC-10-2.5k/sw Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 149

9 G.723.1-6.3k/hw 10 G.729-8k/sw [admin@MikroTik] ip telephony codec>

AAA
Submenu level: /ip telephony aaa

Description
AAA (Authentication Authorization Accounting) can be used to configure the RADIUS accounting feature. The contents of the CDR (Call Detail Record) are as follows: NAS-Identifier - router name (from /system identity print) NAS-IP-Address - router's local IP address which the connection was established to (if exist) NAS-Port-Type - always Async Event-Timestamp - data and time of the event Acct-Session-Time - current connection duration (only in INTERIM -UPDATE and STOP records) Acct-Output-Packets - sent RTP (Real-Time Transport Protocol) packet count (only in INTERIM UPDATE and STOP records) Acct-Output-Packets - sent RTP (Real-Time Transport Protocol) packet count (only in INTERIM UPDATE and STOP records) Acct-Input-Packets - received RTP (Real-Time Transport Protocol) packet count (only in INTERIM UPDATE and STOP records) Acct-Output-Octets - sent byte count (only in INTERIM -UPDATE and STOP records) Acct-Input-Octets - received byte count (only in INTERIM -UPDATE and STOP records) Acct-Session-Id - unique session participient ID h323-disconnect-cause - session disconnect reason (only in ST OP records): 0 - Local endpoint application cleared call 1 - Local endpoint did not accept call 2 - Local endpoint declined to answer call 3 - Remote endpoint application cleared call 4 - Remote endpoint refused call 5 - Remote endpoint did not answe r in required time 6 - Remote endpoint stopped calling 7 - Transport error cleared call 8 - Transport connection failed to establish call 9 - Gatekeeper has cleared call 10 - Call failed as could not find user (in GK) 11 - Call failed as could not get enough bandwidth 12 - Could not find common capabilities 13 - Call was forwarded using FACILITY message 14 - Call failed a security check and was ended 15 - Local endpoint busy 16 - Local endpoint congested 17 - Remote endpoint busy 18 - Remote endpoint congested 19 - Could not reach the remote party 20 - The remote party is not running an endpoint 21 - The remote party host off line 22 - The remote failed temporarily app may retry h323-disconnect-time - session disconnect time (only in INTERI M-UPDATE and STOP records) h323-connect-time - session establish time (only in INTERIM -UPDATE and STOP records) h323-gw-id - name of gateway emitting message (should be equal to NAS-Identifier) h323-call-type - call leg type (should be VoIP) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 150

h323-call-origin - indicates origin of call relatively to the gateway ( answer for calls from IP network, originate - to IP network) h323-setup-time - call setup time h323-conf-id - unique session ID h323-remote-address - the remote address of the session NAS-Port-Id - voice port ID Acct-Status-Type - record type (START when session is established; STOP when session is closed; INTERIM-UPDATE (ALIVE)session is alive). The time between the interim -update messages is defined by the interim-update-interval parameter (if it is set to 0s, there will be no such messages)

Property Description
use-radius-accounting (yes | no; default: no) - whether to use radius accounting or not interim-update (integer; default: 0) - defines time interval between communications with th e router. If this time will exceed, RADIUS server will assume that this connection is down. This value is suggested not to be less than 3 minutes 0 - no interim-update messages are sent at all

Notes
All the parameters, which names begin with h323, are CISCO vendor specific Radius attributes

Gatekeeper
Submenu level: /ip telephony gatekeeper

Description
For each H.323 endpoint gatekeeper stores its telephone numbers. So, gatekeeper knows all telephone numbers for all registered endpoints. And it knows which telephone number is handled by which endpoint. Mapping between endpoints and their telephone numbers is the main functionality of gatekeepers. If endpoint is registered to endpoint, it does not have to know every single endpoint and every single tele phone number, which can be called. Instead, every time some number is dialed, endpoint asks gatekeeper for destination endpoint to call by providing called telephone number to it. MikroTik IP telephony package includes a very simple gatekeeper. This gateke eper can be activated by setting gatekeeper parameter to local. In this case the local endpoint automatically is registered to the local gatekeeper. And any other endpoint can register to this gatekeeper too. Registered endpoints are added to the /ip telephony voice-port voip table. Those entries are marked as dynamic and can not be removed or changed. If there already was an voip entry with the same IP address, it is marked as registred. Remote-address can not be changed for these entries too, but register ed voip voice ports can be removed - they will stay as dynamic ones. If there already is a dynamic voip voice port and a static one with the same IP address is added, then instead of dynamic entry, registered will appear. Dynamic entries disappear when cor responding endpoint unregisters itself from the gatekeeper. Registered entries are static and will stay even after that endpoint will be unregistered from this gatekeeper. Registered telephone numbers are added to /ip telephony numbers table. Here is exactly the same idea behind dynamic and registered telephone numbers as it is with voip voice ports. When an endpoint registers to the gatekeeper, it sends its own telephone numbers (aliases and prefixes) within this registration request. /ip telephony numbers entry is registered to the endpoint only if voice -port for that entry is local (not voip). If dst-pattern contains '.' or '_', it is sent as prefix, otherwise - as alias. The known part of the dst-pattern is sent as prefix. If there is no known part ( dst-pattern is "_" or "...", for example), then this entry is not sent at all.

Property Description
gatekeeper (none | local | remote; default: none) - Gatekeeper type to use Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 151

none - don't use any gatekeeper at all local - start and use local gatekeeper remote - use some other gatekeeper remote-address (IP address; default: 0.0.0.0) - IP address of remote gatekeeper to use. If set to 0.0.0.0, broadcast gatekeeper discovery is used remote-id (name) - name of remote gatekeeper to use. If left empty, first av ailable gatekeeper will be used. Name of locally started gatekeeper is the same as system identity registered (read-only: yes | no) - shows whether local H.323 endpoint is registered to any gatekeeper registered-with (read-only: name) - name of gatekeeper to which local H.323 endpoint is registered

Example
In most simple case with one phonejack card and some remote gatekeeper, configuration can be as follows: [admin@MikroTik] ip telephony voice -port> print Flags: X - disabled # NAME TYPE AUTODIAL 0 phonejack1 phonejack 1 voip1 voip [admin@MikroTik] ip telephony voice -port voip> print Flags: X - disabled, D - dynamic, R - registered # NAME AUTODIAL REMOTE -ADDRESS JITTER-BUFFER PREFERED-CODEC SIL FAS 0 voip1 0.0.0.0 0s none no yes [admin@MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE-PORT PREFIX 0 11 phonejack1 1 _ voip1 [admin@MikroTik] ip telephony gatekeeper> print gatekeeper: remote remote-id: "" remote-address: 10.0.0.98 registered: yes registered-with: "[email protected]" In this case this endpoint will register to gatkeeper with the IP address of 10.0.0.98 and telephone number 11. Every call to telephone number 11 will be transfered from gatekeeper to th is endpoint. And this endpoint will route this call to phonejack1 voice port. On any other telephone number gatekeeper will be asked for real destination. From this endpoint it will be possible to call all the endpoints, which are registered to the same gatekeeper. If that gatekeeper has static entries about endpoints, which are not registered to gatekeeper, it still will be possible to call those endpoints by those statically defined telephone numbers at gatekeeper.

Example
For example, if numbers table i s like this: [admin@MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE -PORT PREFIX 0 1. phonejack1 1 128 voip1 128 2 78 voip2 78 3 77 phonejack1 4 76 phonejack1 55 5 _ voip1 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 152

then entries 0, 3 and 4 will be sent to the gatekeeper, others are voip voice ports and are ignored. Entry 0 will be sent as prefix 1, entry 3 - as alias 77, and entry 4 - as alias 76. If IP address of local endpoint is 10.0.0.100, then gatekeeper voip and numbers tables will look as follows: [admin@MikroTik] ip telephony voice -port voip> print Flags: X - disabled, D - dynamic, R - registered # NAME AUTODIAL REMOTE -ADDRESS JITTER-BUFFER PREFERED-CODEC SIL FAS 0 tst-2.5 10.0.0.101 0s none no yes 1 D local 127.0.0.1 100ms none no yes 2 D 10.0.0... 10.0.0.100 100ms none no yes [admin@MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE -PORT PREFIX 0 78 linejack1 1 3... vctx1 2 33_ voip1 3 5.. v oip1 4 XD 78 local 78 5 XD 3_ local 3 6 D 76 10.0.0.100 76 7 D 77 10.0.0.100 77 8 D 1_ 10.0.0.100 1 Here we can see how aliases and prefixes are added to numbers table. Entries 0..3 are static. Entries 4 and 5 are added by registering the local endpoint to the local gatekeeper. Entries 6..8 are added by re gistering endpoint (with IP address 10.0.0.100) to the local gatekeeper. For prefixes, '_' is added at the end of dst -pattern to allow any additional digits to be added at the end. Local endpoint is registered to the local gatekeeper too. So, local aliases and prefixes are added as dynamic numbers too. Only, as they are local and corresponding number entries already exist in the number table, then these dynamically added entries are disabled by default. If any registered telephone number will conflict with some existing telephone numbers entry, it will be added as disabled and dynamic. If in gatekeeper's numbers table there already exists exactly the same dst -pattern as some other endpoint is trying to register, this gatekeeper registration for that endpoint will fail.

Troubleshooting
Description
The IP Telephony does not work after upgrading from 2.5.x version - You need to completely reinstall the router using any installation procedure. You may keep the configuration using either the installation program option or the backup file. The IP Telephony gateway does not detect the drop of the line when connected to some PBXs Different regional setting should be used to match the parameters of the PBX. For example, try using uk for Meridian PBX. The IP Telephone does not call the gateway, but gives busy signal - Enable the logging of IP telephony events under /system logging facility . Use the monitoring function for voice ports to debug your setup while making calls. The IP telephony is working without NAT, but sound goes only in one direction - Disable H323 service port in firewall: /ip firewall service-port set h323 disabled=yes Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 153

The IP Telephony does not work through NAT - Enable H323 service port in firewall: /ip firewall service-port set h323 disabled=no

A simple example
Description
The following describes examples of some useful IP telephony applications using MikroTik RouterOS. Let us consider the following example of IP telephony gateway, one MikroTik IP telephone, and one Welltech

LAN Phone 101 setup:

Setting up the MikroTik IP Telephone


If you pick up the handset, a dialtone should be heard. The basic telephony configuration should be as follows: Add a voip voice port to the /ip telephony voice-port voip for each of the devices you want to call, or want to receive calls from, i.e., (the IP telephony gateway 10.1.1.12 and the Welltech IP telephone 10.5.8.2): [admin@Joe] ip telephony voice -port voip> add name=gw remote address=10.1.1.12 [admin@Joe] ip telephony voice -port voip> add name=rob remote address=10.5.8.2 [admin@Joe] ip telephony voice -port voip> print Flags: X - disabled, D - dynamic, R - registered # NAME AUTODIAL REMOTE -ADDRESS JITTER-BUFFER PREFEREDCODEC SIL FAS 0 gw 10.1.1.12 100ms none no yes 1 rob 10.5.8.2 100ms none no yes [admin@Joe] ip telephony voice -port voip> You should have three vioce ports now: [admin@Joe] ip telephony voice -port> print Flags: X - disabled # NAME TYPE 0 linejack1 linejack 1 gw voip 2 rob voip [admin@Joe] ip telephony voice -port>

AUTODIAL

Add at least one unique number to the /ip telephony numbers for each voice port. This number will be used to call that port: [admin@Joe] ip telephony numbers> add dst -pattern=31 voice-port=rob [admin@Joe] ip teleph ony numbers> add dst -pattern=33 voiceport=linejack1 [admin@Joe] ip telephony numbers> add dst -pattern=1. voice-port=gw prefix=1 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 154

[admin@Joe] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE-PORT PREFIX 0 31 rob 31 1 33 linejack1 2 1. gw 1 [admin@Joe] ip telephony numbers> Here, the dst-pattern=31 is to call the Welltech IP Telephone, if the number 31 is dialed on the dialpad. The dst-pattern=33 is to ring the local telephone, if a call for number 33 is received over the network. Anything starting with digit '1' would be sent over to the IP Telephony gateway. Making calls from the IP telephone 10.0.0.224: To call the IP telephone 10.5.8.2, it is enough to lift the handset and dial the number 31 To call the PBX extension 13, it is enough to lift the handset and dial the number 13 After establishing the connection with 13, the voice port monitor shows: [admin@Joe] ip telephony voice -port linejack> monitor linejack status: connection port: phone direction: port -to-ip line-status: unplugged phone-number: 13 remote-party-name: PBX_Line [10.1.1.12] codec: G.723.1 -6.3k/hw duration: 16s [admin@Joe] ip telephony voice -port linejack>

Setting up the IP Telephony Gateway


The IP telephony gateway [voip_gw] requires the following configuration: Set the regional setting to match our PBX. The mikrotik region will be used in thisn example: [admin@voip_gw] ip telephony voice -port linejack> set linejack1 region=mikrotik [admin@voip_gw] ip telephony voice-port linejack> print Flags: X - disabled 0 name="linejack1" autodial="" region=mikrotik playback -volume=0 record-volume=0 ring-cadence="++-++--- ++-++---" agc-onplayback=no agc-on-record=no aec=yes aec -tail-length=short aec-nlpthreshold=low aec-attenuation-scaling=4 aec-attenuation-boost=0 softwareaec=no detect-cpt=yes [admin@voip_gw] ip telephony voice -port linejack> Add a voip voice port to the /ip telephony voice-port voip for each of the devices you want to call, or want to receive calls from, i.e., (the IP telephone 10.0.0.224 and the Welltech IP telephone 10.5.8.2): [admin@voip_gw] ip telephony voice -port voip> add name=joe \ \... remote-address=10.0.0.224 [admin@voip_gw] ip telephony voice -port voip> add name=rob \ \... remote-address=10.5.8.2 prefered -codec=G.723.1-6.3k/hw [admin@voip_gw] ip telephony voice -port voip> print Flags: X - disabled, D - dynamic, R - registered # NAME AUTODIAL REMOTE -ADDRESS JITTER-BUFFER PREFEREDCODEC SIL FAS Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 155

0 joe 10.0.0.224 100ms no yes 1 rob 10.5.8.2 100ms 6.3k/hw no yes [admin@voip_gw] ip telephony voice -port voip>

none G.723.1 -

Add number records to the /ip telephony numbers, so you are able to make calls: [admin@voip_gw] ip telephony numbers> add dst -pattern=31 voiceport=rob prefix=31 [admin@voip_gw] ip telephony numbers> add dst -pattern=33 voiceport=joe prefix=33 [admin@voip_gw] ip telephony numbers> add dst -pattern=1. voiceport=linejack1 \ \... prefix=1 [admin@voip_gw] ip telephony numbers> print Flags: I - invalid, X - disabled, D - dynamic, R - registered # DST-PATTERN VOICE -PORT PREFIX 0 31 rob 31 1 33 joe 33 2 1. linejack1 1 [admin@voip_gw] ip telephony numbers> Making calls through the IP telephony gateway: To dial the IP telephone 10.0.0. 224 from the office PBX line, the extension number 19 should be dialed, and, after the dial tone has been received, the number 33 should be entered. Thus, the telephone [Joe] is ringed. After establishing the voice connection with '33' (the call has been a nswered), the voice port monitor shows: [admin@voip_gw] ip telephony voice -port linejack> monitor linejack1 status: connection port: line direction: port -to-ip line-status: plugged phone-number: 33 remote-party-name: linejack1 [10.0.0.224] codec: G.723.1 -6.3k/hw duration: 1m46s [admin@voip_gw] ip telephony voice -port linejack> To dial the IP telephone 10.5.8.2 from the office PBX line, the extension n umber 19 should be dialed, and, after the dial tone has been received, the number 31 should be entered.

Setting up the Welltech IP Telephone


Please follow the documentation from www.welltech.com.tw on how to set up the Welltech LAN Phone 101. Here we give just brief recommendations: 13. We recommend to upgrade the Welltech LAN Phone 101 with the latest application software. Telnet to the phone and check what you have, for example: usr/config$ rom -print Download Method Server Address Hardware Boot Application DSP Ver. Rom Rom App : : : : : : TFTP 10.5.8.1 4.0 nblp -boot.102a wtlp.108h 48302ce3.127 156

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

DSP Kernel DSP Test Code Ringback Tone Hold Tone Ringing Tone1 Ringing Tone2 Ringing Tone3 usr/config$

: : : : : : :

48302ck.127 483cbit.bin wg -ringbacktone.100 wg -holdtone10s.100 ringlow.bin ringmid.bin ringhi.bin

14. Check if you have the codecs arranged in the desired order: usr/config$ voice -print Voice codec setting relate information Sending packet size : G.723.1 : 30 ms G.711A : 20 ms G.711U : 20 ms G.729A : 20 ms G.729 : 20 ms Priority order codec : g7231 g711a g711u g729a g729 Volume levels : voice volume : 54 input gain : 26 dtmf volume : 23 Silence suppression & CNG: G.723.1 : Off Echo canceller : On JitterBuffer Min Delay : 90 JitterBuffer Max Delay : 150 usr/config$ 15. Make sure you have set the H.323 operation mode to phone to phone (P2P), not gatekeeper (GK): usr/config$ h323 -print H.323 stack relate information RAS mode : Non -GK mode Registered e164 : 31 Registered H323 ID : Rob RTP port : 16384 H.245 port : 16640 Allocated port range : start port : 1024 end port : 65535 Response timeOut : 5 Connect timeOut : 5000 usr/config$ 16. Add the gateway's address to the phonebook: usr/config$ pbook -add name gw ip 10.1.1.12 usr/config$ This may take a few seconds, please wait.... Commit to flash memory ok! usr/config$ pbook -print index Name IP E164 ===================================================================== = 1 gw 10.1.1.12 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 157

--------------------------------------------------------------------usr/config$ Making calls from the IP telephone 10.5.8.2: Just lift the handset and dial '11', or '13' fo the PBX extensions. Dial '33' for [Joe]. The call request will be sent to the gateway 10.1.1.12, where it will be forwarded to [Joe]. If you want to call [Joe] directly, add a phonebook record for it: usr/config$ pbook -add name Joe ip 10.0.0.224 e164 33 Use the telephony logging feature on the gateway to debug your setup.

Setting up MikroTik Router and CISCO Router


Let's try a different example. Here are some hints on how to get working configuration for telephony calls between CISCO and MikroTik router. Configuration on the MikroTik side G.729a codec MUST be disabled (otherwise connections are not possible at all!!!) /ip telephony codec disable G.729A -8k/sw G.711-ALaw codec should not be used (in some cases there is no sound) /ip telephony codec disable "G.711 -ALaw-64k/sw G.711-ALaw-64k/hw" Fast start has to be used (otherwise no ring -back tone and problems wit h codec negotiation) /ip telephony voice -port set cisco fast -start=yes Telephone number we want to call to must be sent to Cisco, for example /ip telephony numbers add destination -pattern=101 voice-port=cisco prefix=101 Telephone number, cisco will call us, must be assigned to some voice port, for example, /ip telephony numbers add destination -pattern=098 voice-port=linejack Configuration on the CISCO side: IP routing has to be enabled ip routing Default values for fast start can be used: voice service pots default h323 call start exit voice service voip default h323 call start exit Enable opening of RTP streams: voice rtp send-recv Assign some E.164 number for local telephone, for example, 101 to port 0/0 dial-peer voice 1 pots destination-pattern 101 port 0/0 exit create preferred codec listing: voice class codec codec_class_number codec preference 1 g711ulaw Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

158

codec preference 2 g723r63 exit NOTE: g723r53 codec can be used, too Tell, that some foreign E.164 telephone number can be reached by calling to some IP address, for example, 098 by calling to 10.0.0.98 dial-peer voice 11 voip destination-pattern 098 session target ipv4 :10.0.0.98 voice-class codec codec_class_number exit NOTE: instead of codec class, one specified codec could be specified: codec g711ulaw For reference, following is an exported CISCO configuration, that works: ! version 12.1 no service single-slot-reload-enable service timestamps debug uptime service timestamps log uptime no service password -encryption ! hostname Router ! logging rate-limit console 10 except errors enable secret 5 $1$bTMC$nDGl9/n/pc3OMbtWxADMg1 enable password 123 ! memory-size iomem 25 ip subnet-zero no ip finger ! call rsvp-sync voice rtp send-recv ! voice class codec 1 codec preference 1 g711ulaw codec preference 2 g723r63 ! interface FastEthernet0 ip address 10.0.0.101 255.255.255.0 no ip mroute-cache speed auto half-duplex ! ip classless ip route 0.0.0.0 0.0.0.0 10.0.0.1 no ip http server ! dialer-list 1 protocol ip permit dialer-list 1 protocol ipx permit ! voice-port 0/0 ! voice-port 0/1 ! voice-port 2/0 ! Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 159

voice-port 2/1 ! dial-peer voice 1 pots destination-pattern 101 port 0/0 ! dial-peer voice 97 voip destination-pattern 097 session target ipv4:10.0.0.97 codec g711ulaw ! dial-peer voice 98 voip destination-pattern 098 voice-class codec 1 session target ipv4:10.0.0.98 ! ! line con 0 transport input none line aux 0 line vty 0 4 password 123 login ! end

Setting up PBX to PBX Connection over an IP Network


To interconnect two telephone switchboards (PBX) over an IP network, two IP telephony gateways should be configured. The setup is shown in the following diagram:

We want to be able to use make calls from local telephones of one PBX to local telephones or external lines of the other PBX. Assume that: The IP telephony gateway #1 has IP address 10.0.0.182, and the name of the Voicetronix first line is 'vctx1'. The IP telephony gateway #2 has IP address 10.0.0.183, and the name of the Voicetronix first line is 'vctx1'. The IP telephony configuration should be as follows: IP telephony gateway #1 should have: /ip telephony voice -port voip add name=gw2 remote -address=10.0.0.183 /ip telephony numbers add dst-pattern=1.. voice-port=gw2 prefix=2 add dst-pattern=2.. voice-port=vctx1 prefix=1 IP telephony gateway #2 sh ould have /ip telephony voice -port voip add name=gw1 remote -address=10.0.0.182 /ip telephony numbers add dst-pattern=2.. voice-port=vctx1 prefix=1 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 160

add dst-pattern=1.. voice-port=gw1 prefix=2 The system works as follows: To dial from the main office PBX#1 any extension of the remote office PBX#2, the extension with the connected gateway at PBX#1 should be dialed first. Then, after the dial tone of the gateway#1 is received, the remote extension number should be dialed. To dial from the main office PBX#2 any extension of the remote office PBX#1, the actions are the same as in first situation.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

161

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

162

BAB XX ISDN (Integrated Services Digital Network) Interface


General Information
Summary
The MikroTik router can act as an ISDN cli ent for dialing out, or as an ISDN server for accepting incoming calls. The dial-out connections may be set as dial -on-demand or as permanent connections (simulating a leased line). The remote IP address (provided by the ISP) can be used as the default gat eway for the router.

Specifications
Packages required: isdn, ppp License required: Level1 Submenu level: /interface isdn-server, /interface isdn-client Standards and Technologies: PPP (RFC 1661) Hardware usage: Not significant

Related Documents
Package Management Device Driver List Log Management

Additional Resources
PPP over ISDN RFC3057 - ISDN Q.921-User Adaptation Layer

ISDN Hardware and Software Installation


Command name: /driver add

Description
Please install the ISDN adapter into the PC accordingly the instructions provided by the adapter manufacturer. Appropriate packages have to be downloaded from MikroTik??????s web page http://www.mikrotik.com. After all, the ISDN driver should be loaded using the /driver add command. MikroTik RouterOS supports passive PCI adapters with Siemens chipset: Eicon. Diehl Diva - diva Sedlbauer Speed - sedlbauer ELSA Quickstep 1000 - quickstep NETjet - netjet Teles - teles Dr. Neuhaus Niccy - niccy Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 163

AVM - avm Gazel - gazel HFC 2BDS0 based adapters - hfc W6692 based adapters - w6692 For example, for the HFC based PCI card, it is enough to use /driver add name=hfc command to get the driver loaded. Note! ISDN ISA adapters are not supported!

Property Description
name (name) - name of the driver isdn-protocol (euro | german; default: euro) - data channel protocol

ISDN Channels
ISDN channels are added to the system automatically when the ISDN card driver is loaded. Each chann el corresponds to one physical 64K ISDN data channel. The list of available ISDN channels can be viewed using the /isdn-channels print command. The channels are named channel1, channel2, and so on. E.g., if you have two ISDN channels, and one of them curre ntly used by an ISDN interface, but the other available, the output should look like this: [admin@MikroTik] isdn -channels> print Flags: X - disabled, E - exclusive # NAME CHANNEL DIR.. TYPE PHONE 0 channel1 0 1 channel2 1 [admin@MikroTik] isdn -channels> ISDN channels are very similar to PPP serial ports. Any number of ISDN interfaces can be configured on a single channel, but only one interface can be enabled for that channel at a time. It means that every ISDN channel is either available or used by an ISDN interface.

MSN and EAZ numbers


In Euro-ISDN a subscriber can assign more than one ISDN number to an ISDN line. For example, an ISDN line could have the numbers 1234067 and 1234068. Ea ch of these numbers can be used to dial the ISDN line. These numbers are referred to as Multiple Subscriber Numbers (MSN). A similar, but separate concept is EAZ numbering, which is used in German ISDN networking. EAZ number can be used in addition to dial ed phone number to specify the required service. For dial-out ISDN interfaces, MSN/EAZ number specifies the outgoing phone number (the calling end). For dial-in ISDN interfaces, MSN/EAZ number specifies the phone number that will be answered. If you are un sure about your MSN/EAZ numbers, leave them blank (it is the default). For example, if your ISDN line has numbers 1234067 and 1234068, you could configure your dial -in server to answer only calls to 1234068 by specifying 1234068 as your MSN number. In a se nse, MSN is just your phone number.

ISDN Client Interface Configuration


Submenu level: /interface isdn-client

Description
The ISDN client is used to connect to remote dial -in server (probably ISP) via ISDN. To set up an ISDN dial out connection, use the ISDN dial-out configuration menu under the submenu.

Property Description
name (name; default: isdn-outN) - interface name Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 164

mtu (integer; default: 1500) - Maximum Transmission Unit mru (integer; default: 1500) - Maximum Receive Unit phone (integer; default: "") - phone number to dial msn (integer; default: "") - MSN/EAZ of ISDN line provided by the line operator dial-on-demand (yes | no; default: no) - use dialing on demand l2-protocol (hdlc | x75i | x75ui | x75bui; default: hdlc) - level 2 protocol to be used user (text) - user name that will be provided to the remote server password (text) - password that will be provided to the remote server allow (multiple choice: mschap2, mschap1, chap, pap; default: mschap2, mschap1, chap, pap ) - the protocol to allow the client to use for authentication add-default-route (yes | no; default: no) - add default route to remote host on connect profile (name; default: default) - profile to use when connecting to the remote server use-peer-dns (yes | no; default: no) - use or not peer DNS bundle-128K (yes | no; default: yes) - use both channels instead of just one

Example
ISDN client interfaces can be added using the add command: [admin@MikroTik] interface isdn -client> add msn="142" user="test" \ \... password="test" phone="144" bundle -128K=no [admin@MikroTik] interface isdn -client> print Flags: X - disabled, R - running 0 X name="isdn-out1" mtu=1500 mru=1500 msn="142" user="test" password="test" profile=default phone="144" l2 -protocol=hdlc bundle-128K=no dial-on-demand=no add-default-route=no use-peerdns=no [admin@MikroTik] interface isdn -client>

ISDN Server Interface Configuration


Submenu level: /interface isdn-client

Description
ISDN server is used to accept remote dial -in connections form ISDN clients.

Property Description
name (name; default: isdn-inN) - interface name mtu (integer; default: 1500) - Maximum Transmission Unit mru (integer; default: 1500) - Maximum Receive Unit phone (integer; default: "") - phone number to dial msn (integer; default: "") - MSN/EAZ of ISDN line provided by the line operator l2-protocol (hdlc | x75i | x75ui | x75bui; default: hdlc) - level 2 protocol to be used profile (name; default: default) - profile to use when connecting to the remote server bundle-128K (yes | no; default: yes) - use both channels instead of just one authentication (pap | chap | mschap1 | mschap2; default: mschap2, mschap1, chap, pap ) - used authentication

Example
ISDN server interfaces can be added using the add command: [admin@MikroTik] interface isdn -server> add msn="142" bundle -128K=no [admin@MikroTik] interface isdn -server> print Flags: X - disabled, R - running 0 X name="isdn-in1" mtu=1500 mru=1500 msn="142" authentication=mschap2,chap,pap profile=default l2 -protocol=x75bui Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 165 Referensi : Download :www.mikrotik.com

bundle-128K=no [admin@MikroTik] interface isdn -server>

ISDN Examples
ISDN Dial-out
Dial-out ISDN connections allow a local router to connect to a remote dial -in server (ISP's) via ISDN. Let's assume you would like to set up a router th at connects your local LAN with your ISP via ISDN line. First you should load the corresponding ISDN card driver. Supposing you have an ISDN card with a W6692-based chip: [admin@MikroTik]> /driver add name=w6692 Now additional channels should appear. Assu ming you have only one ISDN card driver loaded, you should get following: [admin@MikroTik] isdn -channels> print Flags: X - disabled, E - exclusive # NAME CHANNEL DIR.. TYPE PHONE 0 channel1 0 1 channel2 1 [admin@MikroTik] isdn -channels> Suppose you would like to use dial -on-demand to dial your ISP and automatically add a default route to it. Also, you would like to disconnect when there is more than 30s of network inactivity. Your ISP's phone number is 12345678 and the user name for authentication is 'john'. Your ISP assigns IP addresses automatically. Add an outgoing ISDN interface and configure it in the following way: [admin@mikrotik]> /interface isdn -client add name="isdn -isp" phone="12345678" user="john" password="31337!)" add -default-route=yes dial-on-demand=yes [admin@MikroTik] > /interface isdn -client print Flags: X - disabled, R - running 0 X name="isdn-isp" mtu=1500 mru=1500 msn="" user="john" password="31337!)" profile=default phone="12345678" l2 -protocol=hdlc bundle -128K=no dial-on-demand=yes add-default-route=yes use-peer-dns=no Configure PPP profile. [admin@MikroTik] ppp profile> print Flags: * - default 0 * name="default" local -address=0.0.0.0 remote -address=0.0.0.0 session-timeout=0s idle-timeout=0s use-compression=no use-vj-compression=yes use -encryption=no require -encryption=no only one=no tx-bit-rate=0 rx-bit-rate=0 incoming-filter="" outgoing -filter="" [admin@Mikrotik] ppp profi le> set default idle -timeout=30s If you would like to remain connected all the time, i.e., as a leased line, then set the idle-timeout to 0s. All that remains is to enable the interface: [admin@MikroTik] /interface set isdn -isp disabled=no You can monitor the connection status with the following command: [admin@MikroTik] /interface isdn -client monitor isdn -isp

ISDN Dial-in
Dial-in ISDN connections allow remote clients to connect to your router via ISDN. Let us assume you would like to configure a router fo r accepting incoming ISDN calls from remote clients. You have an Ethernet card connected to the LAN, and an ISDN card connected to the ISDN line. First you should load the corresponding ISDN card driver. Supposing you have an ISDN card with an HFC chip: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 166

[admin@MikroTik] /driver add name=hfc Now additional channels should appear. Assuming you have only one ISDN card driver loaded, you should get the following: [admin@MikroTik] isdn -channels> print Flags: X - disabled, E - exclusive # NAME CHANNEL DIR.. TYPE PHONE 0 channel1 0 1 channel2 1 [admin@MikroTik] isdn -channels> Add an incoming ISDN interface and configure it in the following way: [admin@MikroTik] interface isdn -server> add msn="7542159" \ \... authentication=chap,pap bundle -128K=no [admin@MikroTik] interface isdn -server> print Flags: X - disabled 0 X name="isdn-in1" mtu=1500 mru=1500 msn="7542159" authentication=chap,pap profile=default l2 -protocol=hldc bundle -128K=no Configure PPP settings and add users to router's database. [admin@MikroTik] ppp profile> print Flags: * - default 0 * name="default" local -address=0.0.0.0 remote -address=0.0.0.0 session-timeout=0s idle-timeout=0s use-compression=no use-vj-compression=yes use -encryption=no require -encryption=no only one=no tx-bit-rate=0 rx-bit-rate=0 incoming-filter="" outgoing -filter="" [admin@Mikrotik] ppp profile> set default idle -timeout=5s localaddress=10.99.8.1 \ \... remote-address=10.9.88.1 Add user 'john' to the router's user database. Assuming that the password is '31337!)': [admin@MikroTik] ppp secret> add name=john password="31337!)" service=isdn [admin@MikroTik] ppp secret> print Flags: X - disabled # NAME SERVICE CALLER -ID PASSWORD PROFILE 0 john isdn 31337!) default [admin@MikroTik] ppp secret> Check the status of the ISDN server interface and wait for the call: [admin@MikroTik] interface isdn -server> monitor is dn-in1 status: Waiting for call...

ISDN Backup
Backup systems are used in specific cases, when you need to maintain a connection, even if a fault occurs. For example, if someone cuts the wires, the router can automatically connect to a different inte rface to continue its work. Such a backup is based on an utility that monitors the status of the connection - netwatch, and a script, which runs the netwatch. This is an example of how to make simple router backup system. In this example we'll use an ISDN connection for purpose to backup a standard Ethernet connection. You can, however, use instead of the ISDN connection anything you need - PPP, for example. When the Ethernet fail (the router nr.1 cannot ping the router nr.2 to 2.2.2.2 (see picture) the router nr.1 will establish an ISDN connection, so -called backup link, to continue communicating with the nr. 2. You must keep in mind, that in our case there are just two routers, but this system can be extended to support more different networks. The backup system example is shown in the following picture:

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

167

In this case the backup interface is an ISDN connection, but in real applications it can be substituted by a particular connection. Follow the instructions below on how to set up the backup link: At first, you need to set up ISDN connection. To use ISDN, the ISDN card driver must be loaded: [admin@MikroTik] driver> add name=hfc The PPP connection must have a new user added to the routers one and two: [admin@Mikrotik] ppp secret> add name=backup password=backup service=isdn An ISDN server and PPP profile must be set up on the second router: [admin@MikroTik] ppp profile> set default local -address=3.3.3.254 remote-address=3.3.3.1 [admin@MikroTik] interface isdn -server> add name=backup msn=7801032 An ISDN client must be added to the first router: [admin@MikroTik] interface isdn -client> add name=backup user="backup" password="backup" phone=7801032 msn=7542159 Then, you have to set up static routes Use the /ip route add command to add the required static routes and comments to them. Comments are required for references in scripts. The first router: [admin@Mikrotik] ip route> add gateway 2.2.2.2 comment "route1" The second router: [admin@Mikrotik] ip route> add gateway 2.2.2.1 comment "route1" dst address 1.1.1.0/24 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 168

And finally, you have to add scripts. Add scripts in the submenu /system script using the following commands: The first router: [admin@Mikrotik] system script> add name=c onnection_down \ \... source={/interface enable backup; /ip route set route1 gateway 3.3.3.254} [admin@Mikrotik] system script> add name=connection_up \ \... source={/interface disable backup; /ip route set route1 gateway 2.2.2.2} The second router: [admin@Mikrotik] system script> add name=connection_down \ \... source={/ip route set route1 gateway 3.3.3.1} [admin@Mikrotik] system script> add name=connection_up \ \... source={/ip route set route1 gateway 2.2.2.1} To get all above listed to work, set up Netw atch utility. To use netwatch, you need the advanced tools feature package installed. Please upload it to the router and reboot. When installed, the advanced -tools package should be listed under the /system package print list. Add the following settings to the first router: [admin@Mikrotik] tool netwatch> add host=2.2.2.1 interval=5s \ \... up-script=connection_up down -script=connection_down Add the following settings to the second router: [admin@Mikrotik] tool netwatch> add host=2.2.2.2 interval=5s \ \... up-script=connection_up down -script=connection_down

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

169

BAB XXI Device Driver List


General Information
Summary
The document lists the drivers, included in MikroTik RouterOS and the devices that are tested to work with MikroTik RouterOS. If a device is not listed here, it does not mean the device is not supported, it still may work. It just means that the device was not tested.

Ethernet
Packages required: system

Description
3Com 509 Series Chipset type: 3Com 509 Series ISA 10Base Compatibility: 3Com EtherLink III 3Com FastEtherLink Chipset type: 3Com 3c590/3c900 (3Com FastEtherLink and FastEtherLink XL) PCI 10/100Base Compatibility: 3c590 Vortex 10BaseT 3c592 chip 3c595 Vortex 100BaseTX 3c595 Vortex 100BaseT4 3c595 Vortex 100Base-MII 3c597 chip 3Com Vortex 3c900 Boomerang 10BaseT 3c900 Boomerang 10Mbit/s Combo 3c900 Cyclone 10Mbit/s Combo 3c900B-FL Cyclone 10Base-FL 3c905 Boomerang 100BaseTX 3c905 Boomerang 100BaseT4 3c905B Cyclone 100BaseTX 3c905B Cyclone 10/100/BNC 3c905B-FX Cyclone 100BaseFX 3c905C Tornado 3c980 Cyclone 3cSOHO100-TX Hurricane 3CSOHO100B-TX 3c555 Laptop Hurricane 3c575 Boomerang CardBus 3CCFE575 Cyclone CardBus 3CCFE656 Cyclone CardBus 3c575 series CardBus 3Com Boomerang Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

170

ADMtek Pegasus Chipset type: ADMtek Pegasus/Pegasus II USB 10/100BaseT Compatibility: Planet 10/100Base-TX USB Ethernet Adapter UE -9500 Linksys Instant EtherFast 10/100 USB Network Adapter USB100TX AMD PCnet Chipset type: AMD PCnet/PCnet II ISA/PCI 10BaseT Compatibility: AMD PCnet-ISA AMD PCnet-ISA II AMD PCnet-PCI II AMD 79C960 based cards AMD PCnet32 Chipset type: AMD PCnet32 PCI 10BaseT and 10/100BaseT Compatibility: AMD PCnet-PCI AMD PCnet-32 AMD PCnet-Fast Broadcom Tigon3 Chipset type: Broadcom Ti gon3 PCI 10/100/1000BaseT Compatibility: Broadcom Tigon3 570x Broadcom Tigon3 5782 Broadcom Tigon3 5788 Broadcom Tigon3 5901 Broadcom Tigon3 5901-2 SysKonnect SK-9Dxx Gigabit Ethernet SysKonnect SK-9Mxx Gigabit Ethernet Altima AC100x Altima AC9100 Davicom DM9102 Chipset type: Davicom DM9102 PCI 10/100Base Compatibility: Davicom DM9102 Davicom DM9102A Davicom DM9102A+DM9801 Davicom DM9102A+DM9802 DEC 21x4x 'Tulip' Chipset type: DEC 21x4x "Tulip" PCI 10/100Base Compatibility: Digital DC21040 Tulip Digital DC21041 Tulip Digital DS21140 Tulip 21140A chip 21142 chip Digital DS21143 Tulip D-Link DFE 570TX 4-port Lite-On 82c168 PNIC Macronix 98713 PMAC Macronix 98715 PMAC Macronix 98725 PMAC ASIX AX88140 Lite-On LC82C115 PNIC-II ADMtek AN981 Comet Compex RL100-TX Intel 21145 Tulip Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 171

IMC QuikNic FX Conexant LANfinity Intel EtherExpressPro Chipset type: Intel i82557 "Speedo3" (Intel EtherExpressPro) PCI 10/100Base Compatibility: Intel i82557/i82558/i82559ER/i82801BA -7 EtherExpressPro PCI cards Intel PRO/1000 Chipset type: Intel i8254x (Intel PRO/1000) PCI 10/100/1000Base Compatibility: Intel PRO/1000 Gigabit Server Adapter (i82542, Board IDs: 700262 -xxx, 717037-xxx) Intel PRO/1000 F Server Adapter (i82543, Board IDs: 738640 -xxx, A38888-xxx) Intel PRO/1000 T Server Adapter (i82543, Board IDs: A19845 -xxx, A33948-xxx) Intel PRO/1000 XT Server Adapter (i82544, Board IDs: A51580 -xxx) Intel PRO/1000 XF Server Adapter (i82544, Board IDs: A50484 -xxx) Intel PRO/1000 T Desktop Adapter (i8254 4, Board IDs: A62947-xxx) Intel PRO/1000 MT Desktop Adapter (i82540, Board IDs: A78408 -xxx, C91016-xxx) Intel PRO/1000 MT Server Adapter (i82545, Board IDs: A92165 -xxx, C31527-xxx) Intel PRO/1000 MT Dual Port Server Adapter (i82546, Board IDs: A92111 -xxx, C29887-xxx) Intel PRO/1000 MT Quad Port Server Adapter (i82546, Board IDs: C32199 -xxx) Intel PRO/1000 MF Server Adapter (i82545, Board IDs: A91622 -xxx, C33915-xxx) Intel PRO/1000 MF Server Adapter (LX) (i82545, Board IDs: A91624 -xxx, C33916-xxx) Intel PRO/1000 MF Dual Port Server Adapter (i82546, Board IDs: A91620 -xxx, C30848-xxx) Intel PRO/1000 GT Desktop Adapter (i82541PI) Marvell Yukon Chipset type: Marvell Yukon 88E80xx PCI 10/100/1000Base Compatibility: 3Com 3C940 Gigabit LOM Ethernet Adapter 3Com 3C941 Gigabit LOM Ethernet Adapter Allied Telesyn AT-2970LX Gigabit Ethernet Adapter Allied Telesyn AT-2970LX/2SC Gigabit Ethernet Adapter Allied Telesyn AT-2970SX Gigabit Ethernet Adapter Allied Telesyn AT-2970SX/2SC Gigabit Ethernet Adapter Allied Telesyn AT-2970TX Gigabit Ethernet Adapter Allied Telesyn AT-2970TX/2TX Gigabit Ethernet Adapter Allied Telesyn AT-2971SX Gigabit Ethernet Adapter Allied Telesyn AT-2971T Gigabit Ethernet Adapter DGE-530T Gigabit Ethernet Adapter EG1032 v2 Instant Gigabit Network Adapter EG1064 v2 Instant Gigabit Network Adapter Marvell 88E8001 Gigabit LOM Ethernet Adapter Marvell RDK-80xx Adapter Marvell Yukon Gigabit Ethernet 10/100/1000Base -T Adapter N-Way PCI-Bus Giga-Card 1000/100/10Mbps(L) SK-9521 10/100/1000Base-T Adapter SK-98xx Gigabit Ethernet Server Adapter SMC EZ Card 1000 Marvell Yukon 88E8010 based Marvell Yukon 88E8003 based Marvell Yukon 88E8001 based National Semiconductor DP83810 Chipset type: National Semiconductor DP83810 PCI 10/10 0BaseT Compatibility: RouterBoard 200 built-in Ethernet RouterBoard 24 4-port Ethernet NS DP8381x-based cards National Semiconductor DP83820 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

172

Chipset type: National Semiconductor DP83820 PCI 10/100/1000BaseT Compatibility: Planet ENW-9601T NS DP8382x-based cards NE2000 ISA Chipset type: NE2000 ISA 10Base Compatibility: various ISA cards NE2000 PCI Chipset type: NE2000 PCI 10Base Compatibility: RealTek RTL-8029 Winbond 89C940 and 89C940F Compex RL2000 KTI ET32P2 NetVin NV5000SC Via 86C926 SureCom NE34 Holtek HT80232 Holtek HT80229 IMC EtherNic/PCI FO NS8390 Chipset type: NS8390-compatible PCMCIA/CardBus 10Base Compatibility: D-Link DE-660 Ethernet NE-2000 Compatible PCMCIA Ethernet NS8390-based PCMCIA cards RealTek RTL8129 Chipset type: RealTek RTL8129 PCI 10/100Base Compatibility: RealTek RTL8129 Fast Ethernet RealTek RTL8139 Fast Ethernet RTL8139A/B/C/D chip RTL8130 chip RTL8100B chip SMC1211TX EZCard 10/100 (RealTek RTL8139) Accton MPX5030 (RealTek RTL8139) D-Link DFE 538TX RealTek RTL8169 Chipset type: RealTek RTL8169 PCI 10/100/1000Base Compatibility: RealTek RTL8169 Gigabit Ethernet RouterBOARD 44G Sundance ST201 'Alta' Chipset type: Sundance ST201 "Alta" PCI 10/100Base Compatibility: D-Link DFE-550TX Fast Ethernet Adapter D-Link DFE-550FX 100Mbps Fiber-optics Adapter D-Link DFE-580TX 4-port Server Adapter (not recommended: may lock up the system) D-Link DFE-530TXS Fast Ethernet Adapter D-Link DL10050-based FAST Ethernet Adapter Sundance ST201 "Alta" chip Kendin KS8723 chip TI ThunderLAN Chipset type: TI ThunderLAN PCI 10/100Base Compatibility: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 173

Compaq Netelligent 10 T Compaq Netelligent 10 T/2 Compaq Netelligent 10/100 TX Compaq NetFlex-3/P Olicom OC-2183 Olicom OC-2185 Olicom OC-2325 Olicom OC-2326 VIA vt612x 'Velocity' Chipset type: VIA vt612x "Velocity" PCI 10/100/1000Base Compatibility: VIA VT6120 VIA VT6121 VIA VT6122 VIA vt86c100 'Rhine' Chipset type: VIA vt86c100 "Rhine" PCI 10/100Base Compatibility: VIA Rhine (vt3043) VIA Rhine II (vt3065 AKA vt86c100) VIA VT86C100A Rhine VIA VT6102 Rhine-II VIA VT6105 Rhine-III VIA VT6105M Rhine-III RouterBOARD 44 4-port Fast Ethernet card D-Link DFE 530TX Winbond w89c840 Chipset type: Winbond w89c840 PCI 10/100Base Compatibility: Winbond W89c840 Compex RL100-ATX

Notes
For ISA cards load the driver by specifying the I/O base address. IRQ is not required.

Wireless
Packages required: wireless

Description
Atheros Chipset type: Atheros AR5001X PCI/CardBUS 11/54Mbit/s IEEE802.11a/b/g (with wireless AP function) Compatibility: Intel 5000 series Dlink DWL-A520 Dlink DWL-G650 Ubiquity SR5, SR2, SR9 series Atheros AR5000 chipset series based IEEE802.11a (AR5210 MAC plus AR5110 PHY chips) cards Atheros AR5001A chipset series based IEEE802.11a (AR5211 MA C plus AR5111 PHY chips) cards Atheros AR5001X chipset series based IEEE802.11a (AR5211 MAC plus AR5111 PHY chips), IEEE802.11b/g (AR5211 MAC plus AR2111 PHY chips), IEEE802.11a/b/g (AR5211 MAC plus AR5111 and 2111 PHY chips) cards Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 174

Atheros AR5001X+ chipset series based IEEE802.11a (AR5212 MAC plus AR5111 PHY chips), IEEE802.11b/g (AR5212 MAC plus AR2111 PHY chips), IEEE802.11a/b/g (AR5212 MAC plus AR5111 and 2111 PHY chips) cards Atheros AR5002X+ chipset series based IEEE802.11b/g (AR5212 MAC plus AR2112 PHY chips), IEEE802.11a/b/g (AR5212 MAC plus AR5112 PHY chips) cards Atheros AR5004X+ chipset series based IEEE802.11b/g (AR5213 MAC plus AR2112 PHY chips), IEEE802.11a/b/g (AR5213 MAC plus AR5112 PHY chips) cards Atheros AR5006X chipset series based IE EE802.11a/b/g (AR5413/AR5414 single -chip devices) cards Senao NMP-8602 Series cards Cisco/Aironet Chipset type: Cisco/Aironet ISA/PCI/PCMCIA 11Mbit/s IEEE802.11b (wireless station only) Compatibility: Aironet ISA/PCI/PC4800 2.4GHz DS 11Mbit/s Wireless L AN Adapters (100mW) Aironet ISA/PCI/PC4500 2.4GHz DS 2Mbit/s Wireless LAN Adapters (100mW) CISCO AIR-PCI340 2.4GHz DS 11Mbit/s Wireless LAN Adapters (30mW) CISCO AIR-PCI/PC350/352 2.4GHz DS 11Mbit/s Wireless LAN Adapters (100mW) Intersil Prism II Chipset type: Intersil Prism II PCI/CardBUS 11Mbit/s IEEE802.11b (with wireless AP feature) Compatibility: Intersil PRISM2 Reference Design 11Mbit/s IEEE802.11b WLAN Card GemTek WL-211 Wireless LAN PC Card Compaq iPaq HNW-100 11Mbit/s 802.11b WLAN Card Samsung SWL2000-N 11Mbit/s 802.11b WLAN Card Z-Com XI300 11Mbit/s 802.11b WLAN Card ZoomAir 4100 11Mbit/s 802.11b WLAN Card Linksys WPC11 11Mbit/s 802.11b WLAN Card Addtron AWP-100 11Mbit/s 802.11b WLAN Card D-Link DWL-650 11Mbit/s 802.11b WLAN Card SMC 2632W 11Mbit/s 802.11b WLAN Card BroMax Freeport 11Mbit/s 802.11b WLAN Card Intersil PRISM2 Reference Design 11Mbit/s WLAN Card Bromax OEM 11Mbit/s 802.11b WLAN Card (Prism 2.5) corega K.K. Wireless LAN PCC -11 corega K.K. Wireless LAN PCCA -11 CONTEC FLEXSCAN/FX-DDS110-PCC PLANEX GeoWave/GW-NS110 Ambicom WL1100 11Mbit/s 802.11b WLAN Card LeArtery SYNCBYAIR 11Mbit/s 802.11b WLAN Card Intermec MobileLAN 11Mbit/s 802.11b WLAN Card NETGEAR MA401 11Mbit/s 802.11 WLAN Card Intersil PRISM Freedom 11Mbit /s 802.11 WLAN Card OTC Wireless AirEZY 2411-PCC 11Mbit/s 802.11 WLAN Card Z-Com XI-325HP PCMCIA 200mW Card Z-Com XI-626 Wireless PCI Card Notes If planned to use WEP with Prism cards see link for more information: Wireless Security Prism cards set in client mode will not connect to Access Points (AP) that work with enabled hide -ssid feature WaveLAN/ORiNOCO Chipset type: Lucent/Agere/Proxim WaveLAN/ORiNOCO ISA/PCMCIA 11Mbit/s IEEE802.11b (wirel ess station only) Compatibility: WaveLAN Bronze/Gold/Silver ISA/PCMCIA

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

175

Aironet Arlan
Packages required: arlan

Description
This is driver for legacy Aironet Arlan cards, not for newer Cisco/Aironet cards. Chipset type: Aironet Arlan IC2200 ISA 2Mbit/s 2. 4GHz Compatibility: Aironet Arlan 655

RadioLAN
Packages required: radiolan

Description
This is driver for legacy RadioLAN cards. Chipset type: RadioLAN ISA/PCMCIA 10Mbit/s 5.8GHz Compatibility: RadioLAN ISA card (Model 101) RadioLAN PCMCIA card

Synchronous Serial
Packages required: synchronous

Description
FarSync PCI V.35/X.21 (8.448 Mbit/s) LMC/SBEI wanPCI-1T1E1 PCI T1/E1 (also known as DS1 or LMC1200P, 1.544 Mbit/s or 2.048 Mbit/s) LMC/SBEI wanPCI-1T3 PCI T3 (also known as DS3, 44.736Mbit/s) Sangoma S5141 (dual-port) and S5142 (quad-port) PCI RS232/V.35/X.21 (4Mbit/s - primary port and 512Kbit/s - secondary ones)

Asynchronous Serial
Packages required: system

Description
Standard Communication Ports Com1 and Com2 Moxa Smartio C104H/PCI, CP -114, CT-114, CP-132, C168H, CP-168H, and CP-168U PCI 2/4/8 port up to 4 cards (up to 32 ports) Cyclades Cyclom-Y and Cyclades-Z Series PCI cards up to 64 ports per card, up to 4 cards (up to 256 ports) TCL DataBooster 4 or 8 PCI 4/8 port cards Sangoma S514/56 PCI 56 or 64Kbit/s DDS DSU with secondary 128Kbit/s RS232 port ( Note: this card is not for modem pools or serial terminals)

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

176

ISDN
Packages required: isdn

Description
PCI ISDN cards: Eicon.Diehl Diva PCI Sedlbauer Speed Card PCI ELSA Quickstep 1000PCI Traverse Technologie NETjet PCI S0 card Teles PCI Dr. Neuhaus Niccy PCI AVM Fritz PCI Gazel PCI ISDN cards HFC-2BS0 based PCI cards (TeleInt SA1) Winbond W6692 based PCI cards

VoIP
Packages required: telephony

Description
H.323 Protocol VoIP Analog Gateways QuickNet LineJack ISA QuickNet PhoneJack ISA Voicetronix V4PCI - 4 analog telephone lines cards Zaptel X.100P IP telephony card (1 analog line)

xDSL
Packages required: synchronous

Description
Xpeed 300 SDSL cards (up to 6.7km twisted p air wire connection, max 2.3Mbit/s)

HomePNA
Packages required: system

Description
Linksys HomeLink PhoneLine Network Card (up to 10Mbit/s home network over telephone line)

LCD
Packages required: lcd

Description
Crystalfontz Intelligent Serial LCD Modul e 632 (16x2 characters) and 634 (20x4 characters) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 177

Powertip Character LCD Module PC1602 (16x2 characters), PC1604 (16x4 characters), PC2002 (20x2 characters), PC2004 (20x4 characters), PC2402 (24x2 characters) and PC2404 (24x4 characters)

PCMCIA Adapters
Packages required: system

Description
Vadem VG-469 PCMCIA-ISA adapter (one or two PCMCIA ports) RICOH PCMCIA-PCI Bridge with R5C475 II or RC476 II chip (one or two PCMCIA ports) CISCO/Aironet PCMCIA adapter (ISA and PCI versions) for CISCO/Aironet PCMC IA cards only

GPRS Cards
Packages required: wireless

Description
NWH 1600 GPRS Modem (Benq M32 chip)

CDMA/EV-DO Cards
Packages required: system

Description
Audiovox PC5220 CDMA Dual Band 1XEV -DO PC Card for VerizonWireless Verizon Express Network PC 5220 (AirPrime 5220) Kyocera KPC650 (Verizon Wireless) Novatel Wireless CDMA card Novatel U730 (Wireless HSDPA Modem) Huawei Mobile Connect Model E620 (3G) Novatel Merlin S720 (HSDPA) Option G3 PCMCIA card (Vodafone UMTS) Sierra Aircard 595 and othe r Sierra Wireless cards

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

178

BAB XXII VLAN


General Information
Summary
VLAN is an implementation of the 802.1Q VLAN protocol for MikroTik RouterOS. It allows you to have multiple Virtual LANs on a single ethernet or wireless interface, givi ng the ability to segregate LANs efficiently. It supports up to 4095 vlan interfaces, each with a unique VLAN ID, per ethernet device. Many routers, including Cisco and Linux based, and many Layer 2 switches also support it. A VLAN is a logical grouping th at allows end users to communicate as if they were physically connected to a single isolated LAN, independent of the physical configuration of the network. VLAN support adds a new dimension of security and cost savings permitting the sharing of a physical network while logically maintaining separation among unrelated users.

Specifications
Packages required: system License required: Level1 (limited to 1 vlan) , Level3 Submenu level: /interface vlan Standards and Technologies: VLAN (IEEE 802.1Q) Hardware usage: Not significant

Related Documents
Software Package Management IP Addresses and ARP

Description
VLANs are simply a way of grouping a set of switch ports together so that they form a logical network, separate from any other such group. Within a single switch this is straightforward local configuration. When the VLAN extends over more than one switch, the in ter-switch links have to become trunks, on which packets are tagged to indicate which VLAN they belong to. You can use MikroTik RouterOS (as well as Cisco IOS and Linux) to mark these packets as well as to accept and route marked ones. As VLAN works on OSI Layer 2, it can be used just as any other network interface without any restrictions. And VLAN successfully passes through Ethernet bridges (for MikroTik RouterOS bridges you should set forward-protocols to ip, arp and other; for other bridges there shoul d be analogical settings). You can also transport VLANs over wireless links and put multiple VLAN interfaces on a single wireless interface. Note that as VLAN is not a full tunnel protocol (i.e., it does not have additional fields to transport MAC addresses of sender and recipient), the same limitation applies to bridging over VLAN as to bridging plain wireless interfaces. In other words, while wireless clients may participate in VLANs put on wireless interfaces, it is not possible to have VLAN put on a wir eless interface in station mode bridged with any other interface. Currently supported Ethernet interfaces This is a list of network interfaces on which VLAN was tested and worked. Note that there might be many other interfaces that support VLAN, but they just were not checked. Realtek 8139 Intel PRO/100 Intel PRO1000 server adapter Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 179

National Semiconductor DP83816 based cards (RouterBOARD200 onboard Ethernet, RouterBOARD 24 card) National Semiconductor DP83815 (Soekris onboard Ethernet) VIA VT6105M based cards (RouterBOARD 44 card) VIA VT6105 VIA VT6102 (VIA EPIA onboard Ethernet) This is a list of network interfaces on which VLAN was tested and worked, but WITHOUT LARGE PACKET (>1496 bytes) SUPPORT : 3Com 3c59x PCI DEC 21140 (tulip)

Additional Resources
http://www.csd.uwo.ca/courses/CS457a/reports/handin/jpbojtos/A2/trunking.htm http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121newft/121t/121t3/dtbridge.htm# xtocid114533 http://www.cisco.com/warp/public/473/27.html#tagging http://www.cisco.com/warp/public/538/7.html http://www.nwfusion.com/news/tech /2001/0305tech.html http://www.intel.com/network/connectivity/resources/doc_library/tech_brief/virtual_lans.htm

VLAN Setup
Submenu level: /interface vlan

Property Description
arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - Address Resolution Protocol setting disabled - the interface will not use ARP protocol enabled - the interface will use ARP protocol proxy-arp - the interface will be an ARP proxy reply-only - the interface will only reply to the requests originated to its own IP addresses, but neighbor MAC addresses will be gathered from /ip arp statically set table only interface (name) - physical interface to the network where are VLANs mtu (integer; default: 1500) - Maximum Transmission Unit name (name) - interface name for reference vlan-id (integer; default: 1) - Virtual LAN identifier or tag that is used to distinguish VLANs. Must be equal for all computers in one VLAN.

Notes
MTU should be set to 1500 bytes as on Ethernet interfaces. But this may not work with some Ethernet cards that do not support receiving/transmitting of full size Ethernet packets with VLAN header added (1500 bytes data + 4 bytes VLAN header + 14 bytes Ethernet header). In this situation MTU 1496 can be used, but note that this will cause packet fragmentation if larger packets have to be sent over interface. At the same time remember that MTU 1496 may cause problems if path MTU discove ry is not working properly between source and destination.

Example
To add and enable a VLAN interface named test with vlan-id=1 on interface ether1: [admin@MikroTik] interface vlan> add name=test vlan -id=1 interface=ether1 [admin@MikroTik] interface vlan> print Flags: X - disabled, R - running # NAME MTU ARP VLAN -ID INTERFACE 0 X test 1500 enabled 1 ether1 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 180 Referensi : Download :www.mikrotik.com

[admin@MikroTik] interface vlan> [admin@MikroTik] interface vlan> Flags: X - disabled, R - running # NAME MTU 0 R test 1500 [admin@MikroTik] interface vlan>

enable 0 print ARP enabled VLAN -ID INTERFACE 1 ether1

Application Example
VLAN example on MikroTik Routers
Let us assume that we have two or more MikroTik RouterOS routers connected with a hub. Interfaces to the physical network, where VLAN is to be created is ether1 for all of them (it is needed only for example simplification, it is NOT a must). To connect computers through VLAN they must b e connected physically and unique IP addresses should be assigned them so that they could ping each other. Then on each of them the VLAN interface should be created: [admin@MikroTik] interface vlan> add name=test vlan -id=32 interface=ether1 [admin@MikroTik] interface vlan> print Flags: X - disabled, R - running # NAME MTU ARP VLAN -ID INTERFACE 0 R test 1500 enabled 32 ether1 [admin@MikroTik] interface vlan> If the interfaces were successfully created, bo th of them will be running. If computers are connected incorrectly (through network device that does not retransmit or forward VLAN packets), either both or one of the interfaces will not be running. When the interface is running, IP addresses can be assig ned to the VLAN interfaces. On the Router 1: [admin@MikroTik] ip address> add address=10.10.10.1/24 interface=test [admin@MikroTik] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INT ERFACE 0 10.0.0.204/24 10.0.0.0 10.0.0.255 ether1 1 10.20.0.1/24 10.20.0.0 10.20.0.255 pc1 2 10.10.10.1/24 10.10.10.0 10.10.10.255 test [admin@MikroTik] ip address> On the Router 2: [admin@MikroTik] ip address> add address=10.10.10.2/24 interface=test [admin@MikroTik] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 10.0.0.201/24 10.0.0.0 10.0.0.255 ether1 1 10.10.10.2/24 10.10.10.0 10.10.10.255 test [admin@MikroTik] ip address> If it set up correctly, then it is possible to ping Router 2 from Router 1 and vice versa: [admin@MikroTik] ip address> /ping 10.10.10.1 10.10.10.1 64 byte pong: ttl=255 time=3 ms 10.10.10.1 64 byte pong: ttl=255 time=4 ms 10.10.10.1 64 byte pong: ttl=255 time=10 ms 10.10.10.1 64 byte pong: ttl=255 time=5 ms 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 3/10.5/10 ms [admin@MikroTik] ip address> /ping 10.10.10.2 10.10.10.2 64 byte pong: ttl=255 time=10 ms 10.10.10.2 64 byte pong: ttl=255 time=11 ms 10.10.10.2 64 byte pong: ttl=255 time=10 ms 10.10.10.2 64 byte pong: ttl=255 time=13 ms 4 packets transmitted, 4 packets receiv ed, 0% packet loss Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 181

round-trip min/avg/max = 10/11/13 ms [admin@MikroTik] ip address>

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

182

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

183

BAB XXIII PPPoE


General Information
Summary
The PPPoE (Point to Point Protocol over Ethernet) protocol provides extensive user management, network management and accounting benefits to ISPs and network administrators. Currently PPPoE is used mainly by ISPs to control client connections for xDSL and cable modems as well as plain Ethernet networks. PPPoE is an extension of the standard Point to Point Protocol (PPP). The difference between them is expressed in transport method: PPPoE employs Ethernet instead of modem connection. Generally speaking, PPPoE is used to hand out IP addresses to clients based on the user (and workstation, if desired) authentication as opposed to workstation only authentication, when static IP addresses or DHCP are used. It is adviced not to use static IP addresses or DHCP on the same interfaces as PPPoE for obvious security reasons. MikroTik RouterOS can act as a RADIUS client - you can use a RADIUS server to authenticate PPPoE clients and use accounting for them. A PPPoE connection is composed of a client and an access concentrator (server). The client may be any computer that has the PPPoE client protocol support installed. T he MikroTik RouterOS supports both - client and access concentrator implementations of PPPoE. The PPPoE client and server work over any Ethernet level interface on the router - wireless 802.11 (Aironet, Cisco, WaveLan, Prism, Atheros), 10/100/1000 Mbit/s Ethernet, RadioLan and EoIP (Ethernet over IP tunnel). No encryption, MPPE 40bit RSA and MPPE 128bit RSA encryption is supported. Note that when RADIUS server is authenticating a user with CHAP, MS -CHAPv1 or MS-CHAPv2, the RADIUS protocol does not use share d secret, it is used only in authentication reply. So if you have a wrong shared secret, RADIUS server will accept the request. You can use /radius monitor command to see badreplies parameter. This value should increase whenever a client tries to connect. Supported connections MikroTik RouterOS PPPoE client to any PPPoE server (access concentrator) MikroTik RouterOS server (access concentrator) to multiple PPPoE clients (clients are avaliable for almost all operating systems and most routers)

Quick Setup Guide


To configure MikroTik RouterOS to be a PPPoE client 17. Just add a pppoe-client: /interface pppoe-client add name=pppoe -user-mike user=mike password=123 \ \... interface=wlan1 service -name=internet disabled=no To configure MikroTik RouterOS to be an Ac cess Concentrator (PPPoE Server) 10. Add an address pool for the clients from 10.1.1.62 to 10.1.1.72, called pppoe-pool: /ip pool add name="pppoe -pool" ranges=10.1.1.62 -10.1.1.72 11. Add PPP profile, called pppoe-profile where local-address will be the router's address and clients will have an address from pppoe-pool: /ppp profile add name="pppoe -profile" local-address=10.1.1.1 remote-address=pppoe-pool 12. Add a user with username mike and password 123: /ppp secret add name=mike password=123 service=pppoe profile=pppoe-profile 13. Now add a pppoe server: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 184

/interface pppoe-server server add service -name=internet interface=wlan1 \ \... default-profile=pppoe-profile

Specifications
Packages required: ppp License required: Level1 (limited to 1 interface) , Level3 (limited to 200 interfaces) , Level4 (limited to 200 interfaces) , Level5 (limited to 500 interfaces) , Level6 (unlimited) Submenu level: /interface pppoe-server, /interface pppoe-client Standards and Technologies: PPPoE (RFC 2516) Hardware usage: PPPoE server may require additional RAM (uses approx. 9KiB (plus extra 10KiB for packet queue, if data rate limitation is used) for each connection) and CPU power. Maximum of 65535 connections is supported.

Related Documents
Software Package Management IP Addresses and ARP RADIUS client PPP User AAA Log Management

Additional Resources
Links for PPPoE documentation: http://www.faqs.org/rfcs/rfc2516.html PPPoE Clients: RASPPPoE for Windows 95, 98, 98SE, ME, NT4, 2000, XP, .NET http://www.raspppoe.com/

PPPoE Client Setup


Submenu level: /interface pppoe-client

Description
The PPPoE client supports high -speed connections. It is fully compatible with the MikroTik PPPoE server (access concentrator). Note for Windows. Some connection instructions may use the form where the "phone number", such as "MikroTik_AC\mt1", to indicate that "MikroTik_AC" is the access concentrator name and "mt1" is the service name.

Property Description
ac-name (text; default: "") - this may be left blank and the client will connect to any access concentrator that offers the "service" name selected add-default-route (yes | no; default: no) - whether to add a default route automatically allow (multiple choice: mschap2, mschap1, chap, pap; default: mschap2, mschap1, chap, pap ) - the protocol to allow the client to use for authentication dial-on-demand (yes | no; default: no) - connects to AC only when outbound traffic is generated and disconnects when there is no traffic for the p eriod set in the idle-timeout value interface (name) - interface the PPPoE server can be connected through mru (integer; default: 1480) - Maximum Receive Unit. The optimal value is the MTU of the interface the tunnel is working over decreased by 20 (so, for 1500-byte ethernet link, set the MTU to 1480 to avoid fragmentation of packets) Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 185 Referensi : Download :www.mikrotik.com

mtu (integer; default: 1480) - Maximum Transmission Unit. The optimal value is the MTU of the interface the tunnel is working over decreased by 20 (so, for 1500 -byte ethernet link, set the MTU to 1480 to avoid fragmentation of packets) name (name; default: pppoe-out1) - name of the PPPoE interface password (text; default: "") - a user password used to connect the PPPoE server profile (name) - default profile for the connection service-name (text; default: "") - specifies the service name set on the access concentrator. Leave it blank unless you have many services and need to specify the one you need to connect to use-peer-dns (yes | no; default: no) - whether to set the router's default DNS to the PPP peer DNS (i.e. whether to get DNS settings from the peer) user (text; default: "") - a user name that is present on the PPPoE server

Example
To add and enable PPPoE client on the gig interface connecting to the AC that p rovides testSN service using user name john with the password password: [admin@RemoteOffice] interface pppoe -client> add interface=gig \ \... service-name=testSN user=john password=password disabled=no [admin@RemoteOffice] interface pppoe -client> print Flags: X - disabled, R - running 0 R name="pppoe -out1" mtu=1480 mru=1480 interface=gig user="john" password="password" profile=default service -name="testSN" ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no

Monitoring PPPoE Client


Command name: /interface pppoe-client monitor

Property Description
ac-mac (MAC address) - MAC address of the access concentrator (AC) the client is connected to ac-name (text) - name of the AC the client is connected to encoding (text) - encryption and encoding (if asymmetric, separated with '/') being used in this connection service-name (text) - name of the service the client is connected to status (text) - status of the client Dialing - attempting to make a connection Verifying password... - connection has been established to the server, password verification in progress Connected - self-explanatory Terminated - interface is not enabled or the other side will not establish a connection uptime (time) connection time displayed in days, hour s, minutes and seconds uptime (time) - connection time displayed in days, hours, minutes and seconds

Example
To monitor the pppoe-out1 connection: [admin@MikroTik] interface pppoe -client> monitor pppoe -out1 status: "connected" uptime: 10s encoding: "none" service-name: "testSN" ac-name: "10.0.0.1" ac-mac: 00:C0:DF:07:5E:E6 [admin@MikroTik] interface pppoe -client>

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

186

PPPoE Server Setup (Access Concentrator)


Submenu level: /interface pppoe-server server

Description
The PPPoE server (access concentrator) supports multiple servers for each interface - with differing service names. Currently the throughput of the PPPoE server has been tested to 160 Mb/s on a Celeron 600 CPU. Using higher speed CPUs, throughput should increase proportionately. The access concentrator name and PPPoE service name are used by clients to identity the access concentrator to register with. The access concentrator name is the same as the identity of the router displayed before the command prompt. The identity may be set within the /system identity submenu. PPPoE users are created in /ppp secret menu, see the AAA manual for further information. Note that if no service name is specified in WindowsXP, it will use only service with no name. So if you want to serve WindowsXP clients, leave your service name empty.

Property Description
authentication (multiple choice: mschap2 | mschap1 | chap | pap; default: mschap2, mschap1, chap, pap) authentication algorithm default-profile (name; default: default) - default profile to use interface (name) - interface to which the clients will connect to keepalive-timeout (time; default: 10) - defines the time period (in seconds) after which the router is starting to send keepalive packets every second. If no traffic and no keepalive responses has came for that period of time (i.e. 2 * keepalive-timeout), not responding client is proclaimed disconnected. max-mru (integer; default: 1480) - Maximum Receive Unit. The optimal value is the MTU of the interface the tunnel is working over decreased by 20 (so, for 1500 -byte Ethernet link, set the MTU to 1480 to avoid fragmentation of packets) max-mtu (integer; default: 1480) - Maximum Transmission Unit. The optimal value is the MTU of the interface the tunnel is working over decreased by 20 (so, for 1500 -byte Ethernet link, set the MTU to 1480 to avoid fragmentation of packets) max-sessions (integer; default: 0) - maximum number of clients tha t the AC can serve 0 - unlimited one-session-per-host (yes | no; default: no) - allow only one session per host (determined by MAC address). If a host will try to establish a new session, the old one will be closed service-name (text) - the PPPoE service name

Notes
The default keepalive-timeout value of 10 is OK in most cases. If you set it to 0, the router will not disconnect clients until they log out or router is restarted. To resolve this problem, the one-session-per-host property can be used. Security issue: do not assign an IP address to the interface you will be receiving the PPPoE requests on.

Example
To add PPPoE server on ether1 interface providing ex service and allowing only one connection per host: [admin@MikroTik] interface pppoe -server server> add interface=ether1 \ \... service-name=ex one-session-per-host=yes [admin@MikroTik] interface pppoe -server server> print Flags: X - disabled 0 X service-name="ex" interface=ether1 mtu=1480 mru=1480 authentication=mschap2,mschap,chap,pap k eepalive-timeout=10 one-session-per-host=yes default-profile=default [admin@MikroTik] interface pppoe -server server> Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 187

PPPoE Users
Description
The PPPoE users are authenticated through a RADIUS server (if configured), and if RADIUS fails, then the local PPP user databese is used. See the respective manual sections for more information: RADIUS client PPP User AAA

PPPoE Server User Interfaces


Submenu level: /interface pppoe-server

Description
This menu allows you to see all the connected users, as well as to set static interface names to be used in different configurations, where unchangable interface needs to be specified (and, thus, dynamic names cannot be used)

Property Description
encoding (read-only: text) - encryption and encoding (if asymmetric, separated with '/') being used in this connection name (name) - interface name remote-address (read-only: MAC address) - MAC address of the connected client service-name (name) - name of the service the user is connected to uptime (time) - shows how long the client is connected user (name) - the name of the connected user (must be present in the user darabase anyway)

Example
To view the currently connected users: [admin@MikroTik] interface pppoe -server> print Flags: R - running # NAME SERVICE REMOTE -ADDRESS USER 0 R <pppoe-ex> ex 00:C0:CA:16:16:A5 ex

ENCO... UPTIME 12s

[admin@MikroTik] interface pppoe -server> To disconnect the user ex: [admin@MikroTik] interface pppoe -server> remove [find user=ex] [admin@MikroTik] interface pppoe -server> print [admin@MikroTik] interface pppoe -server>

Application Examples
PPPoE in a multipoint wireless 802.11g network
In a wireless network, the PPPoE s erver may be attached to an Access Point (as well as to a regular station of wireless infrastructure). Either our RouterOS client or Windows PPPoE clients may connect to the Access Point for PPPoE authentication. Further, for RouterOS clients, the radio in terface may be set to MTU 1600 so that the PPPoE interface may be set to MTU 1500. This optimizes the transmission of 1500 byte packets and avoids any Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 188

problems associated with MTUs lower than 1500. It has not been determined how to change the MTU of the Windows wireless interface at this moment. Let us consider the following setup where the MikroTik Wireless AP offers wireless clients transparent access to the local network with authentication:

First of all, the wireless interface should be conf igured: [admin@PPPoE-Server] interface wireless> set 0 mode=ap -bridge \ frequency=2442 band=2.4ghz -b/g ssid=mt disabled=no [admin@PPPoE-Server] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:01:24:7 0:53:04 arp=enabled disable-running-check=no interface -type=Atheros AR5211 radio-name="000124705304" mode=station ssid="mt" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=2412 band=2.4ghz -b scan-list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 189 Referensi : Download :www.mikrotik.com

update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble-mode=both [admin@PPPoE-Server] interface wireless> Now, configure the Ethernet interface, add the IP address and set the default route: [admin@PPPoE-Server] ip address> add address=10.1.0.3/24 interface=Local [admin@PPPoE-Server] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 10.1.0.3/24 10.1.0.0 10.1.0.255 Local [admin@PPPoE-Server] ip address> /ip route [admin@PPPoE-Server] ip route> add gat eway=10.1.0.1 [admin@PPPoE-Server] ip route> print Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf # DST-ADDRESS G GATEWAY DISTANCE INTERFACE 0 ADC 10.1.0.0/24 Local 1 A S 0.0.0.0/0 r 10.1.0.1 1 Local [admin@PPPoE-Server] ip route> /interface ethernet [admin@PPPoE-Server] interface ethernet> set Local arp=proxy -arp [admin@PPPoE-Server] interface ethernet> print Flags: X - disabled, R - running # NAME MTU MAC -ADDRESS ARP 0 R Local 1500 00:0C:42:03:25:53 proxy arp [admin@PPPoE-Server] interface ethernet> We should add PPPoE server to the wireless interf ace: [admin@PPPoE-Server] interface pppoe -server server> add interface=wlan1 \ service-name=mt one-session-per-host=yes disabled=no [admin@PPPoE-Server] interface pppoe -server server> print Flags: X - disabled 0 service-name="mt" interface=wlan1 max -mtu=1480 max-mru=1480 authentication=pap,chap,mschap1,mschap2 keepalive -timeout=10 one-session-per-host=yes max-sessions=0 default -profile=default [admin@PPPoE-Server] interface pppoe -server server> Finally, we can set up PPPoE clients: [admin@PPPoE-Server] ip pool> add name=pppoe ranges=10.1.0.100 -10.1.0.200 [admin@PPPoE-Server] ip pool> print # NAME RANGES 0 pppoe 10.1.0.100 -10.1.0.200 [admin@PPPoE-Server] ip pool> /ppp profile [admin@PPPoE-Server] ppp profile> set default use -encryption=yes \ local-address=10.1.0.3 remote -address=pppoe [admin@PPPoE-Server] ppp profile> print Flags: * - default 0 * name="default" local -address=10.1.0.3 remote -address=pppoe use-compression=no use -vj-compression=no use -encryption=yes only one=no change-tcp-mss=yes 1 * name="default -encryption" use-compression=default use-vj-compression=default use -encryption=yes only -one=default change-tcp-mss=default [admin@PPPoE-Server] ppp profile> .. secret [admin@PPPoE-Server] ppp secret> add name=w password=wkst service=pppoe [admin@PPPoE-Server] ppp secret> add name=l password=ltp service=pppoe [admin@PPPoE-Server] ppp secret> print Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 190

Flags: X - disabled # NAME SE RVICE CALLER-ID PASSWORD PROFILE REMOTE ADDRESS 0 w pppoe wkst default 0.0.0.0 1 l pppoe ltp default 0.0.0.0 [admin@PPPoE-Server] ppp secret> Thus we have completed the configuration and added two users: w and l who are able to connect to Internet, using PPPoE client software. Note that Windows XP built-in client supports encryption, but RASPPPOE does not. So, if it is planned not to support Windows clients older than Windows XP, it is recommended to switch require-encryption to yes value in the default profile configuration. In other case, the server will accept clients that do not encrypt data.

Troubleshooting
Description
I can connect to my PPPoE server. The p ing goes even through it, but I still cannot open web pages Make sure that you have specified a valid DNS server in the router (in /ip dns or in /ppp profile the dns-server parameter). The PPPoE server shows more than one active user entry for one client, when the clients disconnect, they are still shown and active Set the keepalive-timeout parameter (in the PPPoE server configuration) to 10 if You want clients to be considered logged off if they do not respond for 10 seconds. Note that if the keepalive-timeout parameter is set to 0 and the only-one parameter (in PPP profile settings) is set to yes then the clients might be able to connect only once. To resolve this problem onesession-per-host parameter in PPPoE server configuration should be set to yes I can get through the PPPoE link only small packets (eg. pings) You need to change mss of all the packets passing through the PPPoE link to the value of PPPoE link's MTU-40 at least on one of the peers. So for PPPoE link with MTU of 1480: [admin@MT] interface pppoe-server server> set 0 max -mtu=1440 maxmru=1440 [admin@MT] interface pppoe -server server> print Flags: X - disabled 0 service-name="mt" interface=wlan1 max -mtu=1440 max-mru=1440 authentication=pap,chap,mschap1,mschap2 keepalive -timeout=10 one-session-per-host=yes max-sessions=0 default -profile=default [admin@MT] interface pppoe -server server> My windows PPPoE client obtains IP address and default gateway from the MikroTik PPPoE server, but it cannot ping beyond the PPPoE server and us e the Internet PPPoE server is not bridging the clients. Configure masquerading for the PPPoE client addresses, or make sure you have proper routing for the address space used by the clients, or you enable Proxy -ARP on the Ethernet interface (See the IP A ddresses and Address Resolution Protocol (ARP) Manual) My Windows XP client cannot connect to the PPPoE server You have to specify the "Service Name" in the properties of the XP PPPoE client. If the service name is not set, or it does not match the servic e name of the MikroTik PPPoE server, you get the "line is busy" errors, or the system shows "verifying password - unknown error" I want to have logs for PPPoE connection establishment Configure the logging feature under the /system logging facility and enable the PPP type logs

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

191

BAB XXIV Network Monitor


General Information
Summary
The Netwatch tool monitors network host by means of ping and generates events on status change.

Specifications
Packages required: system License required: Level1 Submenu level: /tool netwatch Standards and Technologies: None Hardware usage: Not significant

Related Documents
Software Package Management ../appex/scripting1.php Scripting Host

Network Watching Tool


Specifications
Packages required: advanced-tools License required: Level1 Submenu level: /tool netwatch Standards and Technologies: none Hardware usage: Not significant

Description
Netwatch monitors state of hosts on the network. It does so by sending ICMP pings to the list of specified IP addresses. For each entry in netwatch table you can specify IP address, ping interval and console scripts. The main advantage of netwatch is it's ability to issue arbitrary console commands on host state changes.

Property Description
down-script (name) - a console script that is executed once when state of a host changes from unknown or up to down host (IP address; default: 0.0.0.0) - IP address of host that should be monitored interval (time; default: 1s) - the time between pings. Lowering this will make state changes more responsive, but can create unnecessary traffic and consume system resources since (read-only: time) - indicates when state of the host chang ed last time status (read-only: up | down | unknown) - shows the current status of the host Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 192

up - the host is up down - the host is down unknown - after any properties of this list entry were changed, or the item is enabled or disabled timeout (time; default: 1s) - timeout for each ping. If no reply from a host is received during this time, the host is considered unreachable ( down) up-script (name) - a console script that is executed once when state of a host changes from unknown or down to up

Example
This example will run the scripts gw_1 or gw_2 which change the default gateway depending on the status of one of the gateways: [admin@MikroTik] system script> add name=gw_1 source={/ip route set {... [/ip route find dst 0.0.0.0] gateway 10.0.0.1} [admin@MikroTik] system script> add name=gw_2 source={/ip route set {.. [/ip route find dst 0.0.0.0] gateway 10.0.0.217} [admin@MikroTik] system script> /tool netwatch [admin@MikroTik] tool netwatch> add host=10.0.0.217 interval=10s timeout=998ms \ \... up-script=gw_2 down-script=gw_1 [admin@MikroTik] tool netwatch> print Flags: X - disabled # HOST TIMEOUT INTERVAL STATUS 0 10.0.0.217 997ms 10s up [admin@MikroTik] tool netwatch> print detail Flags: X - disabled 0 host=10.0.0.217 timeout=997ms interval=10s since=feb/27/2003 14:01:03 status=up up -script=gw_2 down-script=gw_1 [admin@MikroTik] tool netwatch> Without scripts, netwatch can be used just as an information tool to see which links are up, or which specific hosts are running at the moment. Let's look at the example above - it changes default route if gateway becomes unreachable. How it's done? There are two scripts. The script "gw_2" is executed once when status of host changes to up. In our case, it's equivalent to entering this console command: [admin@MikroTik] > /ip route set [/ip route find dst 0.0.0.0] gateway 10.0.0.217 The /ip route find dst 0.0.0.0 command returns list of all routes whose dst-address value is 0.0.0.0. Usually, that is the default route. It is substituted as first argument to /ip route set command, which changes gateway of this route to 10.0.0.217 The script "gw_1" is executed once when status of host becomes down. It does the following: [admin@MikroTik] > /ip route set [/ip route find dst 0.0.0 .0] gateway 10.0.0.1 It changes the default gateway if 10.0.0.217 address has become unreachable. Here is another example, that sends e -mail notification whenever the 10.0.0.215 host goes down: [admin@MikroTik] system script> add name=e -down source={/tool e-mail send {... from="[email protected]" server="159.148.147.198" body="Router down" {... subject="Router at second floor is down" to="[email protected]"} [admin@MikroTik] system script> add name=e -up source={/tool e -mail send {... from="[email protected]" server="159. 148.147.198" body="Router up" {.. subject="Router at second floor is up" to="[email protected]"} [admin@MikroTik] system script> [admin@MikroTik] system script> /tool netwatch [admin@MikroTik] system netwatch> add host=10.0.0.215 timeout=999ms \ \... interval=20s up-script=e-up down-script=e-down [admin@MikroTik] tool netwatch> print detail Flags: X - disabled 0 host=10.0.0.215 timeout=998ms interval=20s since=feb/27/2003 14:15:36 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 193

status=up up -script=e-up down-script=e-down [admin@MikroTik] tool ne twatch>

Wireless Client and Wireless Access Point Manual


Document revision: Applies to: 2.2 (Tue Jul 18 14:53:58 GMT 2006) V2.9

General Information
Summary
This manual discusses management of Atheros and Prism chipset based wireless NICs that comp ly with IEEE 802.11 set of standards. These interfaces use radio waves as a physical signal carrier and are capable of data transmission with speeds up to 108 Mbps (in 5GHz turbo -mode). MikroTik RouterOS supports the Intersil Prism II PC/PCI, Atheros AR500 0, AR5001X, AR5001X+, AR5002X+, AR5004X+ and AR5006 chipset based cards for working as wireless clients ( station mode), wireless bridges (bridge mode), wireless access points ( ap-bridge mode), and for antenna positioning (alignment-only mode). For furher information about supported wireless adapters, see Device Driver List MikroTik RouterOS provides a complete support for IEEE 802.11a, 802.11b and 802.11g wireless networking standards. There are several additional fea tures implemented for the wireless networking in RouterOS - WPA (Wi-Fi Protected Access), WEP (Wired Equivalent Privacy), software and hardware AES encryption, WDS (Wireless Distribution System), DFS (Dynamic Frequency Selection), Alignment mode (for posit ioning antennas and monitoring wireless signal), VAP (Virtual Access Point), ability to disable packet forwarding among clients, Nstreme wireless transmission protocol and others. You can see the table of features supported by different cards. The Nstreme protocol is MikroTik proprietary (i.e., incompatible with other vendors) wireless protocol aimed to improve point-to-point and point-to-multipoint wireless links. Advanced version of Nst reme, called Nstreme2 works with a pair of wireless cards (Atheros AR5210 and newer MAC chips only) - one for transmitting data and one for receiving. Benefits of Nstreme protocol: Client polling. Polling reduces media access times, because the card does n ot need to ensure the air is "free" each time it needs to transmit data (the polling mechanism takes care of it) Very low protocol overhead per frame allowing super -high data rates No implied protocol limits on link distance No implied protocol speed de gradation for long link distances Dynamic protocol adjustment depending on traffic type and resource usage

Quick Setup Guide


Let's consider that you have a wireless interface, called wlan1. To set it as an Access Point, working in 802.11g standard, usin g frequency 2442 MHz and Service Set Identifier test, do the following configuration: /interface wireless set wlan1 ssid=test frequency=2442 band=2.4ghz b/g \ mode=ap-bridge disabled=no Now your router is ready to accept wireless clients. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 194

To make a point-to-point connection, using 802.11a standard, frequency 5805 MHz and Service Set Identifier p2p, write: /interface wireless set wlan1 ssid="p2p" frequency=5805 band=5ghz \ mode=bridge disabled=no The remote interface should be configured to station a s showed below. To make the wireless interface as a wireless station, working in 802.11a standard and Service Set Identifier p2p: /interface wireless set wlan1 ssid="p2p" band=5ghz mode=station disabled=no

Specifications
Packages required: wireless License required: Level4 (station and bridge mode) , Level5 (station, bridge and AP mode) , Levelfreq (more frequencies) Submenu level: /interface wireless Standards and Technologies: IEEE802.11a, IEEE802.11b, IEEE802.11g Hardware usage: Not significant

Related Documents
Software Package Management Device Driver List IP Addresses and ARP Log Management

Description
The Atheros card has been tested for distances up to 20 km providing connection speed up to 17Mbit/s. With appropriate antennas and cabling the maximum distance should be as far as 50 km. These values of ack-timeout were approximated from the tests done by us, as well as by s ome of our customers: ack-timeout range 5GHz 5GHz-turbo 2.4GHz-G 0km default default default 5km 52 30 62 10km 85 48 96 15km 121 67 133 20km 160 89 174 25km 203 111 219 30km 249 137 368 35km 298 168 320 40km 350 190 375 45km 405 Please note that these are not the precise values. Depending on hardware used and many other factors they may vary up to +/- 15 microseconds. You can also use dynamic ack-timeout value - the router will determine ack-timeout setting automatically by sending periodically packets with a different ack-timeout. Ack-timeout values by which ACK frame was received are saved and used later to determine the real ack -timeout. The Nstreme protocol may be operated in three modes: Point-to-Point mode - controlled point-to-point mode with one radio on each side Dual radio Point-to-Point mode (Nstreme2) - the protocol will use two radios on both sides simultaneously (one for transmitting data and one for receiving), allowing superfast point -to-point connection Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 195

Point-to-Multipoint - controlled point-to-multipoint mode with client polling (like AP -controlled TokenRing) Hardware Notes The MikroTik RouterOS supports as many Atheros chipset based cards as many free adapter slots are on your system. One license is valid for all cards o n your system. Note that maximal number of PCMCIA sockets is 8. Some chipsets are not stable with Atheros cards and cause radio to stop working. MikroTik RouterBoard 200, RouterBoard 500 series, and systems based on Intel i815 and i845 chipsets are tested and work stable with Atheros cards. There might be many other chipsets that are working stable, but it has been reported that some older chipsets, and some systems based on AMD Duron CPU are not stable. Only AR5212 and newer Atheros MAC chips are stable wi th RouterBOARD200 connected via RouterBOARD14 four-port MiniPCI-to-PCI adapter. This note applies only to the RouterBOARD200 platform with Atheros-based cards.

Wireless Interface Configuration


Submenu level: /interface wireless

Description
In this section we will discuss the most important part of the configuration.

Property Description
ack-timeout (integer | dynamic | indoors) - acknowledgement code timeout (transmission acceptance timeout) in microseconds for acknowledgement messages. Can be one of the se: dynamic - ack-timeout is chosen automatically indoors - standard constant for indoor usage antenna-gain (integer; default: 0) - antenna gain in dBi. This parameter will be used to calculate whether your system meets regulatory domain's requirements in your country antenna-mode (ant-a | ant-b | rxa-txb | txa-rxb; default: ant-a) - which antenna to use for transmit/receive data: ant-a - use only antenna a ant-b - use only antenna b rxa-txb - use antenna a for receiving packets, use antenna b for tr ansmitting packets txa-rxb - use antenna a for transmitting packets, antenna b for receiving packets area (text; default: "") - string value that is used to describe an Access Point. Connect List on the Clients side comparing this string value with area-prefix string value makes decision whether allow a Client connect to the AP. If area-prefix match the entire area string or only the beginning of it the Client is allowed to connect to the AP arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - Address Resolution Protocol setting band - operating band 2.4ghz-b - IEEE 802.11b 2.4ghz-b/g - IEEE 802.11g (supports also IEEE 802.11b) 2.4ghz-g-turbo - IEEE 802.11g using double channel, providing air rate of up to 108 Mbit 2.4ghz-onlyg - only IEEE 802.11g 5ghz - IEEE 802.11a up to 54 Mbit 5ghz-turbo - IEEE 802.11a using double channel, providing air rate of up to 108Mbit 2ghz-10mhz - variation of IEEE 802.11g with half the band, and, accordingly, twice lower speed (air rate of up to 27Mbit) 2ghz-5mhz - variation of IEEE 802.11g with quarter the band, and, accordingly, four times lower speed (air rate of up to 13.5Mbit) 5ghz-10mhz - variation of IEEE 802.11a with half the band, and, accordingly, twice lower speed (air rate of up to 27Mbit) 5ghz-5mhz - variation of IEEE 802.11a with quarter the band, and, accordingly, four times lower speed (air rate of up to 13.5Mbit) basic-rates-a/g (multiple choice: 6Mbps, 9Mbps, 12Mbps, 18Mbps, 24Mbps, 36Mbps, 48Mbps, 54Mbps; default: 6Mbps) - basic rates in 802.11a or 802.11g standard (this should be the minimal speed all the wireless network nodes support). It is recommended to leave this as default Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 196

basic-rates-b (multiple choice: 1Mbps, 2Mbps, 5.5Mbps, 11Mbps; default: 1Mbps) - basic rates in 802.11b mode (this should be the minimal speed all the wireless network nodes support). It is recommended to leave this as default burst-time (time; default: disabled) - time in microseconds which will be used to send data without stopping. Note that other wireless cards in that network will not be able to transmit data for burst -time microseconds. This setting is available only for AR5000, AR5001X, and AR5001X+ chipset based cards compression (yes | no; default: no) - if enabled on AP (in ap-bridge or bridge mode), it advertizes that it is capable to use hardware data compression. If a client, connected to this AP also supports and is configured to use the hardware data compression, it requests the AP to use compression. This property does not affect clients which do not support compression. country (albania | algeria | argentina | armenia | australia | austria | azerbaijan | bahrain | belarus | belgium | belize | bolvia | brazil | brunei darussalam | bulgaria | canada | chile | china | colombia | costa rica | croatia | cyprus | czech republic | denmark | dominican republic | ecuador | egypt | el salvador | estonia | finland | france | france_res | georgia | germany | greece | guatemala | honduras | hong kong | hungary | iceland | india | indonesia | iran | ireland | israel | italy | japan | japan1 | japan2 | japan3 | japan4 | japan5 | jordan | kazakhstan | korea republic | korea republic2 | kuwait | latvia | lebanon | liechtenstein | lithuania | luxemburg | macau | macedonia | malaysia | mexico | monaco | morocc o | netherlands | new zealand | no_country_set | north korea | norway | oman | pakistan | panama | peru | philippines | poland | portugal | puerto rico | qatar | romania | russia | saudi arabia | singapore | slovak republic | slovenia | south africa | spai n | sweden | switzerland | syria | taiwan | thailand | trinidad & tobago | tunisia | turkey | ukraine | united arab emirates | united kingdom | united states | uruguay | uzbekistan | venezuela | viet nam | yemen | zimbabwe; default: no_country_set) - limits wireless settings (frequency and transmit power) to those which are allowed in the respective country no_country_set - no regulatory domain limitations default-ap-tx-limit (integer; default: 0) - limits data rate for each wireless client (in bps) 0 - no limits default-authentication (yes | no; default: yes) - specifies the default action on the clients side for APs that are not in connect list or on the APs side for clients that are not in access list yes - enables AP to register a client even if it is not in access list. In turn for client it allows to associate with AP not listed in client's connect list default-client-tx-limit (integer; default: 0) - limits each client's transmit data rate (in bps). Works only if the client is also a MikroTik Rout er 0 - no limits default-forwarding (yes | no; default: yes) - to use data forwarding by default or not. If set to 'no', the registered clients will not be able to communicate with each other dfs-mode (none | radar-detect | no-radar-detect; default: none) - used for APs to dynamically select frequency at which this AP will operate none - do not use DFS no-radar-detect - AP scans channel list from "scan -list" and chooses the frequency which is with the lowest amount of other networks detected radar-detect - AP scans channel list from "scan -list" and chooses the frequency which is with the lowest amount of other networks detected, if no radar is detected in this channel for 60 seconds, the AP starts to operate at this channel, if radar is detected, the A P continues searching for the next available channel which is with the lowest amount of other networks detected disable-running-check (yes | no; default: no) - disable running check. If value is set to 'no', the router determines whether the card is up an d running - for AP one or more clients have to be registered to it, for station, it should be connected to an AP. This setting affects the records in the routing table in a way that there will be no route for the card that is not running (the same applies to dynamic routing protocols). If set to 'yes', the interface will always be shown as running disconnect-timeout (time; default: 3s) - only above this value the client device is considered as disconnected frequency (integer) - operating frequency of the card frequency-mode (regulatory-domain | manual-tx-power | superchannel; default: superchannel) - defines which frequency channels to allow regulatory-domain - channels in configured country only are allowed, and transmit power is limited to what is allowed in that channel in configured country minus configured antenna -gain. Also note that in this mode card will never be configured to higher power than allowed by the respective regulatory domain manual-tx-power - channels in configured country only are a llowed, but transmit power is taken from tx -power setting Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 197

superchannel - only possible with superchannel license. In this mode all hardware supported channels are allowed hide-ssid (yes | no; default: no) - whether to hide ssid or not in the beacon frame s: yes - ssid is not included in the beacon frames. AP replies only to probe -requests with the given ssid no - ssid is included in beacon frames. AP replies to probe -requests with the given ssid ant to 'broadcast ssid' (empty ssid) interface-type (read-only: text) - adapter type and model mac-address (MAC address) - Media Access Control (MAC) address of the interface master-interface (name) - physical wireless interface name that will be used by Virtual Access Point (VAP) interface max-station-count (integer: 1..2007; default: 2007) - maximal number of clients allowed to connect to AP. Real life experiments (from our customers) show that 100 clients can work with one AP, using traffic shaping mode (alignment-only | ap-bridge | bridge | nstreme-dual-slave | station | station-wds | wds-slave; default: station) - operating mode: alignment-only - this mode is used for positioning antennas (to get the best direction) ap-bridge - the interface is operating as an Access Point bridge - the interface is operating as a bridge. This mode acts like ap-bridge with the only difference being it allows only one client nstreme-dual-slave - the interface is used for nstreme -dual mode station - the interface is operating as a client station-wds - the interface is working as a station, but can communicate with a WDS peer wds-slave - the interface is working as it would work in ap -bridge mode, but it adapts to its WDS peer's frequency if it is changed mtu (integer: 68..1600; default: 1500) - Maximum Transmission Unit name (name; default: wlanN) - assigned interface name noise-floor-threshold (integer | default: -128..127; default: default) - value in dBm below which we say that it is rather noise than a normal signal on-fail-retry-time (time; default: 100ms) - time, after which we repeat to communicate with a wireless device, if a data transmission has failed periodic-calibration (default | disabled | enabled; default: default) - to ensure performance of chipset over temperature and environmental changes, the softw are performs periodic calibration periodic-calibration-interval (integer; default: 60) - interfal between periodic recalibrations, in seconds preamble-mode (both | long | short; default: both) - sets the synchronization field in a wireless packet long - has a long synchronization field in a wireless packet (128 bits). Is compatible with 802.11 standard short - has a short synchronization field in a wireless packet (56 bits). Is not compatible with 802.11 standard. With short preamble mode it is possible to get slightly higher data rates both - supports both - short and long preamble prism-cardtype (30mW | 100mW | 200mW) - specify the output of the Prism chipset based card proprietary-extensions (pre-2.9.25 | post-2.9.25; default: post-2.9.25) - the method to insert additional information (MikroTik proprietary extensions) into the wireless frames. This option is needed to workaround incompatibility between the old (pre -2.9.25) method and new Intel Centrino PCI -Express cards pre-2.9.25 - include extensions in the form accepted by older RouterOS versions. This will include the new format as well, so this mode is compatiblewith all RouterOS versions. This mode is incompatible with wireless clients built on the new Centrino wireless chipset and may as well be incompatible with some other stations post-2.9.25 - include extensions in the form accepted by MikroTik RouterOS starting from veriosn 2.9.25, and compatible with all known wireless clients radio-name (name) - descriptive name of the card. Only for Mi kroTik devices rate-set (default | configured) - which rate set to use: default - basic and supported-rates settings are not used, instead default values are used. configured - basic and supported-rates settings are used as configured scan-list (multiple choice: integer | default; default: default) - the list of channels to scan default - represents all frequencies, allowed by the regulatory domain (in the respective country). If no country is set, these frequencies are used - for 2.4GHz mode: 2412, 24 17, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462; for 2.4GHz-g-turbo mode: 2437; for 5GHz mode: 5180, 5200, 5220, 5240, 5260, 5280, 5300, 5320, 5745, 5765, 5785, 5805, 5825; for 5GHz -turbo: 5210, 5250, 5290, 5760, 5800 security-profile (text; default: default) - which security profile to use. Define security profiles under /interface wireless security-profiles where you can setup WPA or WEP wireless security, for further details, see the Security Profiles section of this manual Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 198

ssid (text; default: MikroTik) - Service Set Identifier. Used to separate wireless networks supported-rates-a/g (multiple choice: 6Mbps, 9Mbps, 12Mbps, 18Mbps, 24Mbps, 36Mbps, 48Mbps, 54Mbps) - rates to be supported in 802.11a or 802.11g standard supported-rates-b (multiple choice: 1Mbps, 2Mbps, 5.5Mbps, 11Mbps) - rates to be supported in 802.11b standard tx-power (integer: -30..30; default: 17) - manually sets the transmit power of the card (in dBm), if tx-powermode is set to manual, card rates or all-rates-fixed (see tx-power-mode description below) tx-power-mode (all-rates-fixed | card-rates | default | manual-table; default: default) - choose the transmit power mode for the card: all-rates-fixed - use one transmit power value for all rates, as configured in tx-power card-rates - use transmit power, that for different rates is calculated according the cards transmit power algorithm, which as an argument takes tx-power value default - use the default tx-power manual-table - use the transmit powers as defined in /interface wireless manual-tx-power-table update-stats-interval (time) - how often to update statistics in /interface wireless registration-table wds-default-bridge (name; default: none) - the default bridge for WDS interface. If you use dynamic WDS then it is very useful in cases when wds connection is reset - the newly created dynamic WDS interface will be put in this bridge wds-ignore-ssid (yes | no; default: no) - if set to 'yes', the AP will create WDS links with any other AP in this frequency. If set to 'no' the ssid values must match on both APs wds-mode (disabled | dynamic | static) - WDS mode: disabled - WDS interfaces are disabled dynamic - WDS interfaces are created 'on the fly' static - WDS interfaces are created manually

Notes
The IEEE 802.11 standard limitation makes it impossible for wireless cards in station mode to work as expected when bridged. That means that if you need to create a bridge, you should not use station mode on that machine. In case you need a bridge on a wireless station , use station-wds mode (may only be used in the AP supports WDS). Bridging on the AP side works fine. It is strongly suggested to leave basic rates at the lowest setting possible. Using compression, the AP can serve approximately 50 clients with compress ion enabled! Compression is supported only by Atheros wireless cards. If disable-running-check value is set to no, the router determines whether the network interface is up and running - in order to show flag R for AP, one or more clients have to be regi stered to it, for station, it should be connected to an AP. If the interface does not appear as running ( R), its route in the routing table is shown as invalid! If set to yes, the interface will always be shown as running. On Atheros-based cards, encryption (WEP, WPA, etc.) does not work when compression is enabled. The tx-power default setting is the maximum tx -power that the card can use. If you want to use larger tx -rates, you are able to set them, but do it at your own risk! Usually, you can use this parameter to reduce the txpower. In general tx-power controlling properties should be left at the default settings. Changing the default setting may help with some cards in some situations, but without testing, the most common result is degradation of ra nge and throughput. Some of the problems that may occur are: (1) overheating of the power amplifier chip and the card which will cause lower efficiency and more data errors; (2) overdriving the amplifier which will cause more data errors; (3) excessive pow er usage for the card and this may overload the 3.3V power supply of the board that the card is located on resulting in voltage drop and reboot or excessive temperatures for the board. For different versions of Atheros chipset there are different value ra nge of ack-timeout property: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 199

5ghz Chipset version 5000 (5.2GHz only) 5211 (802.11a/b) 5212 (802.11a/b/g) default 30 30 25 ma x

5ghz-turbo default max 102 204 204

2ghz-b default N/A 109 30 ma x N/ A

2ghz-g default N/A ma x N/ A N/ A 409

204 22 409 22 409 22

409 N/A 409 52

If the wireless interfaces are put in nstreme-dual-slave mode, all configuration will take place in /interface wireless nstreme-dual submenu, described further on in this manual. In that case, configuration made in this submenu will be partially ignored. WDS cannot be used together with the Nstreme -dual.

Example
This example shows how configure a wireless client. To see current interface settings: [admin@MikroTik] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac-address=00:0B:6B:34:54:FB arp=enabled disable-running-check=no interface -type=Atheros AR5213 radio-name="000B6B3454FB" mode=station ssid="MikroTik" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=2412 band=2.4ghz -b scan-list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=00:00:03 on-fail-retry-time=00:00:00.100 preamble -mode=both [admin@MikroTik] interface wireless> Set the ssid to mmt, band to 2.4-b/g and enable the interface. Use the monitor command to see the connection status. [admin@MikroTik] interface wireless> se t 0 ssid=mmt disabled=no \ band=2.4ghz-b/g [admin@MikroTik] interface wireless> monitor wlan1 status: connected -to-ess band: 2.4ghz -g frequency: 2432MHz tx-rate: 36Mbps rx-rate: 36Mbps ssid: "mmt" bssid: 00:0B:6B:34:5A:91 radio-name: "000B6B345A91" signal-strength: -77dBm tx-signal-strength: -76dBm tx-ccq: 21% rx-ccq: 21% current-ack-timeout: 56 current-distance: 56 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 200

wds-link: nstreme: framing-mode: routeros-version: last -ip: current-tx-powers:

no no none "2.9beta16" 25.25.25.2 1Mbps:28,2Mbps:28,5.5Mbps:28,11Mbps:28,6Mbps:27, 9Mbps:27,12Mbps:27,18Mbps:27,24Mbps:27,36Mbps:26, 48Mbps:25,54Mbps:24

[admin@MikroTik] interface wireless> The 'ess' stands for Extended Service Set (IEEE 802.11 wireless networking).

Nstreme Settings
Submenu level: /interface wireless nstreme

Description
You can switch a wireless card to the nstreme mode. In that case the card will work only with nstreme clients.

Property Description
enable-nstreme (yes | no; default: no) - whether to switch the card into the nstreme mode enable-polling (yes | no; default: yes) - whether to use polling for clients framer-limit (integer; default: 3200) - maximal frame size framer-policy (none | best-fit | exact-size | dynamic-size; default: none) - the method how to combine frames (like fast-frames setting in interface configuration). A number of frames may be combined into a bigger one to reduce the amount of protocol overhead (and thus increase speed). The card is not waiting for frames, but in case a number of packets are queued for tra nsmitting, they can be combined. There are several methods of framing: none - do nothing special, do not combine packets best-fit - put as much packets as possible in one frame, until the framer-limit limit is met, but do not fragment packets exact-size - put as much packets as possible in one frame, until the framer-limit limit is met, even if fragmentation will be needed (best performance) dynamic-size - choose the best frame size dynamically name (name) - reference name of the interface

Notes
Such settings as enable-polling, framer-policy and framer-limit are relevant only on Access Point, they are ignored for client devices! The client automatically adapts to AP settings. WDS for Nstreme protocol requires using station -wds mode on one of the peers. Configurations with WDS between AP modes (bridge and ap-bridge) will not work.

Example
To enable the nstreme protocol on the wlan1 radio with exact-size framing: [admin@MikroTik] interface wireless nstreme> print 0 name="wlan1" enable -nstreme=no enable-polling=yes framer -policy=none framer-limit=3200 [admin@MikroTik] interface wireless nstreme> set wlan1 enable -nstreme=yes \ \... framer-policy=exact-size

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

201

Nstreme2 Group Settings


Submenu level: /interface wireless nstreme-dual

Description
Two radios in nstreme-dual-slave mode can be grouped together to make nstreme2 Point -to-Point connection. To put wireless interfaces into a nstreme2 group, you should set their mode to nstreme-dual-slave. Many parameters from /interface wireless menu are ignored, using the nstreme2, except: frequency-mode country antenna-gain tx-power tx-power-mode antenna-mode

Property Description
arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - Address Resolution Protocol setting disable-running-check (yes | no) - whether the interface should always be treated as running even if there is no connection to a remote peer framer-limit (integer; default: 2560) - maximal frame size framer-policy (none | best-fit | exact-size; default: none) - the method how to combine frames (like fast-frames setting in interface configuration). A number of frames may be combined into one bigger one to reduce the amout of protocol overhead (and thus increase speed). The card are not waiting for frames, but in case a n umber packets are queued for transmitting, they can be combined. There are several methods of framing: none - do nothing special, do not combine packets best-fit - put as much packets as possible in one frame, until the framer-limit limit is met, but do not fragment packets exact-size - put as much packets as possible in one frame, until the framer-limit limit is met, even if fragmentation will be needed (best performance) mac-address (read-only: MAC address) - MAC address of the transmitting wireless c ard in the set mtu (integer: 0..1600; default: 1500) - Maximum Transmission Unit name (name) - reference name of the interface rates-a/g (multiple choice: 6Mbps, 9Mbps, 12Mbps, 18Mbps, 24Mbps, 36Mbps, 48Mbps, 54Mbps) - rates to be supported in 802.11a or 802.11g standard rates-b (multiple choice: 1Mbps, 2Mbps, 5.5Mbps, 11Mbps) - rates to be supported in 802.11b standard remote-mac (MAC address; default: 00:00:00:00:00:00) - which MAC address to connect to (this would be the remote receiver card's MAC a ddress) rx-band - operating band of the receiving radio 2.4ghz-b - IEEE 802.11b 2.4ghz-g - IEEE 802.11g 2.4ghz-g-turbo - IEEE 802.11g in Atheros proprietary turbo mode (up to 108Mbit) 5ghz - IEEE 802.11a up to 54 Mbit 5ghz-turbo - IEEE 802.11a in Atheros proprietary turbo mode (up to 108Mbit) rx-frequency (integer; default: 5320) - Frequency to use for receiving frames rx-radio (name) - which radio should be used for receiving frames tx-band - operating band of the transmitting radio 2.4ghz-b - IEEE 802.11b 2.4ghz-g - IEEE 802.11g 2.4ghz-g-turbo - IEEE 802.11g in Atheros proprietary turbo mode (up to 108Mbit) 5ghz - IEEE 802.11a up to 54 Mbit 5ghz-turbo - IEEE 802.11a in Atheros proprietary turbo mode (up to 108Mbit) tx-frequency (integer; default: 5180) - Frequency to use for transmitting frames tx-radio (name) - which radio should be used for transmitting frames

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

202

Notes
WDS cannot be used on Nstreme -dual links. The difference between tx-freq and rx-freq should be about 200MHz (more is reco mmended) because of the interference that may occur! You can use different bands for rx and tx links. For example, transmit in 2.4ghz-g-turbo and receive data, using 2.4ghz-b band.

Example
To enable the nstreme2 protocol on a router: 18. Having two Atheros AR5212 based cards which are not used for anything else, to group them into a nstreme interface, switch both of them into nstreme-dual-slave mode: [admin@MikroTik] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0B:6B:31:02:4F arp=enabled disable-running-check=no interface -type=Atheros AR5212 radio-name="000B6B31024F" mode=station ssid="MikroTik" frequency=5180 band=5GHz scan -list=default-ism supported-rates-b=1Mbps,2Mbps,5.5Mbps,1 1Mbps supported-ratesa/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-stationcount=2007 ack-timeout=dynamic tx -power=default noise -floorthreshold=default burst-time=disabled fast -frames=no dfs-mode=none antennamode=ant-a wds-mode=disabled wds-default-bridge=none update-stats-interval=disabled default -authentication=yes default-forwarding=yes hide -ssid=no 802.1x-mode=none name="wlan2" mtu=1500 mac -address=00:0B:6B:30:B4:A4 arp=enabled disable-running-check=no interface -type=Atheros AR5212 radio-name="000B6B30B4A4" mode=station ssid="MikroTik" frequency=5180 band=5GHz scan -list=default-ism supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-ratesa/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-stationcount=2007 ack-timeout=dynamic tx -power=default nois e-floorthreshold=default burst-time=disabled fast -frames=no dfs-mode=none antennamode=ant-a wds-mode=disabled wds-default-bridge=none update-stats-interval=disabled default -authentication=yes default-forwarding=yes hide -ssid=no 802.1x-mode=none [admin@MikroTik] interface wireless> set 0,1 mode=nstreme -dual-slave 19. Then add nstreme2 interface with exact -size framing: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 1

203

[admin@MikroTik] interface wireless nstreme -dual> add \ \... framer-policy=exact-size 20. Configure which card will be receiving and which - transmitting and specify remote receiver card's MAC address: [admin@MikroTik] interface wireless nstreme -dual> print Flags: X - disabled, R - running 0 X name="n-streme1" mtu=1500 mac -address=00:00:00:00:00:00 arp=enabled disable-running-check=no tx-radio=(unknown) rx -radio=(unknown) remote-mac=00:00:00:00:00:00 tx -band=5GHz tx-frequency=5180 rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps rx-band=5GHz rx-frequency=5320 framer -policy=exact-size framer-limit=4000 [admin@MikroTik] interface wireless nstreme -dual> set 0 disabled=no \ \... tx-radio=wlan1 rx-radio=wlan2 remote -mac=00:0C:42:05:0B:12 [admin@MikroTik] interface wireless nstreme-dual> print Flags: X - disabled, R - running 0 X name="n-streme1" mtu=1500 mac -address=00:0B:6B:30:B4:A4 arp=enabled disable-running-check=no tx-radio=wlan1 rx-radio=wlan2 remote-mac=00:0C:42:05:0B:12 tx -band=5GHz tx-frequency=5180 rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps rx-band=5GHz rx-frequency=5320 framer -policy=exact-size framer-limit=4000

Registration Table
Submenu level: /interface wireless registration-table

Description
In the registration table you can see various information about currently connected clients. It is used only for Access Points.

Property Description
ap (read-only: no | yes) - whether the connected device is an Access Point or not bytes (read-only: integer, integer) - number of sent and received packet bytes frame-bytes (read-only: integer, integer) - number of sent and received data bytes excluding header information frames (read-only: integer, integer) - number of sent and received 802.11 data frames excluding retransmitted data frames framing-current-size (read-only: integer) - current size of combined frames framing-limit (read-only: integer) - maximal size of combined frames framing-mode (read-only: none | best-fit | exact-size; default: none) - the method how to combine frames hw-frame-bytes (read-only: integer, integer) - number of sent and received data bytes including header information hw-frames (read-only: integer, integer) - number of sent and receive d 802.11 data frames including retransmitted data frames interface (read-only: name) - interface that client is registered to last-activity (read-only: time) - last interface data tx/rx activity last-ip (read-only: IP address) - IP address found in the last IP packet received from the registered client mac-address (read-only: MAC address) - MAC address of the registered client Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 204

packets (read-only: integer, integer) - number of sent and received network layer packets packing-size (read-only: integer) - maximum packet size in bytes parent (read-only: MAC address) - parent access point's MAC address, if forwarded from another access point routeros-version (read-only: name) - RouterOS version of the registered client rx-ccq (read-only: integer: 0..100) - Client Connection Quality - a value in percent that shows how effective the receive bandwidth is used regarding the theoretically maximum available bandwidth. Mostly it depends from an amount of retransmited wireless frames. rx-packed (read-only: integer) - number of received packets in form of received -packets/number of packets, which were packed into a larger ones, using fast -frames rx-rate (read-only: integer) - receive data rate signal-strength (read-only: integer) - average strength of the client s ignal recevied by the AP tx-ccq (read-only: integer: 0..100) - Client Connection Quality - a value in percent that shows how effective the transmit bandwidth is used regarding the theoretically maximum available bandwidth. Mostly it depends from an amount of retransmited wireless frames. tx-packed (read-only: integer) - number of sent packets in form of sent -packets/number of packets, which were packed into a larger ones, using fast -frames tx-rate (read-only: integer) - transmit data rate tx-signal-strength (read-only: integer) - average power of the AP transmit signal as received by the client device type (read-only: name) - type of the client uptime (read-only: time) - time the client is associated with the access point wds (read-only: no | yes) - whether the connected client is using wds or not

Example
To see registration table showing all clients currently associated with the access point: [admin@MikroTik] interface wireless registration -table> print # INTERFACE RADIO -NAME MAC-ADDRESS AP SIGNAL... TX -RATE 0 wireless1 000124705304 00:01:24:70:53:04 no -38dBm... 9Mbps [admin@MikroTik] interface wireless registration -table> To get additional statistics: [admin@MikroTik] interface wireless> registration -table print stats 0 interface=dfaewad radio-name="000C42050436" mac -address=00:0C:42:05:04:36 ap=yes wds=no rx -rate=54Mbps tx-rate=54Mbps packets=597,668 bytes=48693,44191 frames=597,673 frame -bytes=48693,44266 hw frames=597,683 hw-frame-bytes=63021,60698 uptime=45m28s last -activity=0s signal-strength=-66dBm@54Mbps strength-at-rates=-59dBm@1Mbps 13s120ms, -61dBm@6Mbps 7s770ms, -61dBm@9Mbps 40m43s970ms, -60dBm@12Mbps 40m43s760ms, -61dBm@18Mbps 40m43s330ms, -60dBm@24Mbps 40m43s, -61dBm@36Mbps 33m10s230ms, -62dBm@48Mbps 33m9s760ms, -66dBm@54Mbps 10ms tx-signal-strength=-65dBm tx-ccq=24% rx-ccq=20% ack-timeout=28 distance=28 nstreme=no framing -mode=none routeros -version="2.9rc5" last-ip=192.168.63.8 [admin@MikroTik] int erface wireless>

Connect List
Submenu level: /interface wireless connect-list

Description
The Connect List is a list of rules (order is important), that determine to which AP the station should connect to.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

205

At first, the station is searching for APs all f requencies (from scan-list) in the respective band and makes a list of Access Points. If the ssid is set under /interface wireless, the router removes all Access Points from its AP list which do not have such ssid If a rule is matched and the parameter connect is set to yes, the station will connect to this AP. If the parameter says connect=no or the rule is not matched, we jump to the next rule. If we have gone through all rules and haven't connected to any AP, yet. The router chooses an AP with the best signal and ssid that is set under /interface wireless. In case when the station has not connected to any AP, this process repeats from beginning.

Property Description
area-prefix (text) - a string that indicates the beginning from the area string of the AP. If the AP's area begins with area-prefix, then this parameter returns true connect (yes | no) - whether to connect to AP that matches this rule interface (name) - name of the wireless interface mac-address (MAC address) - MAC address of the AP. If se t to 00:00:00:00:00:00, all APs are accepted min-signal-strength (integer) - signal strength in dBm. Rule is matched, if the signal from AP is stronger than this security-profile (name; default: none) - name of the security profile, used to connect to th e AP. If none, then those security profile is used which is configured for the respective interface ssid (text) - the ssid of the AP. If none set, all ssid's are accepted. Different ssids will be meaningful, if the ssid for the respective interface is set to ""

Access List
Submenu level: /interface wireless access-list

Description
The access list is used by the Access Point to restrict associations of clients. This list contains MAC addresses of clients and determines what action to take when client at tempts to connect. Also, the forwarding of frames sent by the client is controlled. The association procedure is as follows: when a new client wants to associate to the AP that is configured on interface wlanN, an entry with client's MAC address and interf ace wlanN is looked up in the access-list. If such entry is found, action specified in the access list is performed, else default-authentication and defaultforwarding arguments of interface wlanN are taken.

Property Description
ap-tx-limit (integer; default: 0) - limits data rate for this wireless client (in bps) 0 - no limits authentication (yes | no; default: yes) - whether to accept or to reject this client when it tries to connect client-tx-limit (integer; default: 0) - limits this client's transmit data rate (in bps). Works only if the client is also a MikroTik Router 0 - no limits forwarding (yes | no; default: yes) - whether to forward the client's frames to other wireless clients interface (name) - name of the respective interface mac-address (MAC address) - MAC address of the client private-algo (104bit-wep | 40bit-wep | none) - which encryption algorithm to use private-key (text; default: "") - private key of the client. Used for private-algo skip-802.1x (yes | no) - not implemented, yet

Notes

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

206

If you have default authentication action for the interface set to yes, you can disallow this node to register at the AP's interface wlanN by setting authentication=no for it. Thus, all nodes except this one will be able to register to the interface wlanN. If you have default authentication action for the interface set to no, you can allow this node to register at the AP's interface wlanN by setting authentication=yes for it. Thus, only the specified nodes will be able to register to the interface wlanN.

Example
To allow authentication and forwarding for the client 00:01:24:70:3A:BB from the wlan1 interface using WEP 40bit algorithm with the key 1234567890: [admin@MikroTik] interface wireless access -list> add mac-address= \ \... 00:01:24:70:3A:BB interface=wlan1 private -algo=40bit-wep privatekey=1234567890 [admin@MikroTik] interface wireless access -list> print Flags: X - disabled 0 mac-address=00:01:24:70:3A:BB interface=wlan1 authentication=yes forwarding=yes ap -tx-limit=0 client-tx-limit=0 private-algo=40bit-wep private-key="1234567890" [admin@MikroTik] interface wireless access -list>

Info
Submenu level: /interface wireless info

Description
This facility provides you with general wireless interface information.

Property Description
2ghz-b-channels (multiple choice, read-only: 2312, 2317, 2322, 2327, 2332, 2337, 2342, 2347, 2352, 2357, 2362, 2367, 2372, 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, 2512, 2532, 2552, 2572, 2592, 2612, 2632, 2652 , 2672, 2692, 2712, 2732) - the list of 2GHz IEEE 802.11b channels (frequencies are given in MHz) 2ghz-g-channels (multiple choice, read-only: 2312, 2317, 2322, 2327, 2332, 2337, 2342, 2347, 2352, 2357, 2362, 2367, 2372, 2412, 2417, 2422, 2427, 2432, 2437 , 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2512, 2532, 2552, 2572, 2592, 2612, 2632, 2652, 2672, 2692, 2712, 2732, 2484) - the list of 2GHz IEEE 802.11g channels (frequencies are given in MHz) 5ghz-channels (multiple choice, read-only: 4920, 4925, 4930, 4935, 4940, 4945, 4950, 4955, 4960, 4965, 4970, 4975, 4980, 4985, 4990, 4995, 5000, 5005, 5010, 5015, 5020, 5025, 5030, 5035, 5040, 5045, 5050, 5055, 5060, 5065, 5070, 5075, 5080, 5085, 5090, 5095, 5100, 5105, 5110, 5115, 5120, 5125, 5130, 5135, 5140, 5145 , 5150, 5155, 5160, 5165, 5170, 5175, 5180, 5185, 5190, 5195, 5200, 5205, 5210, 5215, 5220, 5225, 5230, 5235, 5240, 5245, 5250, 5255, 5260, 5265, 5270, 5275, 5280, 5285, 5290, 5295, 5300, 5305, 5310, 5315, 5320, 5325, 5330, 5335, 5340, 5345, 5350, 5355, 53 60, 5365, 5370, 5375, 5380, 5385, 5390, 5395, 5400, 5405, 5410, 5415, 5420, 5425, 5430, 5435, 5440, 5445, 5450, 5455, 5460, 5465, 5470, 5475, 5480, 5485, 5490, 5495, 5500, 5505, 5510, 5515, 5520, 5525, 5530, 5535, 5540, 5545, 5550, 5555, 5560, 5565, 5570, 5575, 5580, 5585, 5590, 5595, 5600, 5605, 5610, 5615, 5620, 5625, 5630, 5635, 5640, 5645, 5650, 5655, 5660, 5665, 5670, 5675, 5680, 5685, 5690, 5695, 5700, 5705, 5710, 5715, 5720, 5725, 5730, 5735, 5740, 5745, 5750, 5755, 5760, 5765, 5770, 5775, 5780, 5785, 5790, 5795, 5800, 5805, 5810, 5815, 5820, 5825, 5830, 5835, 5840, 5845, 5850, 5855, 5860, 5865, 5870, 5875, 5880, 5885, 5890, 5895, 5900, 5905, 5910, 5915, 5920, 5925, 5930, 5935, 5940, 5945, 5950, 5955, 5960, 5965, 5970, 5975, 5980, 5985, 5990, 5995, 60 00, 6005, 6010, 6015, 6020, 6025, 6030, 6035, 6040, 6045, 6050, 6055, 6060, 6065, 6070, 6075, 6080, 6085, 6090, 6095, 6100) - the list of 5GHz channels (frequencies are given in MHz) 5ghz-turbo-channels (multiple choice, read-only: 4920, 4925, 4930, 4935, 4940, 4945, 4950, 4955, 4960, 4965, 4970, 4975, 4980, 4985, 4990, 4995, 5000, 5005, 5010, 5015, 5020, 5025, 5030, 5035, 5040, 5045, 5050, 5055, 5060, 5065, 5070, 5075, 5080, 5085, 5090, 5095, 5100, 5105, 5110, 5115, 5120, 5125, 5130, 5135, 5140, Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 207

5145, 5150, 5155, 5160, 5165, 5170, 5175, 5180, 5185, 5190, 5195, 5200, 5205, 5210, 5215, 5220, 5225, 5230, 5235, 5240, 5245, 5250, 5255, 5260, 5265, 5270, 5275, 5280, 5285, 5290, 5295, 5300, 5305, 5310, 5315, 5320, 5325, 5330, 5335, 5340, 5345, 5350, 5355, 5360, 5 365, 5370, 5375, 5380, 5385, 5390, 5395, 5400, 5405, 5410, 5415, 5420, 5425, 5430, 5435, 5440, 5445, 5450, 5455, 5460, 5465, 5470, 5475, 5480, 5485, 5490, 5495, 5500, 5505, 5510, 5515, 5520, 5525, 5530, 5535, 5540, 5545, 5550, 5555, 5560, 5565, 5570, 5575, 5580, 5585, 5590, 5595, 5600, 5605, 5610, 5615, 5620, 5625, 5630, 5635, 5640, 5645, 5650, 5655, 5660, 5665, 5670, 5675, 5680, 5685, 5690, 5695, 5700, 5705, 5710, 5715, 5720, 5725, 5730, 5735, 5740, 5745, 5750, 5755, 5760, 5765, 5770, 5775, 5780, 5785, 5790, 5795, 5800, 5805, 5810, 5815, 5820, 5825, 5830, 5835, 5840, 5845, 5850, 5855, 5860, 5865, 5870, 5875, 5880, 5885, 5890, 5895, 5900, 5905, 5910, 5915, 5920, 5925, 5930, 5935, 5940, 5945, 5950, 5955, 5960, 5965, 5970, 5975, 5980, 5985, 5990, 5995, 6000, 6 005, 6010, 6015, 6020, 6025, 6030, 6035, 6040, 6045, 6050, 6055, 6060, 6065, 6070, 6075, 6080, 6085, 6090, 6095, 6100) - the list of 5GHz-turbo channels (frequencies are given in MHz) ack-timeout-control (read-only: yes | no) - provides information whethe r this device supports transmission acceptance timeout control alignment-mode (read-only: yes | no) - is the alignment-only mode supported by this interface burst-support (yes | no) - whether the interface supports data bursts (burst -time) chip-info (read-only: text) - information from EEPROM default-periodic-calibration (read-only: yes | no) - whether the card supports periodic -calibration firmware (read-only: text) - current firmware of the interface (used only for Prism chipset based cards) interface-type (read-only: text) - shows the hardware interface type noise-floor-control (read-only: yes | no) - does this interface support noise -floor-thershold detection nstreme-support (read-only: yes | no) - whether the card supports n-streme protocol scan-support (yes | no) - whether the interface supports scan function ('/interface wireless scan') supported-bands (multiple choice, read-only: 2ghz-b, 5ghz, 5ghz-turbo, 2ghz-g) - the list of supported bands tx-power-control (read-only: yes | no) - provides information whether this device supports transmission power control virtual-aps (read-only: yes | no) - whether this interface supports Virtual Access Points ('/interface wireless add')

Notes
There is a special argument for the print command - print count-only. It forces the print command to print only the count of information topics. /interface wireless info print command shows only channels supported by a particular card.

Example
[admin@MikroTik] interface wireless info> print 0 interface-type=Atheros AR5413 chip-info="mac:0xa/0x5, phy:0x61, a5:0x63, a2:0x0, eeprom:0x5002" tx-power-control=yes ack-timeout-control=yes alignment -mode=yes virtual-aps=yes noise-floor-control=yes scan-support=yes burstsupport=yes nstreme-support=yes defaul t-periodic-calibration=enabled supported-bands=2ghz-b,5ghz,5ghz-turbo,2ghz-g,2ghz-g-turbo 2ghz-b-channels=2312:0,2317:0,2322:0,2327:0,2332:0,2337:0,2342:0,2347:0, 2352:0,2357:0,2362:0,2367:0,2372:0,2377:0,2382:0,2387:0, 2392:0,2397:0,2402:0,2407:0,2412:0,2417:0,2422:0,2427:0, 2432:0,2437:0,2442:0,2447:0,2452:0,2457:0,2462:0,2467:0, 2472:0,2477:0,2482:0,2487:0,2492:0,2497:0,2314:0,2319:0, 2324:0,2329:0,2334:0 ,2339:0,2344:0,2349:0,2354:0,2359:0, 2364:0,2369:0,2374:0,2379:0,2384:0,2389:0,2394:0,2399:0, 2404:0,2409:0,2414:0,2419:0,2424:0,2429:0,2434:0,2439:0, 2444:0,2449:0,2454:0,2459:0,2464:0,2469:0,2474:0 ,2479:0, 2484:0,2489:0,2494:0,2499:0 5ghz-channels=4920:0,4925:0,4930:0,4935:0,4940:0,4945:0,4950:0,4955:0, Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 208

4960:0,4965:0,4970:0,4975:0,4980:0,4985:0,4990:0,4995:0, 5000:0,5005:0,5010:0,5015:0,5020:0, 5025:0,5030:0,5035:0, 5040:0,5045:0,5050:0,5055:0,5060:0,5065:0,5070:0,5075:0, 5080:0,5085:0,5090:0,5095:0,5100:0,5105:0,5110:0,5115:0, 5120:0,5125:0,5130:0,5135:0,5140:0,5145:0,5150:0,5155:0, 5160:0,5165:0,5170:0,5175:0,5180:0,5185:0,5190:0,5195:0, 5200:0,5205:0,5210:0,5215:0,5220:0,5225:0,5230:0,5235:0, 5240:0,5245:0,5250:0,5255:0,5260:0,5265:0,5270:0,5275:0, 5280:0,5285:0,5290:0,5295:0,5 300:0,5305:0,5310:0,5315:0, 5320:0,5325:0,5330:0,5335:0,5340:0,5345:0,5350:0,5355:0, 5360:0,5365:0,5370:0,5375:0,5380:0,5385:0,5390:0,5395:0, 5400:0,5405:0,5410:0,5415:0,5420:0,5425:0,5430:0,5435:0, 5440:0,5445:0,5450:0,5455:0,5460:0,5465:0,5470:0,5475:0, 5480:0,5485:0,5490:0,5495:0,5500:0,5505:0,5510:0,5515:0, 5520:0,5525:0,5530:0,5535:0,5540:0,5545:0,5550:0,5555:0, 5560:0,5565:0,5570:0,55 75:0,5580:0,5585:0,5590:0,5595:0, 5600:0,5605:0,5610:0,5615:0,5620:0,5625:0,5630:0,5635:0, 5640:0,5645:0,5650:0,5655:0,5660:0,5665:0,5670:0,5675:0, 5680:0,5685:0,5690:0,5695:0,5700:0,5705:0,5710:0,5715:0, 5720:0,5725:0,5730:0,5735:0,5740:0,5745:0,5750:0,5755:0, 5760:0,5765:0,5770:0,5775:0,5780:0,5785:0,5790:0,5795:0, 5800:0,5805:0,5810:0,5815:0,5820:0,5825:0,5830:0,5835:0, 5840:0,5845:0,585 0:0,5855:0,5860:0,5865:0,5870:0,5875:0, 5880:0,5885:0,5890:0,5895:0,5900:0,5905:0,5910:0,5915:0, 5920:0,5925:0,5930:0,5935:0,5940:0,5945:0,5950:0,5955:0, 5960:0,5965:0,5970:0,5975:0,5980:0,5985:0,5990:0,59 95:0, 6000:0,6005:0,6010:0,6015:0,6020:0,6025:0,6030:0,6035:0, 6040:0,6045:0,6050:0,6055:0,6060:0,6065:0,6070:0,6075:0, 6080:0,6085:0,6090:0,6095:0,6100:0 5ghz-turbochannels=4920:0,4925:0,4930:0,4935:0 ,4940:0,4945:0,4950:0,4955:0, 4960:0,4965:0,4970:0,4975:0,4980:0,4985:0,4990:0,4995:0, 5000:0,5005:0,5010:0,5015:0,5020:0,5025:0,5030:0,5035:0, 5040:0,5045:0,5050:0,5055:0,5060:0,5065:0,5 070:0,5075:0, 5080:0,5085:0,5090:0,5095:0,5100:0,5105:0,5110:0,5115:0, 5120:0,5125:0,5130:0,5135:0,5140:0,5145:0,5150:0,5155:0, 5160:0,5165:0,5170:0,5175:0,5180:0,5185:0,5190:0,5195:0, 5200:0,5205:0,5210:0,5215:0,5220:0,5225:0,5230:0,5235:0, 5240:0,5245:0,5250:0,5255:0,5260:0,5265:0,5270:0,5275:0, 5280:0,5285:0,5290:0,5295:0,5300:0,5305:0,5310:0,5315:0, 5320:0,5325:0,5330:0,5335:0,5340:0,5345:0,5350:0,5355:0, 5360:0,5365:0,5370:0,5375:0,5380:0,5385:0,5390:0,5395:0, 5400:0,5405:0,5410:0,5415:0,5420:0,5425:0,5430:0,5435:0, 5440:0,5445:0,5450:0,5455:0,5460:0,5465:0,5470:0,5475:0, 5480:0,5485:0,5490:0,5495:0,5500:0,5505:0,5510:0,5515:0, Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 209

5520:0,5525:0,5530:0,5535:0,5540:0,5545:0,5550:0,5555:0, 5560:0,5565:0,5570:0,5575:0 ,5580:0,5585:0,5590:0,5595:0, 5600:0,5605:0,5610:0,5615:0,5620:0,5625:0,5630:0,5635:0, 5640:0,5645:0,5650:0,5655:0,5660:0,5665:0,5670:0,5675:0, 5680:0,5685:0,5690:0,5695:0,5700:0,5705:0,5 710:0,5715:0, 5720:0,5725:0,5730:0,5735:0,5740:0,5745:0,5750:0,5755:0, 5760:0,5765:0,5770:0,5775:0,5780:0,5785:0,5790:0,5795:0, 5800:0,5805:0,5810:0,5815:0,5820:0,5825:0,5830:0,5835:0, 5840:0,5845:0,5850:0,5855:0,5860:0,5865:0,5870:0,5875:0, 5880:0,5885:0,5890:0,5895:0,5900:0,5905:0,5910:0,5915:0, 5920:0,5925:0,5930:0,5935:0,5940:0,5945:0,5950:0,5955:0, 5960:0,5965:0,5970:0,5975:0,5980:0,5985:0,5990:0,5995:0, 6000:0,6005:0,6010:0,6015:0,6020:0,6025:0,6030:0,6035:0, 6040:0,6045:0,6050:0,6055:0,6060:0,6065:0,6070:0,6075:0, 6080:0,6085 :0,6090:0,6095:0,6100:0 2ghz-g-channels=2312:0,2317:0,2322:0,2327:0,2332:0,2337:0,2342:0,2347:0, 2352:0,2357:0,2362:0,2367:0,2372:0,2377:0,2382:0,2387:0, 2392:0,2397:0,2402:0,2407:0,2412:0,2417:0,2422:0,2427:0, 2432:0,2437:0,2442:0,2447:0,2452:0,2457:0,2462:0,2467:0, 2472:0,2477:0,2482:0,2487:0,2492:0,2497:0,2314:0,2319:0, 2324:0,2329:0,2334:0,2339:0,2344:0,2349:0,2354:0,2359:0, 2364:0,2369:0 ,2374:0,2379:0,2384:0,2389:0,2394:0,2399:0, 2404:0,2409:0,2414:0,2419:0,2424:0,2429:0,2434:0,2439:0, 2444:0,2449:0,2454:0,2459:0,2464:0,2469:0,2474:0,2479:0, 2484:0,2489:0,2494:0,2499:0 2ghz-g-turbo-channels=2312:0,2317:0,2322:0,2327:0,2332:0,2337:0,2342:0, 2347:0,2352:0,2357:0,2362:0,2367:0,2372:0,2377:0, 2382:0,2387:0,2392:0,2397:0,2402:0,2407:0,2412:0, 2417:0,2422:0,2427: 0,2432:0,2437:0,2442:0,2447:0, 2452:0,2457:0,2462:0,2467:0,2472:0,2477:0,2482:0, 2487:0,2492:0,2497:0,2314:0,2319:0,2324:0,2329:0, 2334:0,2339:0,2344:0,2349:0,2354:0,2359:0,2364:0, 2369:0,2374:0,2379:0,2384:0,2389:0,2394:0,2399:0, 2404:0,2409:0,2414:0,2419:0,2424:0,2429:0,2434:0, 2439:0,2444:0,2449:0,2454:0,2459:0,2464:0,2469:0, 2474:0 ,2479:0,2484:0,2489:0,2494:0,2499:0 [admin@MikroTik] interface wireless>

Virtual Access Point Interface


Submenu level: /interface wireless

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

210

Description
Virtual Access Point (VAP) interface is used to have an additional AP. You can create a new AP with dif ferent ssid and mac-address. It can be compared with a VLAN where the ssid from VAP is the VLAN tag and the hardware interface is the VLAN switch. You can add up to 128 VAP interfaces for each hardware interface. RouterOS supports VAP feature for Atheros A R5212 and newer.

Property Description
arp (disabled | enabled | proxy-arp | reply-only) - ARP mode default-authentication (yes | no; default: yes) - whether to accept or reject a client that wants to associate, but is not in the access-list default-forwarding (yes | no; default: yes) - whether to forward frames to other AP clients or not disabled (yes | no; default: yes) - whether to disable the interface or not disable-running-check (yes | no; default: no) - disable running check. For 'broken' cards i t is a good idea to set this value to 'yes' hide-ssid (yes | no; default: no) - whether to hide ssid or not in the beacon frames: yes - ssid is not included in the beacon frames. AP replies only to probe -requests with the given ssid no - ssid is included in beacon frames. AP replies to probe -requests with the given ssid and to 'broadcast ssid' mac-address (MAC address; default: 02:00:00:AA:00:00) - MAC address of VAP. You can define your own value for mac-address master-interface (name) - hardware interface to use for VAP max-station-count (integer; default: 2007) - number of clients that can connect to this AP simultaneously mtu (integer: 68..1600; default: 1500) - Maximum Transmission Unit name (name; default: wlanN) - interface name ssid (text; default: MikroTik) - the service set identifier

Notes
The VAP MAC address is set by default to the same address as the physical interface has, with the second bit of the first byte set (i.e., the MAC address would start with 02). If that address is alrea dy used by some other wireless or VAP interface, it is increased by 1 until a free spot is found. When manually assigning MAC address, keep in mind that it should have the first bit of the first byte unset (so it should not be like 01, or A3). Note also that it is recommended to keep the MAC adress of VAP as similar (in terms of bit values) to the MAC address of the physical interface it is put onto, as possible, because the more different the addresses are, the more it affects performance.

WDS Interface Configuration


Submenu level: /interface wireless wds

Description
WDS (Wireless Distribution System) allows packets to pass from one wireless AP (Access Point) to another, just as if the APs were ports on a wired Ethernet switch. APs must use the same stand ard (802.11a, 802.11b or 802.11g) and work on the same frequencies in order to connect to each other. There are two possibilities to create a WDS interface: dynamic - is created 'on the fly' and appers under wds menu as a dynamic interface static - is created manually

Property Description
arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - Address Resolution Protocol

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

211

disabled - the interface will not use ARP enabled - the interface will use ARP proxy-arp - the interface will use the ARP proxy feature reply-only - the interface will only reply to the requests originated to its own IP addresses. Neighbour MAC addresses will be resolved using /ip arp statically set table only disable-running-check (yes | no; default: no) - disable running check. For 'broken' wireless cards it is a good idea to set this value to 'yes' mac-address (read-only: MAC address; default: 00:00:00:00:00:00) - MAC address of the master-interface. Specifying master-interface, this value will be set automatically master-interface (name) - wireless interface which will be used by WDS mtu (integer: 0..65336; default: 1500) - Maximum Transmission Unit name (name; default: wdsN) - WDS interface name wds-address (MAC address) - MAC address of the remote WDS host

Notes
When the link between WDS devices, using wds-mode=dynamic, goes down, the dynamic WDS interfaces disappear and if there are any IP addresses set on this interface, their 'interface' setting will change to (unknown). When the link comes up again, the ' interface' value will not change - it will remain as (unknown). That's why it is not recommended to add IP addresses to dynamic WDS interfaces. If you want to use dynamic WDS in a bridge, set the wds-default-bridge value to desired bridge interface name. When the link will go down and then it comes up, the dynamic WDS interface will be put in the specified bridge automatically. As the routers which are in WDS mode have to communicate at equal frequencies, it is not recommended to use WDS and DFS simultaneously - it is most probable that these routers will not connect to each other. WDS significantly faster than EoIP (up to 10 -20% on RouterBOARD 500 systems), so it is recommended to use WDS whenever possible.

Example
[admin@MikroTik] interface wireless wd s> add master-interface=wlan1 \ \... wds-address=00:0B:6B:30:2B:27 disabled=no [admin@MikroTik] interface wireless wds> print Flags: X - disabled, R - running, D - dynamic 0 R name="wds1" mtu=1500 mac -address=00:0B:6B:30:2B:23 arp=enabled disable-running-check=no master-inteface=wlan1 wds-address=00:0B:6B:30:2B:27 [admin@MikroTik] interface wireless wds>

Align
Submenu level: /interface wireless align

Description
This feature is created to position wireless links. The align submenu describes properties which are used if /interface wireless mode is set to alignment-only. In this mode the interface 'listens' to those packets which are sent to it from other devices working on the same channel. The interface also can send special packets wh ich contains information about its parameters.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

212

Property Description
active-mode (yes | no; default: yes) - whether the interface will receive and transmit 'alignment' packets or it will only receive them audio-max (integer; default: -20) - signal-strength at which audio (beeper) frequency will be the highest audio-min (integer; default: -100) - signal-strength at which audio (beeper) frequency will be the lowest audio-monitor (MAC address; default: 00:00:00:00:00:00) - MAC address of the remote host whi ch will be 'listened' filter-mac (MAC address; default: 00:00:00:00:00:00) - in case if you want to receive packets from only one remote host, you should specify here its MAC address frame-size (integer: 200..1500; default: 300) - size of 'alignment' packets that will be transmitted frames-per-second (integer: 1..100; default: 25) - number of frames that will be sent per second (in activemode) receive-all (yes | no; default: no) - whether the interface gathers packets about other 802.11 standard packet s or it will gather only 'alignment' packets ssid-all (yes | no; default: no) - whether you want to accept packets from hosts with other ssid than yours test-audio (integer) - test the beeper for 10 seconds

Notes
If you are using the command /interface wireless align monitor then it will automatically change the wireless interface's mode from station, bridge or ap-bridge to alignment-only.

Example
[admin@MikroTik] interface wireless align> print frame-size: 300 active-mode: yes receive-all: yes audio-monitor: 00:00:00:00:00:00 filter-mac: 00:00:00:00:00:00 ssid-all: no frames-per-second: 25 audio-min: -100 audio-max: -20 [admin@MikroTik] interface wireless align>

Align Monitor
Command name: /interface wireless align monitor

Description
This command is used to monitor current signal parameters to/from a remote host.

Property Description
address (read-only: MAC address) - MAC address of the remote host avg-rxq (read-only: integer) - average signal strength of received packets since last display update on screen correct (read-only: percentage) - how many undamaged packets were received last-rx (read-only: time) - time in seconds before the last packet was receiv ed last-tx (read-only: time) - time in seconds when the last TXQ info was received rxq (read-only: integer) - signal strength of last received packet ssid (read-only: text) - service set identifier txq (read-only: integer) - the last received signal strength from our host to the remote one Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 213

Example
[admin@MikroTik] interface wireless align> monitor wlan2 # ADDRESS SSID RXQ AVG -RXQ LAST-RX TXQ LAST-TX CORRECT 0 00:01:24:70:4B:FC wirelesa -60 -60 0.01 -67 0.01 100 % [admin@MikroTik] interface wireless align>

Frequency Monitor
Description
Aproximately shows how loaded are the wireless channels.

Property Description
freq (read-only: integer) - shows current channel use (read-only: percentage) - shows usage in current channel

Example
Monitor 802.11b network load: [admin@MikroTik] interface wireless> frequency -monitor wlan1 FREQ USE 2412MHz 3.8% 2417MHz 9.8% 2422MHz 2% 2427MHz 0.8% 2432MHz 0% 2437MHz 0.9% 2442MHz 0.9% 2447MHz 2.4% 2452MHz 3.9% 2457MHz 7.5% 2462MHz 0.9% To monitor other bands, change the the band setting for the respective wireless interface.

Manual Transmit Power Table


Submenu level: /interface wireless manual-tx-power-table

Description
In this submenu you can define signal strength for each rate. You should be aware that you can damage your wireless card if you set higher output power than it is allowed. Note that the values in this table are set in dBm! NOT in mW! Therefore this table is used mainly to reduce the transmit power of the card.

Property Description
manual-tx-powers (text) - define tx-power in dBm for each rate, separate by commas

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

214

Example
To set the following transmit powers at each rates: 1Mbps@10dBm, 2Mbps@1 0dBm, 5.5Mbps@9dBm, 11Mbps@7dBm, do the following: [admin@MikroTik] interface wireless manual -tx-power-table> print 0 name="wlan1" manual -txpowers=1Mbps:17,2Mbps:17,5.5Mbps:17,11Mbps:17,6Mbps:17 , 9Mbps:17,12Mbps:17,18Mbps: 17,24Mbps:17, 36Mbps:17,48Mbps:17,54Mbps:17 [admin@MikroTik] interface wireless manual -tx-power-table> set 0 \ manual-tx-powers=1Mbps:10,2Mbps:10,5.5Mbps:9,11Mbps:7 [admin@MikroTik] interface wireless manual -tx-power-table> print 0 name="wlan1" manual -tx-powers=1Mbps:10,2Mbps:10,5.5Mbps:9,11Mbps:7 [admin@MikroTik] interface wireless manual -tx-power-table>

Network Scan
Command name: /interface wireless scan interface_name

Description
This is a feature that allows you to scan all avaliable wireless networks. While scanning, the card unregisters itself from the access point (in station mode), or unregisters all clients (in bridge or ap -bridge mode). Thus, network connections are lost while scanning.

Property Description
address (read-only: MAC address) - MAC address of the AP band (read-only: text) - in which standard does the AP operate bss (read-only: yes | no) - basic service set freeze-time-interval (time; default: 1s) - time in seconds to refresh the displayed d ata freq (read-only: integer) - the frequency of AP interface_name (name) - the name of interface which will be used for scanning APs privacy (read-only: yes | no) - whether all data is encrypted or not signal-strength (read-only: integer) - signal strength in dBm ssid (read-only: text) - service set identifier of the AP

Example
Scan the 5GHz band: [admin@MikroTik] interface wireless> scan wlan1 Flags: A - active, B - bss, P - privacy, R - routeros-network, N - nstreme ADDRESS SSID BAND FREQ SIG RADIO -NAME AB R 00:0C:42:05:00:28 test 5ghz 5180 -77 000C42050028 AB R 00:02:6F:20:34:82 aap1 5ghz 5180 -73 00026F203482 AB 00:0B:6B:30:80:0F www 5ghz 5180 -84 AB R 00:0B:6B:31:B6:D7 www 5ghz 5180 -81 000B6B31B6D7 AB R 00:0B:6B:33:1A:D5 R52_test_new 5ghz 5180 -79 000B6B331AD5 AB R 00:0B:6B:33:0D:EA short5 5ghz 5180 -70 000B6B330DEA AB R 00:0B:6B:31:52:69 MikroTik 5ghz 5220 -69 000B6B315269 AB R 00:0B:6B:33:12:BF long2 5ghz 5260 -55 000B6B3312BF -- [Q quit|D dump|C-z pause] [admin@MikroTik] interface wireless> Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 215

Security Profiles
Submenu level: /interface wireless security-profiles

Description
This section provides WEP (Wired Equivalent Privacy) and WPA/WPA2 (Wi -Fi Protected Access) functions to wireless interfaces. WPA The Wi-Fi Protected Access is a combination of 802.1X, EAP, MIC, TKIP and AES. This is a easy to configure and secure wireless mechanism. It has been later updated to version 2, to provide greater security. WEP The Wired Equivalent Privacy encrypts data only between 802.11 devices, using static keys. It is not considered a very secure wireless data encryption mechani sm, though it is better than no encryption at all. The configuration of WEP is quite simple, using MikroTik RouterOS security profiles.

Property Description
authentication-types (multiple choice: wpa-psk | wpa2-psk | wpa-eap | wpa2-eap; default: "") - the list of accepted authentication types. APs will advertise the listed types. Stations will choose the AP, which supports the "best" type from the list (WPA2 is always preferred to WPA1; EAP is preferred to PSK) eap-methods (multiple choice: eap-tls | passthrough) - the ordered list of EAP methods. APs will to propose to the stations one by one (if first method listed is rejected, the next one is tried). Stations will accept first proposed method that will be on the list eap-tls - Use TLS certificates for authentication passthrough - relay the authentication process to the RADIUS server (not used by the stations) group-ciphers (multiple choice: tkip | aes-ccm) - a set of ciphers used to encrypt frames sent to all wireless station (broadcast transfers) in the order of preference tkip - Temporal Key Integrity Protocol - encryption protocol, compatible with lagacy WEP equipment, but enhanced to correct some of WEP flaws aes-ccm - more secure WPA encryption protocol, based on the reliable AES (Advanced Encry ption Standard). Networks free of WEP legacy should use only this group-key-update (time; default: 5m) - how often to update group key. This parameter is used only if the wireless card is configured as an Access Point mode (none | static-keys-optional | static-keys-required | dynamic-keys; default: none) - security mode: none - do not encrypt packets and do not accept encrypted packets static-keys-optional - if there is a static-sta-private-key set, use it. Otherwise, if the interface is set in an AP mode, do not use encryption, if the the interface is in station mode, use encryption if the static -transmit-key is set static-keys-required - encrypt all packets and accept only encrypted packets dynamic-keys - generate encryptioon keys dynamically name (name) - descriptive name for the security profile radius-mac-authentication (no | yes; default: no) - whether to use Radius server for MAC authentication static-algo-0 (none | 40bit-wep | 104bit-wep | aes-ccm | tkip; default: none) - which encryption algorithm to use: none - do not use encryption and do not accept encrypted packets 40bit-wep - use the 40bit encryption (also known as 64bit -wep) and accept only these packets 104bit-wep - use the 104bit encryption (also known as 128bit -wep) and accept only these packets aes-ccm - use the AES-CCM (Advanced Encryption Standard in Counter with CBC -MAC) encryption algorithm and accept only these packets tkip - use the TKIP (Temporal Key Integrity Protocol) and accept only these packets static-algo-1 (none | 40bit-wep | 104bit-wep | aes-ccm | tkip; default: none) - which encryption algorithm to use: none - do not use encryption and do not accept encrypted packets 40bit-wep - use the 40bit encryption (also known as 64bit -wep) and accept only these packets 104bit-wep - use the 104bit encryption (also known as 128bit -wep) and accept only these packets aes-ccm - use the AES-CCM (Advanced Encryption Standard in Counter with CBC -MAC) encryption algorithm and accept only these packets tkip - use the TKIP (Temporal Key Integrity Protocol) and accept only these packets Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 216

static-algo-2 (none | 40bit-wep | 104bit-wep | aes-ccm | tkip; default: none) - which encryption algorithm to use: none - do not use encryption and do not accept encrypted packets 40bit-wep - use the 40bit encryption (also known as 64bit -wep) and accept only these packets 104bit-wep - use the 104bit encryption (also known as 128bit -wep) and accept only these packets aes-ccm - use the AES-CCM (Advanced Encryption Standard in Counter with CBC -MAC) encryption algorithm and accept only these packets tkip - use the TKIP (Temporal Key Integrity Protocol) and accept only these packets static-algo-3 (none | 40bit-wep | 104bit-wep | aes-ccm | tkip; default: none) - which encryption algorithm to use: none - do not use encryption and do not accept encrypted packets 40bit-wep - use the 40bit encryption (also known as 64bit -wep) and accept only these packets 104bit-wep - use the 104bit encryption (also known as 128bit -wep) and accept only these packets aes-ccm - use the AES-CCM (Advanced Encryption Standard in Counter with CBC -MAC) encryption algorithm and accept only these packets tkip - use the TKIP (Temporal Key Integrity Protocol) and accept only these packets static-key-0 (text) - hexadecimal key which will be used to encrypt packets with the 40bit -wep or 104bit-wep algorithm (algo-0). If AES-CCM is used, the key must consist of even number of characters and must be at least 32 characters long. For TKIP, the key must be at least 64 characters long an d also must consist of even number characters static-key-1 (text) - hexadecimal key which will be used to encrypt packets with the 40bit -wep or 104bit-wep algorithm (algo-0). If AES-CCM is used, the key must consist of even number of characters and must b e at least 32 characters long. For TKIP, the key must be at least 64 characters long and also must consist of even number characters static-key-2 (text) - hexadecimal key which will be used to encrypt packets with the 40bit -wep or 104bit-wep algorithm (algo-0). If AES-CCM is used, the key must consist of even number of characters and must be at least 32 characters long. For TKIP, the key must be at least 64 characters long and also must consist of even number characters static-key-3 (text) - hexadecimal key which will be used to encrypt packets with the 40bit -wep or 104bit-wep algorithm (algo-0). If AES-CCM is used, the key must consist of even number of characters and must be at least 32 characters long. For TKIP, the key must be at least 64 characters lo ng and also must consist of even number characters static-sta-private-algo (none | 40bit-wep | 104bit-wep | aes-ccm | tkip) - algorithm to use if the static -staprivate-key is set. Used to commumicate between 2 devices static-sta-private-key (text) - if this key is set in station mode, use this key for encryption. In AP mode you have to specify static-private keys in the access-list or use the Radius server using radius-mac-authentication. Used to commumicate between 2 devices static-transmit-key (static-key-0 | static-key-1 | static-key-2 | static-key-3; default: static-key-0) - which key to use for broadcast packets. Used in AP mode tls-certificate (name) - select the certificate for this device from the list of imported certificates tls-mode (no-certificates | dont-verify-certificate | verify-certificate; default: no-certificates) - TLS certificate mode no-certificates - certificates are negotiated dynamically using anonymous Diffie -Hellman MODP 2048 bit algorithm dont-verify-certificate - require a certificate, but do not chack, if it has been signed by the available CA certificate verify-certificate - require a certificate and verify that it has been signed by the available CA certificate unicast-ciphers (multiple choice: tkip | aes-ccm) - a set of ciphers used to encrypt frames sent to individual wireless station (unicast transfers) in the order of preference tkip - Temporal Key Integrity Protocol - encryption protocol, compatible with lagacy WEP equipment, but enhanced to correct some of WEP fl aws aes-ccm - more secure WPA encryption protocol, based on the reliable AES (Advanced Encryption Standard). Networks free of WEP legacy should use only this wpa2-pre-shared-key (text; default: "") - string, which is used as the WPA2 Pre Shared Key. It m ust be the same on AP and station to communicate wpa-group-ciphers (aes-ccm | tkip; default: "") - which algorithms to use for WPA group communications (for multicast and broadcast packets). If the interface is an Access Point, it will use the "strongest" algorithm from AES and TKIP (AES is "stronger"). If the interface acts as a station, it will connect to Access Points which support at least one of selected algorithms Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 217

wpa-pre-shared-key (text; default: "") - string, which is used as the WPA Pre Shared K ey. It must be the same on AP and station to communicate wpa-unicast-ciphers (aes-ccm | tkip; default: "") - which algorithms are allowed to use for unicast communications. If the interface is an Access Point, then it sends these algorithms as supported. If it is a station, then it will connect only to APs which support any of these algorithms

Notes
The keys used for encryption are in hexadecimal form. If you use 40bit-wep, the key has to be 10 characters long, if you use 104bit-wep, the key has to be 26 characters long. Prism card doesn't report that the use of WEP is required for all data type frames, which means that some clients will not see that access point uses encryption and will not be able to connect to such AP. This is a Prism hardware problem and can not be fixed. Use Atheros -based cards (instead of Prism) on APs if you want to provide WEP in your wireless network. Wireless encryption cannot work together with wireless compression.

Sniffer
Submenu level: /interface wireless sniffer

Description
With wireless sniffer you can sniff packets from wireless networks.

Property Description
channel-time (time; default: 200ms) - how long to sniff each channel, if multiple -channels is set to yes file-limit (integer; default: 10) - limits file-name's file size (measured in kilobytes) file-name (text; default: "") - name of the file where to save packets in PCAP format. If file -name is not defined, packets are not saved into a file memory-limit (integer; default: 1000) - how much memory to use (in kil obytes) for sniffed packets multiple-channels (yes | no; default: no) - whether to sniff multiple channels or a single channel no - wireless sniffer sniffs only one channel in frequency that is configured in /interface wireless yes - sniff in all channels that are listed in the scan-list in /interface wireless only-headers (yes | no; default: no) - sniff only wireless packet heders receive-errors (yes | no; default: no) - whether to receive packets with CRC errors streaming-enabled (yes | no; default: no) - whether to send packets to server in TZSP format streaming-max-rate (integer; default: 0) - how many packets per second the router will accept 0 - no packet per second limitation streaming-server (IP address; default: 0.0.0.0) - streaming server's IP address

Sniffer Sniff
Submenu level: /interface wireless sniffer sniff

Description
Wireless Sniffer Sniffs packets

Property Description
file-over-limit-packets (read-only: integer) - how many packets are dropped because of exceeding file -limit file-saved-packets (read-only: integer) - number of packets saved to file Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 218 Referensi : Download :www.mikrotik.com

file-size (read-only: integer) - current file size (kB) memory-over-limit-packets (read-only: integer) - number of packets that are dropped because of exceeding memory-limit memory-saved-packets (read-only: integer) - how many packets are stored in mermory memory-size (read-only: integer) - how much memory is currently used for sniffed packets (kB) processed-packets (read-only: integer) - number of sniffed packets real-file-limit (read-only: integer) - the real file size limit. It is calculated from the beginning of sniffing to reserve at least 1MB free space on the disk real-memory-limit (read-only: integer) - the real memory size limit. It is calculated from the beginning of sniffing to reserve at least 1MB of free space in the memory stream-dropped-packets (read-only: integer) - number of packets that are dropped because of exceeding streaming-max-rate stream-sent-packets (read-only: integer) - number of packets that are sent to the streaming server

Command Description
save - saves sniffed packets from the memory to file-name in PCAP format

Sniffer Packets
Description
Wireless Sniffer sniffed packets. If packets Cyclic Redundancy Check (CRC) field detects error, it will be displayed by crc-error flag.

Property Description
dst (read-only: MAC address) - the receiver's MAC address freq (read-only: integer) - frequency interface (read-only: text) - wireless interface that captures packets signal@rate (read-only: text) - at which signal-strength and rate was the packet received src (read-only: MAC address) - the sender's MAC address time (read-only: time) - time when the packet was received, starting from the beginning of sniffing type (read-only: assoc-req | assoc-resp | reassoc-req | reassoc-resp | probe-req | probe-resp | beacon | atim | disassoc | auth | deauth | ps-poll | rts | cts | ack | cf-end | cf-endack | data | d-cfack | d-cfpoll | d-cfackpoll | datanull | nd-cfack | nd-cfpoll | nd-cfackpoll) - type of the sniffed packet

Example
Sniffed packets: [admin@MikroTik] interface wireless sniffer packet> pr Flags: E - crc-error # FREQ SIGNAL@RATE SRC DST 0 2412 -73dBm@1Mbps 00:0B:6B:31:00:53 FF:FF:FF:FF:FF:FF 1 2412 -91dBm@1Mbps 00:02:6F:01:CE:2E FF:FF:FF:FF:FF:FF 2 2412 -45dBm@1Mbps 00:02:6F:05:68:D3 FF:FF:FF:FF:FF:FF 3 2412 -72dBm@1Mbps 00:60:B3:8C:98:3F FF:FF:FF:FF:FF:FF 4 2412 -65dBm@1Mbps 00:01:24:70:3D:4E FF:FF:FF:FF:FF:FF 5 2412 -60dBm@1Mbps 00:01:24:70:3D:4E FF:FF:FF:FF:FF:FF 6 2412 -61dBm@1Mbps 00:01:24:70:3D:4E FF:FF:FF:FF:FF:FF

TYPE beacon beacon beacon beacon probe -req probe -req probe -req

Snooper
Submenu level: /interface wireless snooper Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 219

Description
With wireless snooper you can monitor the traffic load on each channel.

Property Description
channel-time (time; default: 200ms) - how long to snoop each channel, if multiple -channels is set to yes multiple-channels (yes | no; default: no) - whether to snoop multiple channels or a single channel no - wireless snooper snoops only one channel in frequency that is configured in /interface wireless yes - snoop in all channels that are listed in the scan-list in /interface wireless receive-errors (yes | no; default: no) - whether to receive packets with CRC errors

Command Description
snoop - starts monitoring wireless channels wireless interface name - interface that monitoring is performed on BAND - operating band

Example
Snoop 802.11b network: [admin@MikroTik] interface wireless BAND FREQ USE BW 2.4ghz-b 2412MHz 1.5% 11.8kbps 2.4ghz-b 2417MHz 1.3% 6.83kbps 2.4ghz-b 2422MHz 0.6% 4.38kbps 2.4ghz-b 2427MHz 0.6% 4.43kbps 2.4ghz-b 2432MHz 0.3% 2.22kbps 2.4ghz-b 2437MHz 0% 0bps 2.4ghz-b 2442MHz 1% 8.1kbps 2.4ghz-b 2447MHz 1% 8.22kbps 2.4ghz-b 2452MHz 1% 8.3kbps 2.4ghz-b 2457MHz 0% 0bps 2.4ghz-b 2462MHz 0% 0bps snooper> snoop wlan1 NET -COUNT STA-COUNT 2 2 0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0

[admin@MikroTik] interface wireless snooper>

Application Examples
Station and AccessPoint
This example shows how to configure 2 Mi kroTik routers - one as Access Point and the other one as a station on 5GHz (802.11a standard).

On Access Point: mode=ap-bridge frequency=5805 band=5ghz ssid=test disabled=no Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 220

On client (station): mode=station band=5ghz ssid=test disabled=no Configure the Access Point and add an IP address (10.1.0.1) to it: [admin@AccessPoint] interface wireless> set 0 mode=ap -bridge frequency=5805 \ band=5ghz disabled=no ss id=test name=AP [admin@AccessPoint] interface wireless> print Flags: X - disabled, R - running 0 name="AP" mtu=1500 mac -address=00:0C:42:05:00:22 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050022" m ode=ap-bridge ssid="test" area="" frequency-mode=superchannel country=no_country_set antenna gain=0 frequency=5805 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-ratesa/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-stationcount=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antennamode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes def ault-ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@AccessPoint] interface wireless> /ip add [admin@AccessPoint] ip address> add address=10. 1.0.1/24 interface=AP [admin@AccessPoint] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 10.1.0.1/24 10.1.0.0 10.1.0.255 AP [admin@AccessPoint] ip ad dress> Configure the station and add an IP address (10.1.0.2) to it: [admin@Station] interface wireless> set wlan1 name=To -AP mode=station \ ssid=test band=5ghz disabled=no [admin@Station] interface wireless> print Flags: X - disabled, R - running 0 R name="To-AP" mtu=1500 mac-address=00:0B:6B:34:5A:91 arp=enabled disable-running-check=no interface -type=Atheros AR5213 radio-name="000B6B345A91" mode=station ssid="test" area="" frequency-mode=superchannel country=no_country_set antenna gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-ratesa/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-stationcount=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 221 Referensi : Download :www.mikrotik.com

noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antennamode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@Station] interface wireless> /ip address [admin@Station] ip address> add address=10.1.0.2/24 interface=To -AP [admin@Station] ip address> print Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK BROADCAST INTERFACE 0 172.16.0.2/24 172.16.0.0 172.16.0.255 To -AP 1 192.168.2.3/24 192.168.2.0 192.168.2.255 To -AP 2 10.1.0.2/24 10.1.0.0 10.1.0.255 To -AP [admin@Station] ip address> Check whether you can ping the Access Point from Station: [admin@Station] > ping 10.1.0.1 10.1.0.1 64 byte ping: ttl=64 time=3 ms 10.1.0.1 64 byte ping: ttl=64 time=3 ms 10.1.0.1 64 byte ping: ttl=64 time=3 ms 3 packets transmitte d, 3 packets received, 0% packet loss round-trip min/avg/max = 3/3.0/3 ms [admin@Station] >

WDS Station
Using 802.11 set of standards you cannot simply bridge wireless stations. To solve this problem, the wdsstation mode was created - it works just like a station, but connects only to APs that support WDS.

This example shows you how to make a transparent network, using the Station WDS feature: On WDS Access Point: Configure AP to support WDS connections Set wds-default-bridge to bridge1 On WDS station: Configure it as a WDS Station, using mode=station-wds Configure the WDS Access Point. Configure the wireless interface and put it into a bridge, and define that the dynamic WDS links should be automatically put into the same bridge: [admin@WDS_AP] > interface bridge [admin@WDS_AP] interface bridge> add [admin@WDS_AP] interface bridge> print Flags: X - disabled, R - running 0 R name="bridge1" mtu=1500 arp=enabled mac -address=B0:62:0D:08:FF:FF stp=no priority=32768 ageing -time=5m forward-delay=15s garbage-collection-interval=4s hello-time=2s max-message-age=20s [admin@WDS_AP] interface bridge> port [admin@WDS_AP] interface bridge port> print # INTERFACE BRIDG E PRIORITY PATH-COST Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 222

0 Public none 128 10 1 wlan1 none 128 10 [admin@WDS_AP] interface bridge port> set 0 bridge=bridge1 [admin@WDS_AP] interface bridge port> /in wireless [admin@WDS_AP] interface wireless> set wlan1 mode=ap -bridge ssid=wds-statest \ wds-mode=dynamic wds-default-bridge=bridge1 disabled=no band=2.4ghz -b/g \ frequency=2437 [admin@WDS_AP] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0C:42:05:00:22 arp=ena bled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050022" mode=ap -bridge ssid="wds-sta-test" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=2437 band=2.4ghz -b/g scan-list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=dynamic wds-default-bridge=bridge1 wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble-mode=both [admin@WDS_AP] interface wireless> Now configure the WDS station and put the wireless ( wlan1) and ethernet (Local) interfaces into a bridge: [admin@WDS_Station] > interface bridge [admin@WDS_Station] interface bridge> add [admin@WDS_Station] interface bridge> print Flags: X - disabled, R - running 0 R name="bridge1" mtu=1500 arp=enabled mac -address=11:05:00:00:02:00 stp=no priority=32768 ageing -time=5m forward-delay=15s garbage-collection-interval=4s hello-time=2s max-message-age=20s [admin@WDS_Station] interface bridge> port [admin@WDS_Station] interface bridge port> print # INTERFACE BRIDGE PRIORITY PATH -COST 0 Local none 128 10 1 wlan1 none 128 10 [admin@WDS_Station] interface bridge port> set 0,1 bridge=bridge1 [admin@WDS_Station] interface bridge port> /interface wireless [admin@WDS_Station] interface wireless> set wlan1 mode=station -wds disabled=no \ \... ssid=wds-sta-test band=2.4ghz-b/g [admin@WDS_Station] interface wireless> print Flags: X - disabled, R - running 0 R name="wlan1" mtu=1500 mac -address=00:0B:6B:34:5A:91 arp=enabled disable-running-check=no interface -type=Atheros AR5213 radio-name="000B6B345A91" mode=station -wds ssid="wds-sta-test" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=2412 band=2.4ghz -b/g scan-list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 223

54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@WDS_Station] interface wireless>

Virtual Access Point


Virtual Access Point (VAP) enables you to create multiple Access Points with differe nt Service Set Identifier, WDS settings, and even different MAC address, using the same hardware interface. You can create up to 7 VAP interfaces from a single physical interface. To create a Virtual Access Point, simply add a new interface, specifying a master-interface which is the physical interface that will do the hardware function to VAP. This example will show you how to create a VAP: [admin@VAP] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0C:42:05:00:22 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050022" mode=ap -bridge ssid="test" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=2437 band=2.4ghz -b/g scan-list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@VAP] interface wireless> add master -interface=wlan1 ssid=virtual test \ \... mac-address=00:0C:42:12:34:56 disabled=no name=V -AP [admin@VAP] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" m tu=1500 mac-address=00:0C:42:05:00:22 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050022" mode=ap -bridge ssid="test" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=2437 band=2.4ghz -b/g scan-list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus 224 Referensi : Download :www.mikrotik.com

default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both name="V-AP" mtu=1500 mac-address=00:0C:42:12:34:56 arp=enabled disable-running-check=no interface -type=virtual-AP master-interface=wlan1 ssid="virtual -test" area="" max-station-count=2007 wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no default-authentication=yes default -forwarding=yes default-ap-tx-limit=0 default-client-tx-limit=0 hide-ssid=no security-profile=default [admin@VAP] interface wireles s> When scanning from another router for an AP, you will see that you have 2 Access Points instead of one: [admin@MikroTik] interface wireless> scan Station Flags: A - active, B - bss, P - privacy, R - routeros-network, N - nstreme ADDRESS SSID BAND FREQ SIG RADIO -NAME AB R 00:0C:42:12:34:56 virtual -test 2.4ghz-g 2437 -72 000C42050022 AB R 00:0C:42:05:00:22 test 2.4ghz -g 2437 -72 000C42050022 -- [Q quit|D dump|C-z pause] [admin@MikroTik] interface w ireless> Note that the master-interface must be configured as an Access Point ( ap-bridge or bridge mode)! 1

Nstreme

This example shows you how to configure a point -to-point Nstreme link. The setup of Nstreme is similar to usual wireless configuration, except that you have to do some changes under /interface wireless nstreme. Set the Nstreme-AP to bridge mode and enable Nstreme on it: [admin@Nstreme-AP] interface wireless> set 0 mode=bridge ssid=nstreme \ \... band=5ghz frequency=5805 disabled=no [admin@Nstreme-AP] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0C:42:05:00:22 arp=enabled disable-running-check=no interface-type=Atheros AR5413 radio-name="000C42050022" mode=bridge ssid="nstreme" area="" frequency-mode=superchannel country=no_country_set antenna gain=0 frequency=5805 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-ratesa/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-stationcount=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antennamode=ant-a Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 225

wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled d efault-authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@Nstreme-AP] interface wireless > nstreme [admin@Nstreme-AP] interface wireless nstreme> set wlan1 enable nstreme=yes [admin@Nstreme-AP] interface wireless nstreme> print 0 name="wlan1" enable -nstreme=yes enable -polling=yes framer policy=none framer-limit=3200 [admin@Nstreme-AP] interface wireless nstreme> Configure Nstreme-Client wireless settings and enable Nstreme on it: [admin@Nstreme-Client] interface wireless> set wlan1 mode=station ssid=nstreme \ band=5ghz frequency=5805 disabled=no [admin@Nstreme-Client] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0B:6B:34:5A:91 arp=enabled disable-running-check=no interface -type=Atheros AR5213 radio-name="000B6B345A91" mode=station ssid="nstreme" area="" frequency-mode=superchannel country=no_country_set antenna gain=0 frequency=5805 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-ratesa/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-stationcount=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antennamode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@Nstreme-Client] interface wireless> nstreme [admin@Nstreme-Client] interface wireless nstreme> set wlan1 enable nstreme=yes [admin@Nstreme-Client] interface wireless nstreme> print 0 name="wlan1" enable -nstreme=yes enable -polling=yes framer policy=none framer-limit=3200 [admin@Nstreme-Client] interface wireless nstreme> And monitor the link: [admin@Nstreme-Client] interface wireless> moni tor wlan1 status: connected -to-ess band: 5ghz frequency: 5805MHz tx-rate: 24Mbps rx-rate: 18Mbps ssid: "nstreme" bssid: 00:0C:42:05:00:22 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 226

radio-name: "000C42050022" signal-strength: -70dBm tx-signal-strength: -68dBm tx-ccq: 0% rx-ccq: 3% wds-link: no nstreme: yes polling: yes framing-mode: none routeros-version: "2.9rc2" current-tx-powers: 1Mbps:11,2Mbps:11,5.5Mbps:11,11Mbps:11,6Mbps:28, 9Mbps:28,12Mbps:28,18Mbps:28,24Mbps:28,36Mbps:25, 48Mbps:23,54Mbps:22 -- [Q quit|D dump|C-z pause] [admin@Nstreme-Client] interface wirel ess>

Dual Nstreme
The purpose of Nstreme2 (Dual Nstreme) is to make superfast point -to-point links, using 2 wireless cards on each router - one for receiving and the other one for transmitting data (you can use different bands for receiving

and transmitting). This example will show you how to make a point -to-point link, using Dual Nstreme. Configure DualNS-1: [admin@DualNS-1] interface wireless> set 0,1 mode=nstreme -dual-slave [admin@DualNS-1] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0C:42:05:04:36 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050436" mode=nstr eme-dual-slave ssid="MikroTik" area="" frequency -mode=superchannel country=no_country_set antenna-gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported -rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default perio dic-calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default-ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both 1 name="wlan2" mtu=1500 mac -address=00:0C:42:05:00:28 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050028" mode=nstreme -dual-slave ssid="MikroTik" area="" frequency -mode=superchannel country=no_country_set 227

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

antenna-gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported -rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx-power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@DualNS-1] interface wireless> nstreme -dual [admin@DualNS-1] interface wireless nstreme -dual> add rx-radio=wlan1 \ tx-radio=wlan2 rx-frequency=5180 tx-frequency=5805 disabled=no [admin@DualNS-1] interface wireless nstreme -dual> print Flags: X - disabled, R - running 0 R name="nstreme1" mtu=1500 mac -address=00:0C:42:05:04:36 arp=enabled disable-running-check=no tx-radio=wlan2 rx-radio=wlan1 remote-mac=00:00:00:00:00:00 tx -band=5ghz tx-frequency=5805 rx-band=5ghz rx-frequency=5180 rates -b=1Mbps,2Mbps,5.5Mbps,11Mbps rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps framer-policy=none framer -limit=4000 [admin@DualNS-1] interface wireless nstreme -dual> Note the MAC address of the interface nstreme1. You will need it to configure the remote (DualNS-2) router. As we have not configured the DualNS-2 router, we cannot define the remote-mac parameter on DualNS-1. We will do it after configuring DualNS-2! The configuration of DualNS-2: [admin@DualNS-2] interface wireless> set 0,1 mode=nstreme -dual-slave [admin@DualNS-2] interface wireless> print Flags: X - disabled, R - running 0 name="wlan1" mtu=1500 mac -address=00:0C:42:05: 00:22 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050022" mode=nstreme -dual-slave ssid="MikroTik" area="" frequency -mode=superchannel country=no_country_set antenna-gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported -rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default-authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both 1 name="wlan2" mtu=1500 mac -address=00:0C:42:05:06:B2 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C420506B2" mode=nstreme -dual-slave ssid="MikroTik" area="" frequency -mode=superchannel country=no_country_set antenna-gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported -rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps 228

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=default disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@DualNS-2] interface wireless> nstreme -dual [admin@DualNS-2] interface wireless nstreme -dual> add rx-radio=wlan1 \ \... tx-radio=wlan2 rx-frequency=5805 tx-frequency=5180 disabled=no \ \... remote-mac=00:0C:42:05:04:36 [admin@DualNS-2] interface wireless nstreme -dual> print Flags: X - disabled, R - running 0 R name="nstreme1" mtu=1500 mac -address=00:0C:42:05:00:22 arp=enabled disable-running-check=no tx-radio=wlan2 rx-radio=wlan1 remote-mac=00:0C:42:05:04:36 tx -band=5ghz tx-frequency=5180 rx-band=5ghz rx-frequency=5805 rates -b=1Mbps,2Mbps,5.5Mbps,11Mbps rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps framer-policy=none framer -limit=4000 [admin@DualNS-2] interface wireless nstreme -dual> Now complete the configuration for DualNS-1: [admin@DualNS-1] interface wireless nstreme -dual> set 0 remote mac=00:0C:42:05:00:22 [admin@DualNS-1] interface wireless nstreme -dual> print Flags: X - disabled, R - running 0 R name="nstreme1" mtu=1500 mac -address=00:0C:42:05:04:36 arp=enabled disable-running-check=no tx-radio=wlan2 rx-radio=wlan1 remote-mac=00:0C:42:05:00:22 tx -band=5ghz tx-frequency=5805 rx-band=5ghz rx-frequency=5180 rates -b=1Mbps,2Mbps,5.5Mbp s,11Mbps rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps framer-policy=none framer -limit=4000 [admin@DualNS-1] interface wireless nstreme -dual>

WEP Security
This example shows how to configure WEP (Wired Equivalent Privacy) on Access Point and Clients. In example we will configure an Access Point which will use 104bit-wep for one station and 40bit-wep for other clients. The configuration of stations is also present.

The key, used for connection between WEP_AP and WEP_Station1 will be 65432109876543210987654321 , key for WEP_AP and WEP_StationX will be 1234567890! Configure the Access Point: [admin@WEP_AP] interface wireless security -profiles> add \ \... name=Station1 mode=static -keys-required static-sta-privatealgo=104bit-wep \ \... static-sta-private-key=65432109876543210987654321 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 229

[admin@WEP_AP] interface wireless security -profiles> add name=StationX \ \... mode=static-keys-required static-algo-1=40bit-wep static-key1=1234567890 \ \... static-transmit-key=key-1 [admin@WEP_AP] interface wireless security -profiles> print 0 name="default" mode=none wpa -unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key-0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group -keyupdate=5m 1 name="Station1" mode=static-keys-required wpa-unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=104bit-wep static-sta-private-key="65432109876543210987654321" radius-mac-authentication=no group -key-update=5m 2 name="StationX" mode=static -keys-required wpa-unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key0="" static-algo-1=40bit-wep static-key-1="1234567890" static -algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-1 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group -keyupdate=5m [admin@WEP_AP] interface wireless security -profiles> .. [admin@MikroTik] interface wireless> set 0 name=WEP -AP mode=ap-bridge \ \... ssid=mt_wep frequency=5320 band=5ghz disabled=no security profile=StationX [admin@WEP_AP] interface wireless> print Flags: X - disabled, R - running 0 name="WEP-AP" mtu=1500 mac-address=00:0C:42:05:04:36 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050436" mode=ap -bridge ssid="mt_wep" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=5320 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,1 8Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=StationX disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@WEP_AP] interface wireless> access -list [admin@WEP_AP] interface wireless access -list> add private-algo=104bit-wep \ \... private-key=65432109876543210987654321 interface=WEP -AP forwarding=yes \ \... mac-address=00:0C:42:05:00:22 Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 230

[admin@WEP_AP] interface wireless access -list> print Flags: X - disabled 0 mac-address=00:0C:42:05:00:22 interface=WEP -AP authentication=yes forwarding=yes ap -tx-limit=0 client-tx-limit=0 private-algo=104bit-wep private-key="65432109876543210987654321" [admin@WEP_AP] interface wireless access -list> Configure WEP_StationX: [admin@WEP_Station1] interface wireless secur ity-profiles> add name=Station1 \ \... mode=static-keys-required static-sta-private-algo=104bit-wep \ \... static-sta-private-key=65432109876543210987654321 [admin@WEP_Station1] interface wireless security -profiles> print 0 name="default" mode=none wpa -unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key-0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group -keyupdate=5m 1 name="Station1" mode=static -keys-required wpa-unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=104bit-wep static-sta-private-key="65432109876543210987654321" radius-mac-authentication=no group -key-update=5m [admin@WEP_Station1] interface wireless security -profiles> .. [admin@WEP_Station1] interface wireless> set wlan1 mode=station ssid=mt_wep \ \... band=5ghz security -profile=Station1 name=WEP -STA1 disabled=no [admin@WEP_Station1] interface wireless> print Flags: X - disabled, R - running 0 R name="WEP-STA1" mtu=1500 mac -address=00:0C:42:05:00:22 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C42050022" mode=station ssid="mt_wep" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=Station1 disconnect -timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@WEP_Station1] interface wireless> Config of StationX: [admin@WEP_StationX] interface wireless security -profiles> add name=StationX \ \... mode=static-keys-required static-algo-1=40bit-wep static-key1=1234567890 \ \... static-transmit-key=key-1 [admin@WEP_StationX] interface wireless security -profiles> print Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 231

0 name="default" mode=none wpa -unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key-0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group -keyupdate=5m 1 name="StationX" mode=static -keys-required wpa-unicast-ciphers="" wpa-group-ciphers="" pre-shared-key="" static-algo-0=none static-key0="" static-algo-1=40bit-wep static-key-1="1234567890" static -algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-1 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group-keyupdate=5m [admin@WEP_StationX] interface wireless security -profiles> .. [admin@WEP_StationX] interface wireless> set wlan1 name=WEP -STAX ssid=mt_wep \ \... band=5ghz security -profile=StationX mode=station disabled=no [admin@WEP_StationX] interface wireless> print 0 R name="WEP-STAX" mtu=1500 mac -address=00:0C:42:05:06:B2 arp=enabled disable-running-check=no interface -type=Atheros AR5413 radio-name="000C420506B2" mode=station ssid="mt_wep" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx-power=default tx-power-mode=default noise-floor-threshold=default periodic -calibration=default burst-time=disabled fast -frames=no dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default -authentication=yes default-forwarding=yes default -ap-tx-limit=0 default-client-txlimit=0 hide-ssid=no security-profile=StationX disconnect-timeout=3s on-fail-retry-time=100ms preamble -mode=both [admin@WEP_StationX] interface wireless>

WPA Security
This example shows WPA (Wi -Fi Protected Access) configuration on Access Point and Cl ient to secure all data which will be passed between AP and Client

On the AP in default or in your own made profile as an encryption algorithm choose wpa-psk. Specify the preshared-key, wpa-unicast-ciphers and wpa-group-cipher [admin@WPA_AP] interface wireless security -profiles> set default mode=wpa psk\ \... pre-shared-key=1234567890 wpa -unicast-ciphers=aes-ccm,tkip wpa-groupciphers=aes-ccm,tkip [admin@WPA_AP] interface wirele ss security-profiles> pr Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 232

0 name="default" mode=wpa -psk wpa-unicast-ciphers=tkip,aes-ccm wpa-group-ciphers=tkip,aes-ccm pre-shared-key="1234567890" static-algo-0=none static-key-0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group -keyupdate=5m [admin@WPA_AP] interface wireless security -profiles> On the Client do the same. Encryption algorithm, wpa-group-cipher and pre-shared-key must be the same as specified on AP, wpa-unicast-cipher must be one of the ciphers supported by Access Point [admin@WPA_Station] interface wireless security -profiles> set default mode=wpa-psk\ \... pre-shared-key=1234567890 wpa -unicast-ciphers=tkip wpa-groupciphers=aes-ccm,tkip [admin@WPA_Station] interface wireless security -profiles> pr 0 name="default" mode=wpa -psk wpa-unicast-ciphers=tkip wpa-group-ciphers=tkip,aes-ccm pre-shared-key="1234567890" static-algo-0=none static-key-0="" static-algo-1=none static-key-1="" static-algo-2=none static-key-2="" static-algo-3=none static-key-3="" static-transmit-key=key-0 static-sta-private-algo=none static-sta-private-key="" radius-mac-authentication=no group -keyupdate=5m [admin@WPA_Station] interface wireless security -profiles> Test the link between Access point and the client [admin@WPA_Station] interface wireless > print Flags: X - disabled, R - running 0 R name="wlan1" mtu=1500 mac-address=00:0B:6B:35:E5:5C arp=enabled disable-running-check=no interface -type=Atheros AR5213 radio-name="000B6B35E55C" mode=station ssid="MikroTik" area="" frequency-mode=superchannel country=no_country_set antenna -gain=0 frequency=5180 band=5ghz scan -list=default rate-set=default supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps, 54Mbps basic-rates-b=1Mbps basic-rates-a/g=6Mbps max-station-count=2007 ack-timeout=dynamic tx -power-mode=default noise -floorthreshold=default periodic-calibration=default burst -time=disabled dfs-mode=none antenna-mode=ant-a wds-mode=disabled wds-default-bridge=none wds-ignore-ssid=no update-stats-interval=disabled default-authentication=yes default -forwarding=yes default -ap-txlimit=0 default-client-tx-limit=0 hide-ssid=no security-profile=default disconnect-timeout=3s on-fail-retry-time=100ms preamble -mode=both compression=no allow -sharedkey=no [admin@WPA_Station] interface wireless >

Troubleshooting
Description
If I use WDS and DFS, the routers do not connect to each other! As the WDS routers must operate at the same frequency, it is very proba ble that DFS will not select the frequency that is used by the peer router. Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 233

MikroTik RouterOS does not send any traffic through Cisco Wireless Access Point or Wireless Bridge If you use CISCO/Aironet Wireless Ethernet Bridge or Access Point, you should se t the Configuration/Radio/I80211/Extended (Allow proprietary extensions) to off, and the Configuration/Radio/I80211/Extended/Encapsulation (Default encapsulation method) to RFC1042. If left to the default on and 802.1H, respectively, you won't be able to p ass traffic through the bridge. Prism wireless clients don't connect to AP after upgrade to 2.9 Prism wireless card's primary firmware version has to be at least 1.0.7 in order to boot wireless card's secondary firmware, which allows Prism card correctly operate under RouterOS. Check the log file to see whether the wireless card's secondary firmware was booted. Prism wireless clients don't connect to AP Prism wireless clients do not connect to AP that work with enabled hide -ssid feature

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

234

BAB XXV ARLAN 655 Wireless Client Card


General Information
Summary
The MikroTik RouterOS supports Arlan 655 Wireless Interface client cards. This card fits in the ISA expansion slot and provides transparent wireless communications to o ther network nodes.

Specifications
Packages required: arlan License required: Level4 Submenu level: /interface arlan Hardware usage: Not significant

Related Documents
Package Management Device Driver List IP Addresses and ARP Log Management

Installation
Example
To add the driver for Arlan 655 adapter, do the following: [admin@MikroTik]> driver add name=arl an io=0xD000 [admin@MikroTik]> driver print Flags: I - invalid, D - dynamic # DRIVER IRQ IO PROTOCOL 0 D RealTek 8139 1 Arlan 655 0xD000 [admin@MikroTik] driver>

MEMORY

ISDN -

Wireless Interface Configuration


Submenu level: /interface arlan

Description
The wireless card status can be obtained from the two LEDs: the Status LED and the Activity LED. Status Activity Description Amber Amber ARLAN 655 is functional but nonvolatile memory is not configured Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 235

Blinking Green Green Green Red Red

Don't Care Off Green Flash Amber Red

ARLAN 655 not registered to an AP (ARLAN mode only) Normal idle state Normal active state Hardware failure Radio failure

Property Description
name (name; default: arlanN) - assigned interface name mtu (integer; default: 1500) - Maximum Transmission Unit mac-address (MAC address) - Media Access Control address frequency (2412 | 2427 | 2442 | 2457 | 2465; default: 2412) - channel frequency in MHz bitrate (1000 | 2000 | 354 | 500; default: 2000) - data rate in Kbit/s sid (integer; default: 0x13816788) - System Identifier. Should be the same for all nodes on the radio network. Must be an even number with maximum length 31 character add-name (text; default: test) - card name (optional). Must contain less than 16 characters. arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - Address Resolution Protocol setting tma-mode (yes | no; default: no) - Networking Registration Mode: yes - ARLAN no - NON ARLAN

Example
[admin@MikroTik] > interface print Flags: X - disabled, D - dynamic, R - running # NAME TYPE MTU 0 R outer ether 1500 1 X arlan1 arlan 1500 [admin@MikroTik] interface> enable 1 [admin@MikroTik] > interface print Flags: X - disabled, D - dynamic, R - running # NAME TYPE MTU 0 R outer ether 1500 1 R arlan1 arlan 1500 More configuration and statistics parameters can be found under the /interface arlan menu: [admin@MikroTik] interface arlan> print Flags: X - disabled, R - running 0 R name="arlan1" mtu=1500 mac -address=00:40:96:22:90:C8 arp=enabled frequency=2412 bitrate=2000 tma -mode=no card-name="test" sid=0x13816788 [admin@MikroTik] interface arlan> You can monitor the status of the wireless interface: [admin@MikroTik] interface arlan> monitor 0 registered: no access-point: 00:00:00:00:00:00 backbone: 00:00:00:00:00:00 [admin@MikroTik] interface arlan > Suppose we want to configure the wireless interface to accomplish registration on the AP with a sid 0x03816788. To do this, it is enough to change the argument value of sid to 0x03816788 and tma-mode to yes: Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 236

[admin@MikroTik] interface arlan> set 0 sid=0x 03816788 tma-mode=yes [admin@MikroTik] interface arlan> monitor 0 registered: yes access-point: 00:40:88:23:91:F8 backbone: 00:40:88:23:91:F9 [admin@MikroTik] interface arlan>

Troubleshooting
Description
Keep in mind, that not all c ombinations of I/O base addresses and IRQs may work on particular motherboard. It is recommended that you choose an IRQ not used in your system, and then try to find an acceptable I/O base address setting. As it has been observed, the IRQ 5 and I/O 0x300 o r 0x180 will work in most cases. The driver cannot be loaded because other device uses the requested IRQ. Try to set different IRQ using the DIP switches. The requested I/O base address cannot be used on your motherboard. Try to change the I/O base addre ss using the DIP switches. The pc interface does not show up under the interfaces list Obtain the required license for 2.4/5GHz Wireless Client feature. The wireless card does not register to the Access Point Check the cabling and antenna alignment.

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

237

BAB XXVI Ethernet Interfaces


General Information
Summary
MikroTik RouterOS supports various types of Ethernet Interfaces. The complete list of supported Ethernet NICs can be found in the Device Driver List.

Specifications
Packages required: system License required: Level1 Submenu level: /interface ethernet Standards and Technologies: IEEE 802.3 Hardware usage: Not significant

Related Documents
Package Management Device Driver List IP Addresses and ARP DHCP Client and Server

Additional Resources
http://www.ethermanage.com/ethernet/ethernet.html http://www.dcs.gla.ac.uk/~liddellj/nct/ethernet_proto col.html

Ethernet Interface Configuration


Submenu level: /interface ethernet

Property Description
name (name; default: etherN) - assigned interface name, whrere 'N' is the number of the ethernet interface arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - Address Resolution Protocol cable-setting (default | short | standard; default: default) - changes the cable length setting (only applicable to NS DP83815/6 cards) default - suport long cables short - support short cables standard - same as default mtu (integer; default: 1500) - Maximum Transmission Unit disable-running-check (yes | no; default: yes) - disable running check. If this value is set to 'no', the router automatically detects whether the NIC is connected with a devic e in the network or not mac-address (MAC address) - set the Media Access Control number of the card auto-negotiation (yes | no; default: yes) - when enabled, the interface "advertises" its maximum capabilities to achieve the best connection possible Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 238

full-duplex (yes | no; default: yes) - defines whether the transmission of data appears in two directions simultaneously speed (10 Mbps | 100 Mbps | 1 Gbps) - sets the data transmission speed of the interface. By default, this value is the maximal data rate supported by the interface

Notes
For some Ethernet NICs it is possible to blink the LEDs for 10s. Type /interface ethernet blink ether1 and watch the NICs to see the one which has blinking LEDs. When disable-running-check is set to no, the router automatically detects whether the NIC is connected to a device in the network or not. When the remote device is not connected (the leds are not blinking), the route which is set on the specific interface, becomes invalid.

Example
[admin@MikroTik] > interface print Flags: X - disabled, D - dynamic, R - running # NAME TYPE RX -RATE TX-RATE MTU 0 X ether1 ether 0 0 1500 [admin@MikroTik] > interface enable ether1 [admin@MikroTik] > interface print Flags: X - disabled, D - dynamic, R - running # NAME TYPE RX -RATE TX-RATE MTU 0 R ether1 ether 0 0 1500 [admin@MikroTik] > interface ethernet [admin@MikroTik] interface ethernet> print Flags: X - disabled, R - running # NAME MTU MAC -ADDRESS ARP 0 R ether1 1500 00:0C:42:03 :00:F2 enabled [admin@MikroTik] interface ethernet> print detail Flags: X - disabled, R - running 0 R name="ether1" mtu=1500 mac -address=00:0C:42:03:00:F2 arp=enabled disable-running-check=yes auto-negotiation=yes full -duplex=yes cable-settings=default speed=100Mbps [admin@MikroTik] interface ethernet>

Monitoring the Interface Status


Command name: /interface ethernet monitor

Property Description
status (link-ok | no-link | unknown) - status of the interface, one of the: link-ok - the card has connected to the network no-link - the card has not connected to the network unknown - the connection is not recognized rate (10 Mbps | 100 Mbps | 1 Gbps) - the actual data rate of the connection auto-negotiation (done | incomplete) - fast link pulses (FLP) to the adjacent link station to negotiate the SPEED and MODE of the link Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com 239

done - negotiation done incomplete - negotiation failed full-duplex (yes | no) - whether transmission of data occurs in two directions simultaneously

Notes
See the IP Addresses and ARP section of the manual for information how to add IP addresses to the interfaces.

Example
[admin@MikroTik] interface ethernet> monitor ether1,ether2 status: l ink-ok link-ok auto-negotiation: done done rate: 100Mbps 100Mbps full-duplex: yes yes

Troubleshooting
Description
Interface monitor shows wrong information In some very rare cases it is possible that the device driver does not show correct information, but it does not affect the NIC's performance (of course, if your card is not broken)

SELAMAT MENCOBA SEMOGA SUKSES SELALU AMIIIN

Buku Panduan Praktikum Ja ingan komputer 2 (MikroTikOS) Stmik Sinar Nusantara Surakarta by Kus Referensi : Download :www.mikrotik.com

240

You might also like