Professional Documents
Culture Documents
MikroTik RouterOS V5 中文教程
MikroTik RouterOS V5 中文教程
RouterOS 9
RouterOS
RouterOS MikroTik
Mikrotikls SIAwww.mikrotik.com/www.RouterOS.com MikroTik
RouterOS WLAN
RouterOS
WLAN RouterOS 802.11abgn
Nstrem Nv2
RouterOS RouterOS
VPN RouterOS WLAN
2005
RouterOS
2003 RouterOS 8 , RouterOS RouterOS
RouterOS
WLAN RouterOS
Simple QueuePCQ HTB
RouterOS RouterOS
RouterOS 2006
RouterOS RouterOS
3 RouterOS WLAN
Script
RouterOS 2007 16 RouterOS PPPoE
2 23000 12650 2.4G
2.9 v5.0
CPU RouterOS
MikroTik
1995 WISP
1996 ISP
2002 RouterBOARD
WLAN WLAN
WDS Mesh MikroTik WLAN
- YuSong
-1-
RouterOS
:
:
:
E-mail:
V5.0
RouterOS v3.xv4.xv5.x
yus_sds@yahoo.com.cn
RouterOS
-------------------------------------------------------
10
RouterOS
RouterOS
CLI
-------------------------------------------------------------------
42
RouterOS
RouterOS
RouterOS
RouterOS
RouterBOARD
RouterOS
Supout.rif
64
RouterBOARD
RouterBOARD Throughput
RouterBOARD
Interface-------------------------------------------------------
70
Interface
RouterBOARD
IP ARP--------------------------------------------------------------
74
IP
ARP
ARP
ARP
ARP
(Route)
---------------------------------------------------------
79
ADSL
PPTP
RouterOS PCC
DHCP -----------------------------------------------------------------
107
DHCP-client
DHCP-server
DNS
-----------------------------------------------------------------
- YuSong
-2-
111
RouterOS
DNS
113
RouterOS
P2P
RouterOS 7
DMZ
126
Queue -------------------------------------------------------
131
Queue
Queue
Simple Queue
HTB
Queue tree
PCQ
HTB PCQ
PCQ HTB
Connection Rate
nat -------------------------------------------------------
173
nat
nat
nat
Mangle -----------------------------------------------------
180
Mangle
Mangle
182
Passthrough Nth
Nth
Nth
Bridge-----------------------------------------------------------
189
VRRP --------------------------------------------------------------------
208
VRRP
VRRP
Hotspot ----------------------------------------------------------------Hotspot
HotSpot
Hotspot
HTTP Walled Garden
IP Walled Garden
IP
Hotspot
HotSpot
- YuSong
-3-
211
RouterOS
Hotspot
Hotspot
Hotspot
HotSpot
PPPoE --------------------------------------------------------------
234
PPPoE Client
PPPoE Server
ADSL
802.11g PPPoE
Winbox PPPoE
PPPoE
PPTP --------------------------------------------------------------------
246
PPTP
PPTP
PPTP
257
PPTP L2TP
VPN
Open VPN-------------------------------------------------------------
262
OVPN
OVPN bridge
SSTP ------------------------------------------------------------------
273
SSTP
EoIP --------------------------------------------------------------
279
EoIP
EoIP
IPSec -------------------------------------------------------------
284
IPSec
Windows L2TP/IPsec
Bonding---------------------------------------------------------------
302
2 EoIP Bonding
VLAN ------------------------------------------------------------------
307
VLAN
VLAN
VLAN PPPoE
web ---------------------------------------------------------------
311
HTTP
Web
MetaRotuer ----------------------------------------------------------
320
MetaRouter
MetaRouter
log ------------------------------------------------------------
- YuSong
-4-
330
RouterOS
Logging
Dude
Log
335
RouterOS U
log
Web-Proxy U
Store
IP --------------------------------------------------------
342
IP
IP
Web IP
Scheduler---------------------------------------------------
345
RouterOS ----------------------------------------------------1Netwatch
2Graphing
3Bandwidth-text
4Torch ()
5E-mail
Level 0
Level3
Level 4
Level 5
Level 6
24
4.x
4.x
5.x
6.x
AP
24
24
RIPOSPFBGP
24
EoIP
24
PPTP
24
200
PPPoE
24
200
500
L2TP
24
200
OVPN
24
200
SSTP
24
200
Hotspot 24
200
500
VLAN
24
P2P
24
NAT
24
Radius
24
Queue
24
Web
24
10
20
50
User Manager 24
- YuSong
-5-
348
RouterOS
x86
AMDIntelVIA x86
MIPS
RAM 16MiB
PPC
RouterBOARD1000RouterBOARD1100RouterBOARD800RouterBOARD600RouterBOARD333
Netinstall: windows U
CD
MAC
WinBox GUI
API
Exprot import
Firewall
Statefull filtering
NAT
IP IP DSCP
- YuSong
-6-
RouterOS
Layer7
IPv6
PCC
Nth -
ECMP
(BFD)
MPLS
IPv4
IPv4
RSVP
VPLS MP-BGP
VPN
(OpenVPNPPTPPPPoEL2TPSSTP)
PPP (MLPPPBCP)
(IPIPEoIP)
MPLS VPN
Wireless
IEEE802.11a/b/g AP
IEEE802.11n
Nstreme Nstreme2
(WDS)
AP
WMM
HWMP+ Mesh
MME
DHCP
- YuSong
-7-
RouterOS
DHCP
DHCP
DHCP
RADIUS
DHCP
Hotspot
web
RADIUS
QoS
(HTB)QoS
(PCQ)
Proxy
HTTP
HTTP
SOCKS
DNS
Ping, traceroute
sniffer , torch
Telnet, ssh
E-mail SMS
Fetch
DDNS
NTP / GPS
VRRP
SNMP
M3P MikroTik
RADIUS
- YuSong
-8-
RouterOS
TFTP
Synchronous ( Farsync )
ISDN
undo/redo
Scripts
- YuSong
-9-
RouterOS
RouterOS
1.1 RouterOS
1 ISO x86 AMDIntelVIA X86
IDESATA
2 U X86 3.0
3 netinstall RouterBOARDRB100RB300RB500RB400RB600
RB700RB800RB1000
CD
CD MikroTik RouterOS PC x86 PC
Netinstall RouterBOARD Netinstall
CD
o
PC x86
CD-ROM
CD
MikroTik RouterOS
1. MikroTik ,
- YuSong
- 10 -
RouterOS
2. ISO PC CD-ROM CD
4. PC RouterOS CD
- YuSong
- 11 -
RouterOS
5. am
i RouterOS PC RouterOS
Do you want to keep old configuration?ny
6.
- YuSong
- 12 -
RouterOS
8. RouterOS admin
- YuSong
- 13 -
RouterOS
USB
U 3.0 netinstall U Windows USB Netinstall
RouterOS-X86
Netinstall RouterOS U
- YuSong
- 14 -
RouterOS
U U PC BIOS USB
NetInstall RouterRoard
RouterBOARD
RouterBOARD RouterOS
RouterBOARD RouterOS
1. ether1 RouteBoard
RouterBoard
- YuSong
- 15 -
RouterOS
2. Windows 115200 PC
9600 vista WIN 7 windows xp
vista win 7 hypertrm.dll hypertrm.exe
- YuSong
- 16 -
RouterOS
RouterBOOT-2.20
What do you want to configure?
d - boot delay
k - boot key
s - serial console
o - boot device
u - cpu mode
f - cpu frequency
r - reset booter configuration
e - format nand
g - upgrade firmware
i - board info
p - boot protocol
t - do memory testing
x - exit setup
your choice:
- YuSong
- 17 -
RouterOS
e RouterBoard
Select boot device:
e - boot over Ethernet
* n - boot from NAND, if fail then Ethernet
1 - boot Ethernet once, then NAND
o - boot from NAND only
b - boot chosen device
your choice: e - boot over Ethernet
- YuSong
- 18 -
RouterOS
mac-address: 00:0C:42:3E:8E:A8
mac-address: 00:0C:42:3E:8E:A9
mac-address: 00:0C:42:3E:8E:AA
mac-address: 00:0C:42:3E:8E:AB
mac-address: 00:0C:42:3E:8E:AC
- YuSong
- 19 -
RouterOS
mac-address: 00:0C:42:3E:8E:A8
mac-address: 00:0C:42:3E:8E:A9
mac-address: 00:0C:42:3E:8E:AA
mac-address: 00:0C:42:3E:8E:AB
mac-address: 00:0C:42:3E:8E:AC
Formatting disk......
Netinstall
6. Reboot
- YuSong
- 20 -
RouterOS
1.2 RouterOS
RouterOS RouterOS RouterOS
1Console
RouterBOARD Console Console
2
PC DB9 PC 9600 bits/s
(RouterBOARD 115200 bits/s), windows
SecureCRTUNIX/Linux minicom
Console Console PC windows linux
- YuSong
- 21 -
RouterOS
PC RouterOS
RouterOS
Null-modem
:
- YuSong
- 22 -
RouterOS
MikroTik Router
COM windows
HyperTerminal
PC RouterOS DB9
Signal
Direction
Side (DB9f)
1, 6
CD, DSR
IN
RxD
IN
TxD
OUT
DTR
OUT
1, 6
GND
RTS
OUT
CTS
IN
RouterBOARD
DB9f
DB9f
DB25f
1+4+6
CD+DTR+DSR
1+4+6
6+8+20
RxD
xD
GND
7+8
RTS+CTS
7+8
4+5
MikroTik RouterOS
- YuSong
- 23 -
RouterOS
winbox
IP
IP RouterOS
MAC 100%
3.+
RouterOS PC +(RouterBOARD
1 2)
MikroTik v5.0
Login:
MMM
KKK
TTTTTTTTTTT
KKK
MMMM
MMMM
KKK
TTTTTTTTTTT
KKK
- YuSong
- 24 -
RouterOS
TTT
TTT
III KKKKK
MMM
RRRRRR
OOO OOO
TTT
MMM
OOOOOO
TTT
OOOOOO
http://www.mikrotik.com/
Winbox web
MikroTik RouterOS Telnet, SSH, WinBox Webbox
WinBox
MAC-telnet IP MAC
MAC-telnet
: Winbox MAC
MAC RouterOS
winbox2.2.12 MAC IP
Winbox MikroTik RouterOS GUI MikroTik
HTTPTCP 80 Winbox.exe Windows
Windows Winbox.exe
:
- YuSong
- 25 -
RouterOS
IP 80
MAC
wbx wbx
- YuSong
- 26 -
RouterOS
Keep Password
Winbox
Winbox
- YuSong
- 27 -
RouterOS
Linux Winbox
Wine Winbox RouterOS
Winbox
/ip service print www
Webbox
RouterOS IP http://RouterIP RouterOS
web RouterOS webbox
- YuSong
- 28 -
RouterOS
- YuSong
- 29 -
RouterOS
.,
mac .
Disabled (disabled=yes) mac . all
interfaces mac .
ether1 interface mac :
[admin@MikroTik] tool mac-server> print
Flags: X - disabled
#
INTERFACE
all
INTERFACE
ether1
- YuSong
- 30 -
RouterOS
, mac .
Disabled (disabled=yes) mac .
ether1 MAC
[admin@MikroTik] tool mac-server mac-winbox> print
Flags: X - disabled
#
INTERFACE
all
INTERFACE
ether1
interface (: name)
src-address (: MAC address) mac
uptime (: )
mac :
[admin@MikroTik] tool mac-server sessions> print
# INTERFACE SRC-ADDRESS
0 wlan1
UPTIME
00:0B:6B:31:08:22 00:03:01
MAC telnet
: /tool mac-telnet
(MAC address) mac
MAC RouterOS
[admin@MikroTik] > /tool mac-telnet 00:02:6F:06:59:42
Login: admin
Password:
Trying 00:02:6F:06:59:42...
Connected to 00:02:6F:06:59:42
- YuSong
- 31 -
RouterOS
MMM
MMM
KKK
TTTTTTTTTTT
KKK
MMMM
MMMM
KKK
TTTTTTTTTTT
KKK
OOOOOO
TTT
MMM MM MMM
III KKKKK
TTT
III KKKKK
MMM
MMM
RRRRRR
OOO OOO
TTT
MMM
MMM
OOOOOO
TTT
http://www.mikrotik.com/
[admin@MikroTik] >
[admin@MikroTik] interface>/ip address
[admin@MikroTik] ip address>
[admin@MikroTik] >
log/ --
quit
radius/ -- Radius
certificate/ --
special-login/ --
redo
driver/ --
ping ping
setup
interface/ --
password
undo
port/ --
import
snmp/ -- SNMP
user/ --
file/ --
system/ --
queue/ --
ip/ -- IP
tool/ --
ppp/ --
- YuSong
- 32 -
RouterOS
routing/ --
export --
[admin@MikroTik] >
[admin@MikroTik] ip>
..
service/ -- IP
socks/ -- SOCKS 4
arp/ -- ARP
upnp/ -- UPNP
dns/ -- DNS
address/ --
accounting/ --
the-proxy/ -vrrp/ --
pool/ -- IP
packing/ --
neighbor/ --
route/ --
firewall/ --
dhcp-client/ -- DHCP
dhcp-relay/ -- DHCP
dhcp-server/ -- DHCP
hotspot/ -- HotSpot
ipsec/ -- IP
web-proxy/ -- HTTP
export -[admin@MikroTik] ip>
[admin@MikroTik] >
| 'driver'
[admin@MikroTik] driver> /
| '/'
| 'interface'
| '/ip' IP
[admin@MikroTik] ip>
interface in int[Tab]
IP
IP
- YuSong
- 33 -
RouterOS
Command
command [Enter]
[?]
command [?]
/ [Tab]
/command
..
""
IP 'address''netmask' IP
Interface Management
IP /interface
/interface print
[admin@MikroTik] interface> print
Flags: X - disabled, D - dynamic, R - running
#
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 R ether1
ether
1500
1 R ether2
ether
1500
2 X wavelan1
wavelan
1500
3 X prism1
wlan
1500
[admin@MikroTik] interface>
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 X ether1
ether
1500
1 X ether2
ether
1500
- YuSong
- 34 -
RouterOS
[admin@MikroTik] interface> print
Flags: X - disabled, D - dynamic, R - running
#
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 R ether1
ether
1500
1 R ether2
ether
1500
[admin@MikroTik] interface>
/interface set
[admin@MikroTik] interface> set ether1 name=Local; set ether2 name=Public
[admin@MikroTik] interface> print
Flags: X - disabled, D - dynamic, R - running
#
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 R Local
ether
1500
1 R Public
ether
1500
[admin@MikroTik] interface>
add IP
[admin@Office] /ip address> prin
Flags: X - disabled, I - invalid, D - dynamic
#
ADDRESS
NETWORK
BROADCAST
10.200.15.1/24
10.200.15.0
10.200.15.255
lan
0.0.0.0
ADSL
1 D 222.212.60.227/32 222.212.48.1
INTERFACE
ADDRESS
10.200.15.1/24
NETWORK
10.200.15.0
BROADCAST
10.200.15.255
INTERFACE
lan
1 D 222.212.60.227/32 222.212.48.1
0.0.0.0
ADSL
192.168.10.255
lan
192.168.10.1/24
192.168.10.0
remove
[admin@Office] /ip firewall filter> prin
Flags: X - disabled, I - invalid, D - dynamic
- YuSong
- 35 -
RouterOS
[admin@Office] /ip firewall filter>
Setup
/setup
IP
DHCP
DHCP
pppoe
pptp
Setup IP /setup
[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 already configured.
Entries marked by '-' cannot be used yet.
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
IP a [Enter]
* a - add ip address
- g - setup default gateway
x - exit menu
your choice [press Enter to add ip address]: a
a IP IP
[Tab] IP
your choice: a
enable interface:
- YuSong
- 36 -
RouterOS
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 gateway
x - exit menu
your choice: x
1.4 RouterOS
MikroTik router
192.168.0.0 24-bit255.255.255.0
192.168.0.254
ISP 10.0.0.0 24-bit255.255.255.0 10.0.0.217
DNS 61.139.2.69202.98.68.96
interface
IP
- YuSong
- 37 -
RouterOS
nat
DNS
ether2 ether2-lan
IP
/ip address IP IP
- YuSong
- 38 -
RouterOS
NAT
/ip firewall nat +
- YuSong
- 39 -
RouterOS
action action=masquerade
DNS
/ip dns settings DNS DNS allow remote requests
- YuSong
- 40 -
RouterOS
- YuSong
- 41 -
RouterOS
2.1 RouterOS
- YuSong
- 42 -
RouterOS
RouterOS
/system backup
Save /file /system
backup load
load name=[filename]
save name=[filename]
test
[admin@MikroTik] system backup> save name=test
Saving system configuration
Configuration backup saved
[admin@MikroTik] system backup>
TYPE
backup
SIZE
12567
CREATION-TIME
aug/12/2002 21:07:50
[admin@MikroTik] >
test:
[admin@MikroTik] system backup> load name=test
Restore and reboot? [y/N]: y
...
Winbox files backup restore
- YuSong
- 43 -
RouterOS
Export
export
Export export file
FTP winbox
from=[number]
file=[filename]
ADDRESS
NETWORK
BROADCAST
INTERFACE
10.1.0.172/24
10.1.0.0
10.1.0.255
bridge1
10.5.1.1/24
10.5.1.0
10.5.1.255
ether1
[admin@MikroTik] >
TYPE
script
SIZE
315
CREATION-TIME
dec/23/2003 13:21:48
[admin@MikroTik] >
- YuSong
- 44 -
RouterOS
/import
import /import file_name ip
firewall filterqueue simple
file=[filename]
- YuSong
- 45 -
RouterOS
/system> reset-configuration
adminIP
reset RouterOS v3.x ether1 IP
192.168.88.1/24
2.2
/system reboot
: /system shutdown
- YuSong
- 46 -
RouterOS
10 5
[admin@MikroTik] > system shutdown
Shutdown, yes? [y/N]: y
system will shutdown promptly
[admin@MikroTik] >
2.3 RouterOS
: /system identity
DHCP host name
Wlan SSID :
[admin@MikroTik] > system identity print
name: "MikroTik"
[admin@MikroTik] >
2.4
/system resource
RouterOS
monitor
CPU
- YuSong
- 47 -
RouterOS
[admin@MikroTik] system resource>
CPU
[admin@MikroTik] > system resource monitor
cpu-used: 0
free-memory: 115676
[admin@MikroTik] >
winbox
- YuSong
- 48 -
RouterOS
IRQ
: /system resource irq print
IRQ
[admin@MikroTik] > system resource irq print
Flags: U - unused
IRQ OWNER
1
keyboard
APIC
- YuSong
- 49 -
RouterOS
U 3
4
serial port
U 6
U 7
U 8
U 9
U 10
11 ether1
12 [Ricoh Co Ltd RL5c476 II]
U 13
14 IDE 1
[admin@MikroTik] >
IO
: /system resource io print
IO (Input/Output)
[admin@MikroTik] > system resource io print
PORT-RANGE
OWNER
0x20-0x3F
APIC
0x40-0x5F
timer
0x60-0x6F
keyboard
0x80-0x8F
DMA
0xA0-0xBF
APIC
0xC0-0xDF
DMA
0xF0-0xFF
FPU
0x1F0-0x1F7
IDE 1
0x2F8-0x2FF
serial port
0x3C0-0x3DF
VGA
0x3F6-0x3F6
IDE 1
0x3F8-0x3FF
serial port
0xCF8-0xCFF
[PCI conf1]
0x4000-0x40FF
0x4400-0x44FF
0x4800-0x48FF
0x4C00-0x4CFF
0x5000-0x500F
0xC000-0xC0FF
0xC000-0xC0FF
[8139too]
0xC400-0xC407
0xC800-0xC87F
0xF000-0xF00F
[admin@MikroTik] >
USB
- YuSong
- 50 -
RouterOS
NAME
SPEED
12 Mbps
PCI
: /system resource pci print
category (: )
device (: )
device-id (: ) ID
irq (: ) IRQ
memory (: )
name (: )
vendor (: )
vendor-id (: )
PCI
[admin@MikroTik] system resource pci> print
# DEVICE
VENDOR
0 00:13.0 Compaq
NAME
IRQ
AR5212 (rev: 1)
10
2.5 Watchdog
- YuSong
- 51 -
RouterOS
Watchdog
: system
: Level1
: /system watchdog
IP ,
() . RouterBOARD
RouterOS CPU
/system hardware
CPU hardware CPU x86
CPU CPU
[admin@MikroTik] > system hardware
- YuSong
- 52 -
RouterOS
[admin@MikroTik] /system hardware>
.. / : edit export get print set
[admin@MikroTik] /system hardware> set multi-cpu=yes ;
[admin@MikroTik] /system hardware> prin
multi-cpu: yes
[admin@MikroTik] /system hardware>
RouterOS
advanced-tools (mipsle,
mipsbe, ppc, x86)
HotSpot
- YuSong
- 53 -
RouterOS
x86)
mpls (mipsle, mipsbe, ppc,
x86)
x86)
routerboard (mipsle,
mipsbe, ppc, x86)
routing (mipsle, mipsbe,
ppc, x86)
security (mipsle, mipsbe,
ppc, x86)
RouterBOOT RouterBOARD
RIP, BGP, OSPF BFD
IPSECSSH winbox
ip sNTPtelnetAPIqueue
ppc, x86)
APC ups
MikroTik User Manager Radius
Wireless 802.11abgn
arlan (x86)
Aironet Arlan
isdn (x86)
ISDN
lcd (x86)
LCD
radiolan (x86)
RadioLan
synchronous (x86)
FarSync
XEN 4.0
kvm (x86)
KVM
routeros-mipsle (mipsle)
- YuSong
- 54 -
RouterOS
routeros-x86 (x86)
: /system package
disable
downgrade
RouterOS
RouterOS
enable
uninstall
unschedule
NAME
VERSION
0 X ipv6
3.13
3.13
system
2 X mpls
3 X hotspot
4
routing
SCHEDULED
3.13
3.13
3.13
- YuSong
- 55 -
RouterOS
5
wireless
6 X dhcp
7
routerboard
routeros-mipsle
security
10 X ppp
11
advanced-tools
3.13
3.13
3.13
3.13
3.13
3.13
3.13
RouterOS
[admin@MikroTik] > /system package downgrade;
[admin@MikroTik] >/system reboot;
Reboot, yes? [y/N]:
2.7 RouterOS
BT RouterOS routeros-ALL-3.30
BT
all_packages_mipsbe Atheros RB400 700
all_packages_mipsle RB100 RB500 RB133RB133cRB150RB192RB532MIPS 4Kc
all_packages_ppc RB300RB600RB800 RB1000 RB333RB600RB800RB1000 RB1100 PowerPC
mikrotik-x.x.iso , x86
2.9 BT
all_packages_ns RB100 RB500 RB133RB133cRB150RB192RB532MIPS 4Kc
all_packages_x86 x86 PC AMDIntelVIA x86 PC
- YuSong
- 56 -
RouterOS
2 RouterOS system-x.x.x.npk
system package>
( wirelessPPPoE PPP )
4 System Reboot
- YuSong
- 57 -
RouterOS
RouterOS 1
PC RB
2.8 RouterBOARD
RouterBOARD BOIS RouterBOARD
RouterBOARD .fwf RouterBOARD
www.routerboard.com
RB
RB1000RB1100
mpc8548
RB800
mpc8343
RB600
mpc8343
RB333
mpc8323
ar7100
RB532
rc32434
RB100 112133/C150192
adm5120
- YuSong
- 58 -
RouterOS
[admin@Office] /system routerboard> prin
routerboard: yes
model: "450"
serial-number: "188901ED9E57"
current-firmware: "2.16"
upgrade-firmware: "2.18"
[admin@Office] /system routerboard>
current-firmware 2.16 2.18 RouterOS
file winbox file list RouterBOARD RB450 ar7100
upgrade
[admin@Office] /system routerboard> upgrade
Do you really want to upgrade firmware? [y/n]
y
firmware upgraded successfully, please reboot for changes to take effect!
[admin@Office] /system routerboard>
RouterBOARD
upgrade
2.9 RouterOS
MikroTik RouterOS MikroTik
/
: /ip service
name -
port (: 1..65535) -
laddress (IP ; : 0.0.0.0/0) - IP
certificate (; : none) -
- YuSong
- 59 -
RouterOS
WWW 10.10.10.0/24 8081
[admin@MikroTik] > ip service
[admin@MikroTik] /ip service> prin
Flags: X - disabled, I - invalid
#
NAME
PORT ADDRESS
telnet
23
0.0.0.0/0
ftp
21
0.0.0.0/0
www
80
0.0.0.0/0
3 X www-ssl
443
4 X api
8728 0.0.0.0/0
8291 0.0.0.0/0
winbox
0.0.0.0/0
CERTIFICATE
none
NAME
PORT ADDRESS
telnet
23
0.0.0.0/0
ftp
21
0.0.0.0/0
www
8081 10.10.10.0/24
3 X www-ssl
443
4 X api
8728 0.0.0.0/0
8291 0.0.0.0/0
winbox
0.0.0.0/0
CERTIFICATE
none
[admin@MikroTik] ip service>
MikoTik RouterOS
20/tcp
FTP []
21/tcp
FTP []
22/tcp
SSH ()
23/tcp
53/tcp
DNS
53/udp
DNS
67/udp
DHCP ( dhcp )
68/udp
DHCP ( dhcp )
80/tcp
WWWHTTP
123/udp
NTP ( ntp )
161/udp
SNMP ( snmp )
- YuSong
- 60 -
RouterOS
443/tcp
500/udp
520/udp
RIP ()
521/udp
RIP ( routing )
179/tcp
BGP ( routing )
1080/tcp
SOCKS
1701/udp
1718/udp
1719/tcp
1720/tcp
H.323 ( telephony e)
1723/tcp
PPTP ( ppp )
1731/tcp
H.323 ( telephony )
1900/udp
uPnP
2828/tcp
uPnP
2000/tcp
3986/tcp
Winbox
3987/tcp
winbox SSL ()
5678/udp
8080/tcp
HTTP ( WEB )
8291/tcp
Winbox
20561/udp
MAC winbox
5000+/udp
/1
ICMP
/4
IP - IP in IP (encapsulation)
/47
/50
ESP - IPv4 ()
/51
AH - IPv4 ()
/89
OSPFIGP - OSPF
/112
VRRP
2.10 Supout.rif
- YuSong
- 61 -
RouterOS
Support
Winbox
support Output file Make Supout.rif,
supout files
Console
suppout.rif console
- YuSong
- 62 -
RouterOS
console done.
- YuSong
- 63 -
RouterOS
MikroTik RouterBOARD
RouterBOARD MikroTik RouterOS RouterOS
RouterOScisco IOSMikroTik RouterOS
RouterBOARD
PC RouterOS PC
PC RouterOS
ARMMIPS Intel IXP
Linux FreeBSD RouterOS
PC
RouterBOARD USB 4-5w
PowerPC 5-12w MiniPCI MiniPCI-e
RouterBOARD 3
1 RouterBOARD RouterBOARD RB411RB711
2 RouterBOARD RouterBOARD RB450,RB750RB1100
3 RouterBOARD RB433RB493
RouterBOARD RB
3.1 RouterBOARD
RB RB230 x86 2002
2006 RB112 RB 5 RB100RB300RB400RB500
RB600RB700RB800RB1000RB1100RB1200
2006
RB112RB150RB153RB532RB502 RB133RB133cRB532rc5 RB192
RB RB100 RB500 RB MIPS 4kc
2007
RB333 RB600 PowerPC
2008-2009
RB400 RB411RB433RB450RB493 RB
RB1000 08
2010
- YuSong
- 64 -
RouterOS
2011
RB 711 RBSXT 5G11n 400 RB435G2.4G
11n RB711-2Hn USB POE RB750UP 2.4G 11n RB751 USB RB751U
RB751G RB1100RB1100AH RB1100AH2 RB1200
SFP RB
MiniPCI
WLAN
RB100
RB112
1100M
RB133c
1100M
RB133
3100M
RB150
5100M
RB153
5100M
RB192
9100M
RB502
1100M
RB532
3100M
RB532rc5
3100M
3100M
3100M
802.11bg
RB411
1100M
RB411R
1100M
802.11bg
RB411A
1100M
RB411AR
1100M
802.11bg
RB411U
1100M
1+1pci-e
RB411AH
1100M
RB411UAHR
1100M
1+1pci-e
802.11bg
RB433
3100M
RB433AH
3100M
RB433UAH
3100M
RB435G
31G
RB493AH
9100M
RB493G
91G
RB450
5100M
RB450G
51G
RB600
31G
RB600A
31G
1100M
802.11an
RB500
RB300
RB333
RBCRD
RB/CRD
RB400
RB600
RB700
RB711
- YuSong
- 65 -
RouterOS
RB711A
1100M
802.11an
RB711-2Hn
1100M
802.11bgn
RB750
5100M
RB750G
51G
RB750UP
5100M
RB751
5100M
802.11bgn
RB751U
5100M
802.11bgn
RB751G
51G
802.11bgn
RBSXT
1100M
802.11an
31G
4+1pci-e
RB1000
41G
RB1100
131G
RB1100AH
131G
RB1100AH2
131G
RB1200
1010G
RB800
RB800
RB1000
RB
RB100 -
RB200 -
RB/CRD-
RB300 -
RB400 RB411-RB411A-RB411UAHR-RB411R-
RB500 -
RB600 -
RB1000 RB1000
RouterBOARD RB600RB800 RB1000
RB1XX RB100
RB133 100 3 3 MiniPCI
RB493 400 9 3 MiniPCI
AHA H CPU
G
U USB
R
PPOE
RouterBOARD www.routerboard.com
- YuSong
- 66 -
RouterOS
4 1 20 80
20 80
20 80
4 4 20
80
80
- YuSong
- 67 -
RouterOS
CPU
CPU
64byte ppsper packet seconds
Cisco 3745 64 225018pps 225kpps
RB1100AH 1333MHz 262kpps 400kpps
RouterBOARD
y
64byte CPU
1500byte
512byte CPU
RouterBOARD
http://www.routerboard.com/pdf/routerboard_performance_tests.pdf
RouterBOARD system
Agilent N2X
RouterBOARD 64byte
3.3 RouterBOARD
- YuSong
- 68 -
RouterOS
RB411 RB433
RB411 RB433 miniPCi
RB411 RB433
433
411
RB411AR RB711
RB411AR WiFi RB711 RB711A 5G
RB711/A 5G-a/n 23dBm 5G 2.4G 802.11a
802.11n MiniPCI
RB411R/AR 2.4G 2.4G 5G 802.11bg
RB411R MiniPCI RB411AR 1 MiniPCI
RB711-2Hn 11n WiFi
RB450 RB750
RB450 RB450G 5 CPU 300MHz 680MHz
RB1100
RB1100 13 12
12
RB1100AH RB1100AH2 13
RB1200 CPU RB1100AH 10
- YuSong
- 69 -
RouterOS
Interface
4.1 Interface
interface EthernetwirelessISDN
PPPPPPoEPPTPL2TPSSTPEoIPIPIP Bonding
MikroTik RouterOS VLANBridge
/interface
name ()
status
type (: arlan | bridge | cyclades | eoip | ethernet | farsync | ipip | isdn-client | isdn-server | l2tp-client
| l2tp-server | moxa-c101 | moxa-c502 | mtsync | pc | ppp-client | ppp-server | pppoe-client | pppoe-server
| pptp-client | pptp-server | pvc | radiolan | sbe | vlan | wavelan | wireless | xpeed)
mtu () (bytes)
rx-rate (; : 0)
0 - no limits
tx-rate (; : 0)
0 - no limits
- YuSong
- 70 -
RouterOS
[admin@MikroTik] interface> print
Flags: X - disabled, D - dynamic, R - running
#
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 R ether1
ether
1500
1 R bridge1
bridge
1500
2 R ether2
ether
1500
3 R wlan1
wlan
1500
[admin@MikroTik] interface>
/interface bridge
[admin@MikroTik] /interface bridge> add
[admin@MikroTik] /interface bridge> prin
Flags: X - disabled, R - running
0 R name="bridge1" mtu=1500 arp=enabled mac-address=00:00:00:00:00:00
protocol-mode=none priority=0x8000 auto-mac=yes
admin-mac=00:00:00:00:00:00 max-message-age=20s forward-delay=15s
transmit-hold-count=6 ageing-time=5m
[admin@MikroTik] /interface bridge>
4.2
/interface monitor-traffic
0
0bps
1
4.3 Ethernet
MikroTik RouterOS mikrotik.com.cn
system
Level1
/interface ethernet
: IEEE 802.3
- YuSong
- 71 -
RouterOS
/interface ethernet
: Auto-negotiation
2: Gigabit auto-negotiation
bandwidth(/: unlimited/unlimited) rx/tx
RouterBOARD
cable-setting (default | short | standard; : default) ( NS DP83815/6
)
disable-running-check (yes | no; : yes)
no
full-duplex (yes | no; : yes)
l2mtu (; : )
mac-address (MAC; : )
master-port (name | none; : none)
mdix-enable (yes | no; : ) MDI/X
mtu (integer; : 1500)
name (string; : )
speed (10Mbps | 100Mbps | 1Gbps; : )
interface
- YuSong
- 72 -
RouterOS
/interface ethernet monitor
Monitor link-ok :
[admin@MikroTik] interface ethernet> monitor ether1,ether2
status: link-ok link-ok
auto-negotiation: done
done
yes
mac
[admin@MikroTik] interface ethernet>set 0 mac-address=00:0C:42:03:11:0A
4.4 RouterBOARD
RB100 RB400 RB700 Master
bridge CPU
RB450 5 ether3ether4 ether2
- YuSong
- 73 -
RouterOS
interface
IP ARP
IP TCP/IP IP
ARP
system
Level1
/ip address, /ip arp
IP, ARP
- YuSong
- 74 -
RouterOS
5.1 IP
/ip address
Internet (Host) IP IP Internet
IP 32 4 8 0255
IP IP
RouterOS IP IP
RouterOS 2.8 IP
/ip address print detail
MikroTik RouterOS
Static
IP 10.10.10.1/24
ether2
ADDRESS
NETWORK
BROADCAST
INTERFACE
2.2.2.1/24
10.5.7.244/24
2.2.2.0
10.5.7.0
2.2.2.255
10.5.7.255
ether2
10.10.10.1/24
10.10.10.0
10.10.10.255
ether1
ether2
[admin@MikroTik] ip address>
5.2 ARP
/ip arp
- YuSong
- 75 -
RouterOS
IP MAC
OSI IP MAC ARP ARP
ARP ARP
address (IP ) IP
interface () IP
mac-address (MAC ; : 00:00:00:00:00:00) MAC
ARP 8192.
ARP arp=disabled ARP
ARP arp IP MAC windows
C:\> arp -s 10.5.8.254 00-aa-00-62-c6-09
arp reply-only ARP MAC /ip arp
ARP
ADDRESS
0 D 2.2.2.2
MAC-ADDRESS
INTERFACE
00:30:4F:1B:B3:D9 ether2
1 D 10.5.7.242
00:A0:24:9D:52:A4 ether1
06:21:00:56:00:12 ether2
10.10.10.10
[admin@MikroTik] ip arp>
ARP arp 'reply-only'
/interface
[admin@MikroTik] ip arp> /interface ethernet set ether2 arp=reply-only
[admin@MikroTik] ip arp> print
Flags: X - disabled, I - invalid, H - DHCP, D - dynamic
#
ADDRESS
MAC-ADDRESS
INTERFACE
0 D 10.5.7.242
00:A0:24:9D:52:A4 ether1
06:21:00:56:00:12 ether2
10.10.10.10
[admin@MikroTik] ip arp>
5.3 ARP
Atheros Prism (wireless), Aironet (PC), WaveLAN
ARP ARP
ARP ARP (ProxyARP) ARP
- YuSong
- 76 -
RouterOS
Router
admin@MikroTik] ip arp> /interface ethernet print
Flags: X - disabled, R - running, S slave
#
NAME
0 R ether1
MTU
MAC-ADDRESS
ARP
MA.. SWITCH
none 0
NAME
0 R ether1
1
prism1
prism
2 D pppoe-in25
pppoe-in
3 D pppoe-in26
pppoe-in
TYPE
MTU
ether
1500
1500
ADDRESS
10.0.0.217/24
NETWORK
10.0.0.0
BROADCAST
INTERFACE
10.0.0.255
eth-LAN
1 D 10.0.0.217/32
10.0.0.230
0.0.0.0
pppoe-in25
2 D 10.0.0.217/32
10.0.0.231
0.0.0.0
pppoe-in26
DST-ADDRESS
0 S 0.0.0.0/0
G GATEWAY
DISTANCE INTERFACE
r 10.0.0.1
eth-LAN
1 DC 10.0.0.0/24
r 0.0.0.0
eth-LAN
2 DC 10.0.0.230/32
r 0.0.0.0
pppoe-in25
3 DC 10.0.0.231/32
r 0.0.0.0
pppoe-in26
[admin@MikroTik] ip arp>
- YuSong
- 77 -
RouterOS
5.4 ARP
IP IP MAC
Address resolution protocol (ARP) IP ARP ARP
IP MAC ARP IP MAC ARP
ARP ARP ARP
IP ARP
1. WinBox ARP ARP
ARP
2. ether1-lan interface ARP arp=reply-only
- YuSong
- 78 -
RouterOS
ARP
/ip arp LAN ARP
ARP
:foreach i in [/ip arp find dynamic=yes interface=LAN] do={
/ip arp add copy-from=$i}
LAN disabled
ARP arp=disabled ARP
ARP arp IP MAC windows
[admin@MikroTik] ip arp> /interface ethernet set LAN arp=disabled
IP Windows
C:\> arp -s 10.5.8.254 00-aa-00-62-c6-09
windows .dat
Route
RouterOS
- YuSong
- 79 -
RouterOS
: system
: Level1
: /ip route, /ip route rules
6.1 RouterOS
RouterOS
IP
IP
TCP UDP
Nth PCC
IP
RouterOS
IP PPPoE-Client
PPTP-Client DHCP-Client
IP
PPPoE-ClientPPTP-Client DHCP-Client
RIP OSPF
Equal-Cost Multi-Path
Routing 10
Equal-Cost Multi-Path Routing
N
IP IP
PCCPer connection classified
Nth
- YuSong
- 80 -
RouterOS
RouterOS
routing-mark
address-list routing-mark
: /ip route
IP 10.1.12.0/24 0.0.0.0/0
[admin@MikroTik] ip route> add dst-address=10.1.12.0/24 gateway=192.168.0.253
[admin@MikroTik] ip route> add gateway=10.5.8.1
[admin@MikroTik] ip route> print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
#
DST-ADDRESS
0 A S 10.1.12.0/24
G GATEWAY
DISTANCE INTERFACE
r 192.168.0.253
Local
1 ADC 10.5.8.0/24
Public
2 ADC 192.168.0.0/24
Local
3 A S 0.0.0.0/0
r 10.5.8.1
Public
[admin@MikroTik] ip route>
6.2
www.mikrotik.com.cn
import
[admin@MikroTik] > import cnc1.rsc
- YuSong
- 81 -
RouterOS
6.3
distance distance 1
2
- YuSong
- 82 -
RouterOS
- YuSong
- 83 -
RouterOS
6.4
192.168.10.2-192.168.10.127 A IP B
IP 127 B
RouterOS address-list IP
IP A IP B
1 IP
2 ip firewall address-list
3 ip firewall mangle src-address-list
4 ip route
1 IP A BA IP 172.16.0.2
172.16.0.1B IP 10.200.15.20 10.200.15.1
ip route A 172.16.0.1
- YuSong
- 84 -
RouterOS
2 IP ip firewall address-list
odd IP
- YuSong
- 85 -
RouterOS
ip
4 ip route IP B
- YuSong
- 86 -
RouterOS
gateway=10.200.15.1 routing-mark=odd
IP B 10.200.15.1 IP A 172.16.0.1
6.5 ADSL
Internet
2M
ADSL
2M NAT 3 WAN1 WAN2
ADSL LAN
WAN1 WAN2 IP ADSL PPPoE
- YuSong
- 87 -
RouterOS
ADSL
/interface pppoe-client ADSL
/interface pppoe-client add name pppoe-line1 service CHN-Telecom/ user c999@166 password
123 interface WAN2 use-peer-dns yes mtu 1942 mru 1942
ADDRESS
NETWORK
BROADCAST
INTERFACE
61.193.77.77/24
61.193.77.0
61.193.77.255
WAN1
D 1
218.88.32.10/24
218.88.32.1
0.0.0.0
pppoe-out1
[admin@MikroTik] ip address>
192.168.0.1/24
[admin@MikroTik] ip address> add address 192.168.0.1/24 interface LAN
[admin@MikroTik] ip address> print
Flags: X - disabled, I - invalid, D - dynamic
#
ADDRESS
61.193.77.77/24
61.193.77.0
61.193.77.255
WAN1
D 1
218.88.32.10/24
218.88.32.1
0.0.0.0
pppoe-out1
192.168.0.1/24
NETWORK
192.168.0.0
BROADCAST
192.168.0.255
INTERFACE
LAN
[admin@MikroTik] ip address>
61.193.77.1
[admin@MikroTik] ip route> add gateway=61.193.77.1
[admin@MikroTik] ip route> print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
#
DST-ADDRESS
0 ADC 61.193.77.0/24
1 ADC 218.88.32.1/32
2 ADC 192.168.0.0/24
PREFSRC
G GATEWAY
DISTANCE INTERFACE
61.193.77.77
WAN1
218.88.32.10
pppoe-out1
192.168.0.1
3 A S 0.0.0.0/0
LAN
r 61.193.77.1
WAN1
[admin@MikroTik] ip route>
www.mikrotik.com.cn
- winbox Terminal
Terminalpaste
.rsc files import
218.88.32.1 IP
218.88.32.1 Terminal
- YuSong
- 88 -
RouterOS
[hcf@NAT] ip route> prin
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
#
DST-ADDRESS
PREFSRC
G GATEWAY
DIS
INTERFACE
0 ADC 61.193.77.0/24
61.193.77.77
WAN1
1 ADC 218.88.32.1/32
218.88.32.10
pppoe-out1
2 ADC 192.168.0.0/24
192.168.0.1
LAN
3 A S 0.0.0.0/0
r 61.193.77.1
4 A S 218.4.0.0/15
r 218.88.32.1
pppoe-out1
WAN1
5 A S 218.6.0.0/16
r 218.88.32.1
pppoe-out1
6 A S 218.13.0.0/16
r 218.88.32.1
pppoe-out1
7 A S 218.14.0.0/15
r 218.88.32.1
pppoe-out1
8 A S 218.16.0.0/14
r 218.88.32.1
pppoe-out1
9 A S 218.20.0.0/16
r 218.88.32.1
pppoe-out1
10 A S 218.21.0.0/17
r 218.88.32.1
pppoe-out1
11 A S 218.22.0.0/15
r 218.88.32.1
pppoe-out1
12 A S 218.30.0.0/15
r 218.88.32.1
pppoe-out1
13 A S 218.62.128.0/17
r 218.88.32.1
pppoe-out1
14 A S 218.63.0.0/16
r 218.88.32.1
pppoe-out1
15 A S 218.64.0.0/15
r 218.88.32.1
pppoe-out1
16 A S 218.66.0.0/16
r 218.88.32.1
pppoe-out1
.....
/tool netwatch
Network
,
222.212.48.1
6.6 http
MikroTik RouterOS
- YuSong
- 89 -
RouterOS
- YuSong
- 90 -
RouterOS
6.7 PPTP
- YuSong
- 91 -
RouterOS
A B
PPTP A
A B 10ms
B B A PPTP A
PPTP B A IP 202.112.12.10B
202.112.12.12
PPPTP-Server
A PPTP-Server
Profile
- YuSong
- 92 -
RouterOS
PPTP-Server IP 192.168.100.1(local-address)
192.168.100.2(remote-address) IP Secrets
profile /ip pool DHCP
limit
limit idle-timeout 1
Rate-limit
512K 1M only-one
yes
- YuSong
- 93 -
RouterOS
PPTP-Client
PPTP B PPTP-Client PPP PPTP-Client
- YuSong
- 94 -
RouterOS
cdnat A PPTP-Server
A B IP NAT A A
A B AB PPTP
A PPTP IP 192.168.100.1
PPTP A
6.8 RouterOS
RouterOS
mark-routing
routing-mark
table
- YuSong
- 95 -
RouterOS
route1route2 route3
- YuSong
- 96 -
RouterOS
ip route
6.9 PCC
PCC ( src-address, src-port,
dst-address,dst-port)
PCC
PCC IP 32bit
DenominatorRemainder
src-address, dst-address, src-port, dst-port
per-connection-classifier=
PerConnectionClassifier ::= [!]ValuesToHash:Denominator/Remainder
Remainder ::= 0..4294967295
Denominator ::= 1..4294967295
(integer number)
(integer number)
- YuSong
- 97 -
RouterOS
per-connection-classifier
: 3
/ip firewall mangle add chain=prerouting action=mark-connection
new-connection-mark=1st_conn per-connection-classifier=both-addresses:3/0
/ip firewall mangle add chain=prerouting action=mark-connection
new-connection-mark=2nd_conn per-connection-classifier=both-addresses:3/1
/ip firewall mangle add chain=prerouting action=mark-connection
new-connection-mark=3rd_conn per-connection-classifier=both-addresses:3/2
per-connection-classifier=both-addresses:3/03/0
3 3/1
ISP1 10.200.15.99/2410.200.15.1
ISP2 10.200.100.99/2410.200.100.2
IP 192.168.100.1/24
- YuSong
- 98 -
RouterOS
ip address IP
Mangle
ip firewall mangle per-connection-classifier
- YuSong
- 99 -
RouterOS
dst-address-type=!local
2 2/0 2/1
- YuSong
- 100 -
RouterOS
1st_conn 1st_route
per-connection-classifier=both-addresses:2/0, in-interface=lan
2nd_conn 2nd_route
per-connection-classifier=both-addresses:2/1 in-interface=lan:
winbox mangle
- YuSong
- 101 -
RouterOS
/ ip firewall mangle
add chain=input in-interface=wan1 action=mark-connection
new-connection-mark=1st_conn
add chain=input in-interface=wan2 action=mark-connection
new-connection-mark=2nd_conn
winbox
winbox
- YuSong
- 102 -
RouterOS
ip route
routing-mark=1st_route
routing-mark=2nd_route
- YuSong
- 103 -
RouterOS
- YuSong
- 104 -
RouterOS
nat
nat ip firewall nat action=masquerade 2
- YuSong
- 105 -
RouterOS
PCC
6 PCC
both addresses
6
6 ADSL mangle prerouting
ip route PPPoE
- YuSong
- 106 -
RouterOS
DHCP
DHCP() IP
RouterOS Server Client, DHCP-relay
7.1 DHCP-Client
: /ip dhcp-client
MikroTik RouterOS DHCP-client WLAN client
DNS IP
DHCP-client
add-default-route yes
status (bound | error | rebinding... | requesting... | searching... | stopped) DHCP-Client
renewid
release (id) DHCP DHCP
- YuSong
- 107 -
RouterOS
[admin@MikroTik] ip dhcp-client>
Winbox
7.2 DHCP-Server
: /ip dhcp-server
: /ip pool
- YuSong
- 108 -
RouterOS
[admin@MikroTik] ip dhcp-server> setup
DHCP interface
lease time: 3d
[admin@MikroTik] ip dhcp-server>
NAME
INTERFACE RELAY
dhcp1
ether1
dhcp_pool1
0.0.0.0
3d
no
GATEWAY
10.0.0.1
DNS-SERVER
WINS-SERVER
DOMAIN
159.148.60.2
RANGES
10.0.0.2-10.0.0.254
[admin@MikroTik] ip dhcp-server>
Winbox DHCP /ip pool
- YuSong
- 109 -
RouterOS
- YuSong
- 110 -
RouterOS
DNS
DNS DNS DNS DNS
: system
: Level1
: /ip dns
8.1 DNS
- YuSong
- 111 -
RouterOS
resolve-mode: remote-dns
primary-dns: 61.139.2.69
secondary-dns: 0.0.0.0
[admin@MikroTik] ip dns>
4.6 DNS
8.2 DNS
: /ip dns static
MikroTik RouterOS DNS DNS DNS IP
name () IP DNS
address (IP ) IP
www.example.com DNSIP 10.0.0.1
[admin@MikroTik] ip dns static> add name www.example.com address=10.0.0.1
[admin@MikroTik] ip dns static> print
- YuSong
- 112 -
RouterOS
# NAME
ADDRESS
0 aaa.aaa.a
TTL
123.123.123.123 1d
1 www.example.com
10.0.0.1
1d
DNS
: /ip dns cache flush
Firewall Filte
RouterOS ip firewall IP P2P IPIP ICMP
TCPMSS ToS
...
inputforeward output chain
RouterOS address-list L7-protocol
9.1 Firewall
: /ip firewall filter
LAN
- YuSong
- 113 -
RouterOS
MikroTik RouterOS
P2P
IPv6
MAC
IP
IP
Interface
ToS (DSCP)
Connection-rate
PCC
IP
Chains
chainsinput, forward output
action=jump jump-target
chains
input IP IP
input-chains
forward
output
IP input
- YuSong
- 114 -
RouterOS
IP output
IP forward
chain chain
- YuSong
- 115 -
RouterOS
9.2
input
- YuSong
- 116 -
RouterOS
input
;;;
IP (src-address= IP,)
;;;
;;;
chain=input action=drop
forward
0 ;;;
- YuSong
- 117 -
RouterOS
chain=forward connection-state=invalid action=drop
3
;;;
TCP 80
;;;
;;;
ICMP
;;;
ICMP
;;; Ping 5
chain=ICMP protocol=icmp icmp-options=0:0-255 limit=5,5 action=accept
;;; Traceroute 5
- YuSong
- 118 -
RouterOS
chain=ICMP protocol=icmp icmp-options=3:3 limit=5,5 action=accept
;;; MTU 5
;;;
ICMP
ICMP
ICMP
ICMP
ICMP ICMP
Ping
o
8:0
0:0
Trace
o
11:0 TTL
3:3
MTU
o
3:4 Fragmentation-DF-Set
ICMP
pingICMP
tracerouteTTL
MTUICMP Fragmentation-DF-Set
virus
- YuSong
- 119 -
RouterOS
IP
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
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
tcp-chain tcp
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"
add chain=tcp protocol=tcp dst-port=2049 action=drop comment="deny NFS"
add chain=tcp protocol=tcp dst-port=12345-12346 action=drop comment="deny NetBus"
add chain=tcp protocol=tcp dst-port=20034 action=drop comment="deny NetBus"
add chain=tcp protocol=tcp dst-port=3133 action=drop comment="deny BackOriffice"
add chain=tcp protocol=tcp dst-port=67-68 action=drop comment="deny DHCP"
udp-chain udp Deny udp ports in udp chain:
add chain=udp protocol=udp dst-port=69 action=drop comment="deny TFTP"
add chain=udp protocol=udp dst-port=111 action=drop comment="deny PRC portmapper"
add chain=udp protocol=udp dst-port=135 action=drop comment="deny PRC portmapper"
add chain=udp protocol=udp dst-port=137-139 action=drop comment="deny NBT"
add chain=udp protocol=udp dst-port=2049 action=drop comment="deny NFS"
- YuSong
- 120 -
RouterOS
add chain=udp protocol=udp dst-port=3133 action=drop comment="deny BackOriffice"
icmp-chain icmp
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"
8.3 Peer-to-Peer
Peer-to-peer p2p Skype
http e-mail RouterOS
P2P QOS P2P
[admin@MikroTik] /ip firewall filter> add chain=forward p2p=all-p2p action=drop
[admin@MikroTik] /ip firewall filter> print chain=forward
Flags: X - disabled, I - invalid, D - dynamic
0
Fasttrack (Kazaa, KazaaLite, Diet Kazaa, Grokster, iMesh, giFT, Poisoned, mlMac)
WPNP (WinMX)
- YuSong
- 121 -
RouterOS
9.4 RouterOS 7
RouterOS V3.0 7 skypeQQMSN
Layer7-protocol filter
10 2kb
7 Regexp Regexp
7
http://www.mikrotik.com.cn/download/m3dex.htm MikroTik RouterOS 3.0 7
FTP Files
- YuSong
- 122 -
RouterOS
[admin@MikroTik] > import l7-protos.rsc
Opening script file l7-protos.rsc
Script file loaded and executed successfully
[admin@MikroTik] >
Script file loaded and executed successfully
Layer7 Protocols
- YuSong
- 123 -
RouterOS
QQ QQ Advanced Layer7
Protocols qq Action drop L7 QQ
IP IP src-address dst-address
9.5 DMZ
- YuSong
- 124 -
RouterOS
DMZ demilitarized zone
Web FTP
DMZ
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 R Public
ether
1500
1 R Local
ether
1500
1500
2 R DMZ-zone
ether
[admin@gateway] interface>
Interface IP
ADDRESS
192.168.0.2/24
NETWORK
192.168.0.0
BROADCAST
INTERFACE
192.168.0.255
Public
10.0.0.254/24
10.0.0.0
10.0.0.255
Local
10.1.0.1/32
10.1.0.2
10.1.0.2
DMZ-zone
192.168.0.3/24
192.168.0.0
192.168.0.255
Public
[admin@gateway] ip address>
DST-ADDRESS
0 S 0.0.0.0/0
1 DC 10.0.0.0/24
G GATEWAY
DISTANCE INTERFACE
r 10.0.0.254
ether1
ether1
r 0.0.0.0
[admin@MikroTik] ip route>
- YuSong
- 125 -
RouterOS
9.1 IP
RouterOS 3.0 2
Bridging(MAC) Layer-3
- YuSong
- 126 -
RouterOS
9.2
RouterOS
- 127 -
RouterOS
/queue tree
Hotspot
MAC MAC
out-bridge-port
IP
mangle output
TTL 1 TTL 0
IPsec
- YuSong
- 128 -
RouterOS
Hotspot-in
use-ip-firewall=yes
Ethernet Ethernet
- YuSong
- 129 -
RouterOS
IPsec
IPsec
- YuSong
- 130 -
RouterOS
Queue
(delivery) MikroTik RouterOS
:
PFIFO -
BFIFO
SFQ -
RED
PCQ
HTB
: system
: Level1 ( 1 ) Level3
: /queue
11.1 Queue
(QoS) QoS
RouterOS :
IP
P2P
WEB
(:)
( global-in global-out global-total)
- YuSong
- 131 -
RouterOS
QoS TCP TCP
QoS :
Priority -
Contention Ratio - ()
: 1:4 4
/queue interface (
)(/queue tree)/queue interface
qdiscs
:
(schedulers) -
: PFIFO BFIFO SFQ PCQ RED
RouterOS :
global-out -
PFIFO BFIFO
(FIFOFirst-In First-Out)PFIFO BFIFO
pfifo-limit (bfifo-limit) FIFO
- YuSong
- 132 -
RouterOS
FIFO
SFQ
SFQTCP UDP
SFQ round-robin sfq-perturb
Round-robin pcq-allot
PCQ
SFQ Per Connection Queuing (PCQ)
SFQPCQ pcq-classifier
pcq-rate pcq-limit PCQ pcq-total-limit
PCQ
- YuSong
- 133 -
RouterOS
src-address IP pcq-rate
src-address
src-address
RED
RED red-min-threshold
RED
red-max-threshold red-max-threshold
red-limit
red-limit () -
red-max-threshold () -
red-min-threshold () - RED
- YuSong
- 134 -
RouterOS
Bursts
1/16 burst-time burst-time
burst-threshold burst-limit bps
max-limit limit-at
max-limit=256000 burst-time=8 burst-threshold=192000
burst-limit=512000 HTTP
8 0bps burst-threshold
(192kbps)(0+0+0+0+0+0+0+512)/8=64kbps
burst-threshold(0+0+0+0+0+0+512+512)/8=128kbps
burst-threshold max-limit (256kbps)
P2P
FIFO
- YuSong
- 135 -
RouterOS
upload
download -
dst-address (IP /) -
dst-netmask () - dst-address
interface () -
limit-at (/) in/out/
max-limit (/) - in/out/
name () -
p2p (any | all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | winmx)
P2P
all-p2p P2P
any
packet-marks (; : "") - /ip firewall
mangle ("")
parent () -
priority (: 1..8) - 1 8
queue (/; : default/default) - in/out//queue type
target-addresses (IP /) - IP
time (sat | fri | thu | wed | tue | mon | sun{+}; : "") -
total-burst-limit () - global-total
total-burst-threshold () - global-total
total-burst-time () - global-total
total-limit-at () - total-limit-at bps
total-max-limit () - global-total ( total-max-limit bps)
total-queue () - global-total
- YuSong
- 136 -
RouterOS
simple queue RouterOS IP NAT
[admin@MikroTik] ip address> print
Flags: X disabled, I invalid, D - dynamic
#
ADDRESS
192.168.0.254/24
10.5.8.104/24
NETWORK
BROADCAST
192.168.0.0
10.5.8.0
INTERFACE
192.168.0.255
10.5.8.255
Local
Public
[admin@MikroTik] ip address>
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>
ip firewall nat src-nat nat
192.168.0.0/24 2Mb 1Mb
[admin@MikroTik] queue simple> add name=Limit-Local target-address=192.168.0.0/24
max-limit=1000000/2000000
[admin@MikroTik] queue simple> print
Flags: X - disabled I - invalid D - dynamic
0
total-queue=default
[admin@MikroTik] queue simple>
max-limit target-addresses
max-limit=0/0
total-queue=default
total-queue=default
[admin@MikroTik] queue simple> move 1 0
- YuSong
- 137 -
RouterOS
[admin@MikroTik] queue simple> print
Flags: X - disabled I - invalid D - dynamic
0
11.4 HTB
HTB
Child inner() Children Leaf
,, Leaf RouterOS Parent()
HTB 2
Limit-atCIR
max-limit (MIR).
CIR ( max-limit )
CIR
MIR (parent) MIR(child1) & MIR (parent) MIR(child2) & ... & MIR (parent) MIR(childN)
winbox
0% - 50%
51% - 75%
76% - 100%
- YuSong
- 138 -
RouterOS
max-limit 0
Queue03
Queue04
Queue05
1:
- YuSong
- 139 -
RouterOS
Queue03 6Mbps
Queue04 2Mbps
Queue05 2Mbps
HTB limit-at
2max-limit
Queue03 2Mbps
Queue04 6Mbps
Queue05 2Mbps
limit-at HTB
3: inner limit-at
- YuSong
- 140 -
RouterOS
Queue03 2Mbps
Queue04 6Mbps
Queue05 2Mbps
limit-at HTB
Queue02 Limit-at 8Mbps Queue04 Queue05Queue04
4leaf Limit-at
- YuSong
- 141 -
RouterOS
Queue03 3Mbps
Queue04 1Mbps
Queue05 6Mbps
RouterOS HTB
RouterOS 4 HTB :
global-in
global-total
global-out
interface queue
- YuSong
- 142 -
RouterOS
burst-limit () -
burst-threshold () - burst-threshold
burst-limit
burst-time () -
flow () - /ip firewall mangle
limit-at () -
max-limit () -
name () -
parent () - HTB
priority (: 1..8) - 1 8
queue () - /queue type
new-connection-mark mark-connection
new-packet-mark mark-packet
VIP ip firewall address-list VIP src-address-list
[admin@Office] /ip firewall mangle> print
Flags: X - disabled, I - invalid, D - dynamic
0
;;; vip
- YuSong
- 143 -
RouterOS
chain=forward action=mark-connection new-connection-mark=vip
passthrough=yes src-address-list=vip
;;; web
chain=forward action=mark-connection new-connection-mark=web
passthrough=yes protocol=tcp dst-port=80
;;; other
chain=forward action=mark-connection new-connection-mark=other
passthrough=yes
- YuSong
- 144 -
RouterOS
queue tree
[admin@Office] /queue tree> print
Flags: X - disabled, I - invalid
0
11.6 PCQ
- YuSong
- 145 -
RouterOS
PCQ
FIFO FIFO PCQ :
pcq-rate () :
pcq-limit () :
pcq-total-limit () : FIFO
IP
PCQ 18 PCQ
PCQ
- YuSong
- 146 -
RouterOS
RouterOS PCQ ,
- YuSong
- 147 -
RouterOS
192.168.10.0/24 PCQ
100
Queue Type
PCQ 512k 1m
- YuSong
- 148 -
RouterOS
1m 100 limit
total-limit 50*100=5000 dst-address
src-address 512k
- YuSong
- 149 -
RouterOS
Limit Total-Limit
total-limit limit
(limit) 10-20
- YuSong
- 150 -
RouterOS
WiFi bridge
IP 192.168.10.1/24 WiFi
NAT/Masquerad
ADSL 3Mbps
IP
192.168.10.6
VIP
192.168.10.7
192.168.10.0/24
8 icmp
ICMP
icmp
ADSL RouterOS
90%
VIP
ICMP
- YuSong
- 151 -
RouterOS
ether2-wan ADSL ether1-lan wlan1 bridge1
[admin@MikroTik] /interface> print
Flags: D - dynamic, X - disabled, R - running, S - slave
#
NAME
0 R ADSL
TYPE
MTU
pppoe-out
1480
L2MTU
1 R bridge1
bridge
1500
2 R ether1-lan
ether
1500 1526
3 R ether2-wan
ether
1500 1524
ether
1500 1524
ether
1500 1524
ether3
5 R wlan1
65535
[admin@MikroTik] /interface>
HTB
HTB parents HTB
ADSL 2850/420kbps, queue tree 90%
parent bridge1 ADSL
ICMP
ICMP ICMP ICMP mangle
VIP
192.168.10.7 VIP CIR VIP
800kbps 200kbps MIR 2600kbps
VIP
- YuSong
- 152 -
RouterOS
/ip firewall mangle add src-address=192.168.10.7/32 action=mark-connection
new-connection-mark=vip-con chain=forward
/ip firewall mangle add connection-mark=vip-con action=mark-packet new-packet-mark=vip
chain=forward
Queue tree VIP
/queue tree add name=vip-down parent=Download limit-at=1024 packet-mark=vip max-limit=5000k
priority=2
/queue tree add name=vip-up parent=Upload limit-at=512 packet-mark=vip max-limit=100k
priority=2
192.168.10.6 HTB
/ip firewall mangle add src-address=192.168.10.6/32 action=mark-connection
new-connection-mark=server-con chain=forward
/ip firewall mangle add connection-mark=server-con action=mark-packet new-packet-mark=server
chain=forward
Queue tree
/queue tree add name=server-down parent=Download limit-at=1024 packet-mark=server
max-limit=2600k priority=4
/queue tree add name=server-up parent=Upload limit-at=512 packet-mark=server max-limit=300k
priority=4
192.168.10.0/24 src-address
users-conusers
/ip firewall mangle add chain=forward src-address=192.168.10.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 passthrough=no
2 PCQ ADSL-down dst-address ADSL pcq-rate
0 ADSL-up ADSL src-address
pcq-rate=100kbps ADSL
/queue type add name=ADSL-down kind=pcq pcq-classifier=dst-address
/queue type add name=ADSL-up kind=pcq pcq-rate=100k pcq-classifier=src-address
queue tree
/queue tree add parent=Download queue=users-down packet-mark=users
/queue tree add parent=Upload queue=users-up packet-mark=users
- YuSong
- 153 -
RouterOS
1 ip firewall mangle
2 queue type
3 queue tree
1 Mangle
- YuSong
- 154 -
RouterOS
HTB
HTB HTB+PCQ
1 PCQ gamesdown
- YuSong
- 155 -
RouterOS
11M 2M 9M HTB 1
8 3M 2M
6M
Connection Rate
connection tracking IP
Connection-bytesConnection-bytes
Connection Rate "connection-bytes"Connection Rate
- YuSong
- 156 -
RouterOS
( HTTP VOIP "connection-bytes"
)
6Mbps
per-connection-classifier=
PerConnectionClassifier ::= [!]ValuesToHash:Denominator/Remainder
Remainder ::= 0..4294967295
Denominator ::= 1..4294967295
(integer number)
(integer number)
mangle 2 2
forward
heavy max-limitheavy
connection-rate
heavy"heavy"
Mangel
- YuSong
- 157 -
RouterOS
/queue tree
add name=upload parent=public max-limit=6M
add name=other_upload parent=upload limit-at=4M max-limit=6M \
packet-mark=other_traffic priority=1
add name=heavy_upload parent=upload limit-at=2M max-limit=6M \
packet-mark=heavy_traffic priority=8
add name=download parent=local max-limit=6M
add name=other_download parent=download limit-at=4M max-limit=6M \
packet-mark=other_traffic priority=1
add name=heavy_download parent=download limit-at=2M max-limit=6M \
packet-mark=heavy_traffic priority=8
Connection-rate HTB
Connection-rate HTB tcp/80
HTB
Mangle
- YuSong
- 158 -
RouterOS
mangle
games_v2.rsc RouterOS files
import
forward prerouting
tcp/3724
- YuSong
- 159 -
RouterOS
Forward
forward forward dstgames
- YuSong
- 160 -
RouterOS
forward
192.168.88.0/24
dstgames
connection-rate 4
- YuSong
- 161 -
RouterOS
- YuSong
- 162 -
RouterOS
- YuSong
- 163 -
RouterOS
web_brows
web_brows web_browspassthrough=no
- YuSong
- 164 -
RouterOS
- YuSong
- 165 -
RouterOS
HTB PCQ
HTB PCQ queue tree HTB
PCQ
queue type PCQ down PCQkind=pcqrate
0 k m dst-address
- YuSong
- 166 -
RouterOS
- YuSong
- 167 -
RouterOS
1 down up
2 down up forward global-out parent global-out
3 down 4 down
priority1 8 1web 2web 7 8.
4 max-limit limit-at
limi-at max-limit
5 2M ADSL 2Mbps
1900kbps 400kbps 10Mbps 2M
- YuSong
- 168 -
RouterOS
parent=down down
packet-mark games queue type PCQ down
priority 1 1M 400kbps
1Mbps
- YuSong
- 169 -
RouterOS
- YuSong
- 170 -
RouterOS
7 1800k 500k
8 1800k 200k
- YuSong
- 171 -
RouterOS
- YuSong
- 172 -
RouterOS
nat
(NAT) IP ()
IP
: system
: Level1Level3
: /ip firewall nat
: IP RFC1631 RFC2663
: CPU NAT
12.1 nat
IP IP
natted() natted
nat nat / IP
dstnat natted
dstnat IP IP
IP
nat
UDP TCP
NAT IPsec AH
- YuSong
- 173 -
RouterOS
nat nat
to-addresses
to-ports
web
dst-nat action=nat action=redirect
web
web web
IP web IP web
HTTP/1.1 HTTP web
IP HTTP
web
HTTP
web
passthrough -
redirect - IP
return -
same - / IP
- YuSong
- 174 -
RouterOS
dstnat - IP
srcnat - IP
comment () -
connection-bytes (-) -
0 - connection-bytes=2000000-0 2MB
connection-limit (, ) -
connection-mark () - mangle
connection-type (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp) -
/ip firewall service-port
content () -
dst-address (IP / | IP address-IP address) - IP
address/netmask 1.1.1.1/24 1.1.1.0/24
dst-address-list () -
dst-address-type (unicast | local | broadcast | multicast) - IP
unicast - IP
local -
broadcast - IP IP
multicast - IP
dst-limit (/{0,1},, dst-address | dst-port | src-address{+},time{0,1}) -
IP pps limit IP /
from-client - HotSpot
auth -
local-dst - IP
icmp-options (:) - ICMP Type:Code
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) - ipv4
any - ipv4
loose-source-routing -
no-record-route -
no-router-alert -
no-source-routing -
no-timestamp -
record-route -
router-alert -
strict-source-routing -
timestamp -
- YuSong
- 175 -
RouterOS
phys-out-interface (name) -
protocol (ddp | egp | encap | ggp | gre | hmp | icmp | idrp-cmtp | igmp | ipencap | ipip | ipsec-ah
| ipsec-esp | iso-tp4 | ospf | pup | rdp | rspf | st | tcp | udp | vmtp | xns-idp | xtp | ) -
IP
psd () - TCP UDP
FTP
WeightThreshold - TCP/UDP
DelayThreshold -
LowPortWeight - <=1024
HighPortWeight <=1024
random () -
routing-mark (name) - mangle
same-not-by-dst (yes | no) - action=same IP
IP
src-address (IP / | IP - IP ) - IP
src-address-list (name) -
src-address-type (unicast | local | broadcast | multicast) - IP
unicast - IP
local -
broadcast - IP IP
multicast - IP
src-mac-address (MAC address) - MAC
src-port (: 0..65535-: 0..65535{*}) -
tcp-mss (: 0..65535) - IP TCP MSS
time (-sat | fri | thu | wed | tue | mon | sun{+}) -
- YuSong
- 176 -
RouterOS
max-reliability (ToS=4)
max-throughput (ToS=8)
min-cost (ToS=2)
min-delay (ToS=16)
normal (ToS=0)
12.2 nat
ISP 10.5.8.109 192.168.0.0/24 MikroTik
192.168.0.0/24 IP
10.5.8.109 nat
masquerade IP
src-natto-address
Masquerade
12.3 nat
IP 10.5.8.200 192.168.0.109 MikroTik
IP
IP
- YuSong
- 177 -
RouterOS
10.5.8.200
dst-nat
dst-nat IP tcp/80
192.168.0.100
dst-nat
Redirect IP IP dst-nat Redirect
to-address tcp/80
11nat
IP 11.11.11.1/32 2.2.2.2/32
action=netmap
12.4
: /ip firewall connection
IP
estabilished new related
FTP ICMP invalid
prerouting output
nat NAT
P2P IP
/ip firewall connection 64M RAM
65536 128M RAM 130000
- YuSong
- 178 -
RouterOS
connection-mark (: ) - mangle
dst-address (: IP address:port) -
protocol (: ) IP
p2p (: ) P2P
reply-src-address (: IP address:port) -
reply-dst-address (: IP address:port) -
src-address (: IP address:port) -
tcp-state (: ) - TCP
timeout (: ) -
assured (: true | false) -
icmp-id (: ) - ICMP ID ICMP
ICMP ID ICMP
icmp-option (: ) - ICMP
reply-icmp-id (: ) - ICMP ID
reply-icmp-option (: ) - ICMP
unreplied (: true | false) -
count-curent (: ) -
count-max (: ) -
enable (yes | no; : yes) - nat
- YuSong
- 179 -
RouterOS
generic-timeout (; : 10m) - TCP UDP
1/16 1
3/16 1
1/2 10
13/16 1
nat statefull-firewalling
Mangle
mangle IP mangle IP IP
IPTCP IP Mangle
: system
: Level1
: /ip firewall mangle
: IP
13.1 Mangle
Mangle RouterOS queue-trees
natMangle
- YuSong
- 180 -
RouterOS
Prerouting
Input
Foreward TTLTCP-MSS
Output
Prostrouting
IP Queue ip route
Mark-connection IP
Mark-packet IP
Mark-routing IP IP
IP TCP/UDP IP
Mangle
13.2 Mangle
Peer-to-Peer
VoIP HTTP
P2P RouterOS QOS mangle
queues P2P 1Mbps
- YuSong
- 181 -
RouterOS
[admin@NAT] >
[admin@NAT] > /queue tree add parent=Public packet-mark=p2p limit-at=1000000
max-limit=100000000 priority=8
[admin@NAT] > /queue tree add parent=Local packet-mark=p2p limit-at=1000000
max-limit=100000000 priority=8
[admin@NAT] > /queue tree add parent=Public packet-mark=other limit-at=1000000
max-limit=100000000 priority=1
[admin@NAT] > /queue tree add parent=Local packet-mark=other limit-at=1000000
max-limit=100000000 priority=1
Mangle 2
mangle 2 http in-interface IP
dst-address
RouterOS Nth
Nth RouterOS IP
nat
14.1 Nth
v3.0 Nth everypacket
1every
0 Nth
nth N 16
Every every Counter
Packet Nth=3,1 3 1
- YuSong
- 182 -
RouterOS
In
10,9,8,7,6,5,4,3,2,1
Nth
Every=3
Packet=1
Packet=2
Packet=3
...n
...n+1
...n+2
Out1
Out2
Out3
- YuSong
- 183 -
RouterOS
3 1/3
Passthrough
Nth mangle
Passthrough=no Nth 50%
/ip firewall mangle
add chain=prerouting new-connection-mark=AAA nth=2,1 action=mark-connection
passthrough=no;
50%
add chain=prerouting new-connection-mark=BBB action=mark-connection
3 1/3 2/3
50% 1/3
/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=AAA nth=3,1
passthrough=no;
add action=mark-connection chain=prerouting new-connection-mark=BBB nth=2,1
passthrough=no;
add action=mark-connection chain=prerouting new-connection-mark=CCC ;
3
/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=AAA nth=3,1
passthrough=yes;
- YuSong
- 184 -
RouterOS
14.3 Nth
Nth ISP Nth
2 ISP
Nth
new
connection=new Nth
oddevenISP1 ISP2
lan192.168.10.1/24
IP
- YuSong
- 185 -
RouterOS
in-interface=lan connection-mark=odd
2 chain=prerouting action=mark-connection new-connection-mark=even passthrough=yes
connection-state=new in-interface=lan nth=2,2
3
in-interface=lan connection-mark=even
NAT
- YuSong
- 186 -
RouterOS
/ ip route
add gateway=10.11.0.1 routing-mark=ISP1
add gateway=10.12.0.1 routing-mark=ISP2
Nth ISP
Nth TCP
443 8443 IP
14.4 Nth
Nth FTP
FTP
FTP Nth 3 ftp 3 FTP
- YuSong
- 187 -
RouterOS
Lanip 192.168.10.1/24
3 FTP IP 192.168.10.2192.168.10.3192.168.10.4
1/3
- YuSong
- 188 -
RouterOS
Bridge
MAC EoIPEthernet over IPPrism, Atheros 802.11a, 802.11b,
and 802.11g ad-hoc, infrastructure station 802.11
Prism Atheros WDS Atheros Prism EoIP
STP/RSTP
(STP)
RSTP
MAC
IP
ether1 ether2
1.
MyBridge
- YuSong
- 189 -
RouterOS
: system
: Level3
: /interface bridge
: IEEE801.1D
Ethernet, Ethernet over IP, IEEE802.11 in ap-bridge bridge , WDS, VLAN
MAC EoIP IP
STP
15.1
: /interface bridge
MAC
MAC
ageing-time (; : 5m) -
arp (disabled | enabled | proxy-arp | reply-only; : enabled) -
forward-delay (; : 15s) -
/
garbage-collection-interval (; : 4s) -
ageing-time
hello-time (; : 2s) - hello
mac-address (: MAC ) MAC
max-message-age (; : 20s) - hello
mtu (; : 1500) -
name (; : bridgeN) -
priority (: 0..65535; : 32768) - STP
- YuSong
- 190 -
RouterOS
V2.9.9 add(set)
ether1 ether2 bridge1 V2.9.9
HORIZON
0 ether1
bri... 0x80
10
none
1 ether2
bri... 0x80
10
none
2 wlan1
none
128
10
none
HORIZON
0 ether1
bri... 0x80
none
1 ether2
bri... 0x80
10
10
none
Bridge setting
ip firewall 2.9 ip firewall
RouterOS WLAN
- YuSong
- 191 -
RouterOS
IP P2P 80 HTTP IP
15.2
: /interface bridge monitor
- YuSong
- 192 -
RouterOS
designated-port-count: 0
[admin@MikroTik] interface bridge>
15.3
: /interface bridge port monitor
designated-port () -
designated-root () - ID
port-id () - ID
status (disabled | blocking | listening | learning | forwarding) -
disabled - BPDUs
blocking - BPDU
listening - the port does not forward any frames, but listens to them
learning - MAC
forwarding - MAC
15.4
: /interface bridge host
age (:) -
bridge (: ) - entry
local (: ) -
mac-address (: MAC ) - MAC
on-interface (: ) -
- YuSong
- 193 -
RouterOS
MAC-ADDRESS
ON-INTERFACE
AGE
bridge1
00:00:B4:5B:A6:58 ether1
4m48s
bridge1
00:30:4F:18:58:17 ether1
4m50s
L bridge1
00:50:08:00:00:F5 ether1
0s
L bridge1
00:50:08:00:00:F6 ether2
0s
bridge1
00:60:52:0B:B4:81 ether1
4m50s
bridge1
00:C0:DF:07:5E:E6 ether1
4m46s
bridge1
00:E0:C5:6E:23:25 prism1
4m48s
bridge1
00:E0:F7:7F:0A:B8 ether1
1s
15.5
: /interface bridge filter, /interface bridge nat, /interface bridge broute
filter -
input - MAC
output -
forward
nat - / MAC
scnat - MAC
dstnat -
broute -
broutingBridging Decision
use-ip-firewall
- YuSong
- 194 -
RouterOS
- YuSong
- 195 -
RouterOS
topology-change-ack -
stp-forward-delay (time: 0..65535) - forward delay timer
stp-hello-time (time: 0..65535) - stp hello
stp-max-age (time: 0..65535) STP
stp-msg-age (time: 0..65535) STP
stp-port (: 0..65535) stp
stp-root-address (MAC ) MAC
stp-root-cost (: 0..65535)
stp-root-priority (: 0..65535)
stp-sender-address (MAC ) stp MAC
stp-sender-priority (: 0..65535)
stp-type (config | tcn) - BPDU
config BPDU
tcn -
vlan-encap (802.2 | arp | ip | ipv6 | ipx | rarp | vlan) - VLAN MAC
vlan-id (: 0..4095) VLAN
vlan-priority (: 0..7)
- YuSong
- 196 -
RouterOS
: /interface bridge filter
action (accept | drop | jump | log | mark | passthrough | return; default: accept) -
accept - /
drop ( ICMP )
jump - jump-target
log -
mark
passthrough -
return -
out-bridge () -
out-interface () -
action (accept | arp-reply | drop | dst-nat | jump | log | mark | passthrough | redirect | return |
src-nat; : accept) -
accept - /
arp-reply - MAC ARP ( dstnat
)
drop ( ICMP )
dst-nat - MAC ( dstnat )
jump - jump-target
log -
mark
passthrough -
redirect - dstnat
return -
src-nat - MAC ( srcnat )
out-bridge () -
to-arp-reply-mac-address (MAC ) - action=arp-reply MAC
ARP
to-dst-mac-address (MAC ) - action=dst-nat MAC
to-src-mac-address (MAC ) - action= src-nat MAC
- YuSong
- 197 -
RouterOS
action (accept | drop | dst-nat | jump | log | mark | passthrough | redirect | return; : accept)
- action to undertake if the packet matches the rule, one of the:
accept -
drop -
action=mark-packet new-packet-mark
action=mark-connection new-connection-mark
action=mark-routing new-routing-mark
15.7
Bridge
RouterOS Bridge
RouterOS birdge filter Bridge
- YuSong
- 198 -
RouterOS
bridge rstp
rstp
- YuSong
- 199 -
RouterOS
RB450 3 3
ether3ether4 ether5 filter
ether3 ether4 interface In-interface Out-interfaceIn-interface
Out-interface
action action drop
- YuSong
- 200 -
RouterOS
RouterBOARD Switch
RouterOS 3.0 RouterBOARD
RouterBOARD450 5 5
RouterOS Switch RouterBOARD100 400
3.0
RB433 RB433 3 ether1ether2 ether3
1 Master port
Slave port ether1 Master ether2 ether3
ether2
- YuSong
- 201 -
RouterOS
ether3
15.8
MikroTik RouterOS
RouterOS
1. int ext
/interface set ether1,ether2 disabled=no
- YuSong
- 202 -
RouterOS
- YuSong
- 203 -
RouterOS
bridge bridge
MAC
1 MAC
bridge bridge filter PC
MAC00:E2:67:32:B4:81 bridge
- YuSong
- 204 -
RouterOS
2 MAC
MAC scr-mac-address
MAC dst-mac-address MAC
- YuSong
- 205 -
RouterOS
MAC dst-mac-address=00:E2:67:32:B4:81dst-mac-address
FF
MAC
6 MAC 3 3
RouterOS Bridge MAC
MAC RouterOS RouterOS
- YuSong
- 206 -
RouterOS
src-mac-address=00:0C:42:00:00:00/src-mac-mask=FF:FF:FF:00:00:00
action accpet
MAC
- YuSong
- 207 -
RouterOS
(VRRP)
Virtual Router Redundancy Protocol (VRRP)MikroTik RouterOS VRRP RFC2338
VRRP
255
()
VRRP ping
: system
: Level1
: /interface vrrp
MASTER , IP MASTER
VRRP backup
16.1 VRRP
: /interface vrrp
- YuSong
- 208 -
RouterOS
backup (: flag)
interface (name)
interval (: 1..255; t: 1) VRRP VRRP
mac-address (MAC address) VRRP MAC address RFC VRRP
MAC
master (: flag) master
mtu (; : 1500)
name (name) VRRP
on-backup (name; : "") backup
on-master (name; : "") - master
password (; : "") 8
16 128 key AH
preemption-mode (yes | no; : yes)
no backup master master backup master
yes
vrid (: 0-255; : 1) (interface)
priority (: 1-255; : 100) ()
password.
255 IP
VRRP ether1 vrid 1 255
[admin@MikroTik] ip vrrp>
16.2 VRRP
- YuSong
- 209 -
RouterOS
Master VRRP
VRRP 255
[admin@MikroTik] interface vrrp> add interface=local priority=255
[admin@MikroTik] interface vrrp> print
Flags: X - disabled, I - invalid, R - running, M - master, B - backup
0
ADDRESS
NETWORK
BROADCAST
INTERFACE
10.0.0.1/24
10.0.0.0
192.168.1.2/24
192.168.1.0
192.168.1.255
local
192.168.1.1/24
192.168.1.0
192.168.1.255
vrrp1
10.0.0.255
public
[admin@MikroTik] ip address>
Backup VRRP
VRRP 100 backup
- YuSong
- 210 -
RouterOS
HotSpot
17.1 HotSpot
HotSpot HTTP HTTPS
RouterOS
RADIUS HotSpot
Hotspot web web
Walled Garden
IP IP DHCP IP
DHCP IP MAC
HotSpot IP Hotspot IP
IP Hotspot Hotspot ARP
IP hotspot
host NAT RouterOS 2.8
- YuSong
- 211 -
RouterOS
NAT
NAT IP
IP NAT
NAT arp
HotSpot NAT
HotSpot HTTP HTTPS
HotSpot servlet
Hotspot HTTP HotSpot servlet
Hotspot HotSpot DNS
Walled Garden
Walled Garden
Walled Garden HotSpot HTTP
- YuSong
- 212 -
RouterOS
RADIUS RADIUS
Radius
HTTP PAP /login?username=username&password=password telnet
HTTP GET /login?username=username&password=password HTTP/1.0
Hotspot HotSpot
1.
HotSpot HotSpot
2.
HotSpot
HotSpot IP HotSpot
AP NIC
- YuSong
- 213 -
RouterOS
ISP Hotspot Hotspot
17.2 HotSpot
: /ip hotspot
HotSpot HotSpot
none
interface () - HotSpot
ip-of-dns-name (: IP address) - HotSpot HotSpot DNS IP
keepalive-timeout ( | none;: none) -
none -
addresses-per-mac -
NAME
hs-local
INTERFACE
local
default 00:05:00
[admin@MikroTik] ip hotspot>
17.3 HotSpot
: /ip hotspot profile
- YuSong
- 214 -
RouterOS
http-pap -
trial -
radius-accounting (yes | no; : yes) - RADIUS
radius-interim-update
radius-interim-update (time | received; : received) -
0s received
received - RADIUS
rate-limit (; : "") - rx-rate[/tx-rate] [rx-burst-rate[/tx-burst-rate]
[rx-burst-threshold[/tx-burst-threshold] [rx-burst-time[/tx-burst-time]]]](
"rx" "tx")k(1,000s)M (1,000,000s) tx-rate
rx-rate tx-rate tx-burst-rate tx-burst-threshold tx-burst-time
rx-burst-threshold tx-burst-threshold ( burst-rate ) rx-rate tx-rate burst
threshold rx-burst-time tx-burst-time 1s
smtp-server (IP ; : 0.0.0.0) - SMTP
split-user-domain (yes | no; : no) - "user@domain""domain\user"
- YuSong
- 215 -
RouterOS
domain (: ) - ()
expires-in (: ) - cookie
mac-address (: MAC ) MAC
user (: )
DOMAIN
0 ex
MAC-ADDRESS
EXPIRES-IN
01:23:45:67:89:AB 23h54m16s
IP
(dst-host dst-path)
"example"
"example.com")'*' () '?' ()
(':')
:
- YuSong
- 216 -
RouterOS
\\ \
\. . ()
www.example.com /paynow.html
IP Walled Garden
: /ip hotspot walled-garden ip
IP Walled Garden HTTP HTTPS DNS HTTP
IP
17.5 IP
: /ip hotspot ip-binding
IP IP MAC NAT HotSpot
- YuSong
- 217 -
RouterOS
server (|all; : all) -
to-address (IP ; : "") - IP address
address to-addressaddress+1 to-address+1
192.168.10.8
17.6 Hotspot
: /ip hotspot host
HotSpot NAT
address (: IP address) - IP
authorized (: flag) - HotSpot
blocked (: flag) - walled-garden
bridge-port (: ) - HotSpot
- YuSong
- 218 -
RouterOS
packets-in (: ) -
packets-out (: ) -
server (: ) -
static (: flag) - IP
to-address (: IP ) - IP
uptime (: ) -
make-binding - IP
unnamed ()
comment () -
type (regular | bypassed | blocked) -
17.7 HotSpot
Hotspot
: /ip hotspot user
: /ip hotspot user profile
profile
advertise-url (: ; : http://www.mikrotik.com/,http://www.routerboard.com/) -
URL
idle-timeout (time | none; : none) -
hotspot
none
incoming-filter () -
incoming-packet-mark () -
keepalive-timeout (time | none; : 00:02:00) -
none
name () -
on-login (; : "") -
on-logout (; : "") -
open-status-page (always | http-login; : always) - MAC
alogin.html
- YuSong
- 219 -
RouterOS
http-login - http cookie http
always - mac http
outgoing-filter () -
outgoing-packet-mark () -
rate-limit (; : "") rx-rate[/tx-rate]
[rx-burst-rate[/tx-burst-rate] [rx-burst-threshold[/tx-burst-threshold]
[rx-burst-time[/tx-burst-time] [priority] [rx-rate-min[/tx-rate-min]]]] ( "rx"
"tx")'k' (1,000s) 'M' (1,000,000s) tx-rate rx-rate
tx-rate tx-burst-rate tx-burst-threshold tx-burst-time both rx-burst-threshold
tx-burst-threshold burst-rate rx-rate tx-rate
rx-burst-time tx-burst-time 1s 1 8 1 8
rx-rate-min tx-rate-min rx-rate tx-rate rx-rate-min
tx-rate-min rx-rate tx-rate
session-timeout (time; : 0s) - session timeout (maximal allowed session time) for client. After this
time, the user will be logged out unconditionally
0
shared-users (; : 1) -
status-autorefresh (time | none; : none) servlet
transparent-proxy (yes | no; : yes) - HTTP
10.1.0.0/24
10.0.0.1 1
server ( | all; : all) -
uptime (: time) -
- YuSong
- 220 -
RouterOS
MAC MAC
/ip hotspot active
-minus 100MB
30MB/ip hotspot active 100MB - 30MB = 70MB
bytes-in >= limit-bytes-in bytes-out >= limit-bytes-out
01:23:45:67:89:AB MAC ex 1
SERVER
NAME
ADDRESS
ex
PROFILE
UPTIME
default 00:00:00
17.8 Hotspot
/ip hotspot active
remove
address (: IP ) - IP
blocked (: flag) -
bytes-in (: ) -
bytes-out (: ) -
domain (: ) -
idle-time (: ) -
idle-timeout (: ) - idle-timeout
keepalive-timeout (: ) - keepalive-timeout
limit-bytes-in (: ) -
limit-bytes-out (: ) -
login-by (, : cookie | http-chap | http-pap | https | mac | trial) -
mac-address (: MAC ) MAC
- YuSong
- 221 -
RouterOS
packets-in (: ) -
packets-out (: ) -
radius (: yes | no) - RADIUS
server (: ) -
session-time-left (: time) - session-time-left
uptime (: time) - ()
user (: ) -
17.9 Hotspot
IP DNS DNS
ip address IP
- YuSong
- 222 -
RouterOS
ip route
ip dns DNS
- YuSong
- 223 -
RouterOS
Hotspot Hotspot
- YuSong
- 224 -
RouterOS
user profile
Idle-Timeout
Keepalive-Timeout ICMP
Shared-users 1
Rate-Limit /
Transparent-proxy Hotspot
Hotspot
- YuSong
- 225 -
RouterOS
server all
Name cdnat
Passwordcdnat
Profile default
ip hotspot server profile
- YuSong
- 226 -
RouterOS
Radius
Hotspot
web
- YuSong
- 227 -
RouterOS
ip hotspot active
USER
cdnat
ADDRESS
192.168.10.88
UPTIME
4m17s
SESSION-TIMEOUT IDLE-TIMEOUT
55m43s
- YuSong
- 228 -
RouterOS
192.168.10.1 Hotspot log off
- YuSong
- 229 -
RouterOS
17. 10 Hotspot
2.7 upnp Hotspot
IP IP DNS Hotspot Hotspot
Host IP NAT Hotspot
Hotspot ARP
IP IP Hotspot
- YuSong
- 230 -
RouterOS
Hotspot
DNS
17.11 HotSpot
/ip hotspot HotSpot
RouterOS 2.8
nat
nat
/ip firewall nat print dynamic
- YuSong
- 231 -
RouterOS
0 D chain=dstnat hotspot=from-client action=jump jump-target=hotspot
HotSpot HotSpot
HTTPS servlet
DNS hs-unauth
hs-auth
7 D ;;; www.mikrotik.com
chain=hs-unauth dst-address=159.148.147.196 protocol=tcp dst-port=80
action=return
- YuSong
- 232 -
RouterOS
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=redirect to-ports=64874
HotSpot HTTP
HotSpot
http hotspot
64874#8 HTTP HTTP HTTP
HTTPS 64875
HTTP http
HotSpot HTTP HTTP 64874
HotSpot
HTTP
SMTP #12
hs-unauth-to
- YuSong
- 233 -
RouterOS
2 D chain=input hotspot=from-client action=jump jump-target=hs-input
hs-input
ICMP
PPPoE
PPPoE (Point to Point Protocol over Ethernet) PPPOE ISP xDSL
cable modems PPPoE (PPP)
PPPoE modem , PPPoE IP
RouterOS RADIUS RADIUS PPPoE
- YuSong
- 234 -
RouterOS
PPPoE PPPoE windows PPPoE
interface - wireless 802.11 (Aironet, Cisco, WaveLan,
Prism, Atheros), 10/100/1000 Mbit/s Ethernet, RadioLan EoIP (Ethernet over IP tunnel)
: ppp
Level1 ( 1 ) , Level3 ( 200 ) , Level4 ( 200 ) , Level5 ( 500
) , Level6 ()
/interface pppoe-server, /interface pppoe-client
PPPoE (RFC 2516)
: PPPoE RAM CPU 9KiB 10KiB
service-name (; : "") AC
ac-name (; : "")
add-default-route (yes | no; : no)
- YuSong
- 235 -
RouterOS
dial-on-demand (yes | no; : no) AC
idle-timeout
use-peer-dns (yes | no; : no) DNS ppp DNS
pppoe add-default-route
gig AC testSN john password
PPPoE
: /interface pppoe-client monitor
status ()
Dialing
Verifying password...
Terminated
encoding ()
uptime ()
service-name ()
ac-name () AC
ac-mac (MAC ) ACMAC
pppoe-out1
18.2 ADSL
- YuSong
- 236 -
RouterOS
ADSL : user@169
: 1234
Service Name: CHN-Telecom
1 PPPOE Clients
ip firewall mangle
- YuSong
- 237 -
RouterOS
service-name () PPPoE
mtu (; : 1480) MTU 1500-byte 1480
keepalive-timeout () keepalive
keepalive
one-session-per-host (yes | no; : no) (MAC ).
default-profile (; : default)
max-sessions (; : 0) AC
0
interface ()
keepalive-timeout 10 0
one-session-per-host
IP PPPoE PPPoE
MRRU MP windows
MRRU 1614 MTU
MP
802.11g PPPoE
- YuSong
- 238 -
RouterOS
Access Point, RouterOS Windows
PPPoE MTU 1600 MTU 1500
1500byte MTU 1500
MikroTik AP :
- YuSong
- 239 -
RouterOS
[admin@PPPoE-Server] interface wireless>
IP
ADDRESS
10.1.0.3/24
NETWORK
BROADCAST
10.1.0.0
INTERFACE
10.1.0.255
Local
DST-ADDRESS
G GATEWAY
DISTANCE INTERFACE
0 ADC 10.1.0.0/24
1 A S 0.0.0.0/0
Local
r 10.1.0.1
Local
NAME
0 R Local
MTU
MAC-ADDRESS
ARP
PPPoE server :
PPPoE clients:
RANGES
0 pppoe
10.1.0.100-10.1.0.200
- YuSong
- 240 -
RouterOS
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
Flags: X - disabled
#
NAME
REMOTE-ADDRESS
pppoe
wkst
default
0.0.0.0
pppoe
ltp
default
0.0.0.0
- YuSong
- 241 -
RouterOS
default-encryption profile profiles loacl-address
IPremote-address IP local-address 192.168.10.1
remote-address ip pool pppoe DNS
Limits
- YuSong
- 242 -
RouterOS
18.5 PPPoE
PPPoE OSI IP ARP
ARP PPPoE MAC
IP Web
ARP PPPoE ARP
WindowsXP PPPoE
PPPoE
- YuSong
- 243 -
RouterOS
2 PPPoE PPPoE
PC 1000 PPPoE
PC
Ping web
DNS /ip dns /ppp profile dns-server
PPPoE ( pings)
PPPoE mss 1440
- YuSong
- 244 -
RouterOS
[admin@MT] interface pppoe-server server> set 0 max-mtu=1440 max-mru=1440
[admin@MT] interface pppoe-server server> print
Flags: X - disabled
0
Windows XP PPPoE
XP pppoe "Service Name" MikroTik PPPoE service
nameline is busy"verifying password - unknown error"
PPTP
PPTP IP MikroTik RouterOS PPTP PPTP
LAN EoIP
PPTP
1.
- YuSong
- 245 -
RouterOS
[admin@PPTP-Server] ppp secret> add name=jack password=pass local-address=10.0.0.1
remote-address=10.0.0.2
2.
PPTP
PPTP
1.
PPTP
: ppp
: Level1 ( 1 ) , Level3 ( 1 ) , Level4 ( 200 )Level5
: /interface pptp-server, /interface pptp-client
: PPTP (RFC 2637)
PPTP windows
ISP Internet
19.1 PPTP
: /interface pptp-client
- YuSong
- 246 -
RouterOS
profile (; default: default) -
user () -
john john PPTP test2 10.1.1.12PPTP
encoding () -/
status () - status of the client
Dialing
Verifying password... -
Connected -
Terminated -
uptime (time) -
: /interface pptp-client monitor
19.2 PPTP
: /interface pptp-server server
PPTP PPTP PPTP Level1
PPTP Level3 Level4 200 Level5 Level6 PPTP
PPTP PPP secret PPP Profile MikroTik RADIUS
PPTP
- YuSong
- 247 -
RouterOS
enabled (yes | no; default: no) - PPTP
keepalive-timeout (time; default: 30) -
2 * keepalive-timeout
19.3 PPTP
Router to Router
PPTP
[HomeOffice]
- YuSong
- 248 -
RouterOS
LocalHomeOffice 10.150.2.254/24
ToInternet 192.168.80.1/24
[RemoteOffice]
ToInternet 192.168.81.1/24
LocalRemoteOffice 10.150.1.254/24
ISP
HomeOffice
HomeOffice PPTP /ppp secret
Winbox
- YuSong
- 249 -
RouterOS
mru: 1460
authentication: mschap2
default-profile: default
[admin@HomeOffice] interface pptp-server server>
RemoteOffice
RemoteOffice PPTP
- YuSong
- 250 -
RouterOS
pptp
pptp
PPTP
- YuSong
- 251 -
RouterOS
[admin@RemoteOffice] > ip route add dst-address=10.150.2.0/24 gateway=10.0.103.1
10.150.1.0/24
pptp 10.0.103.2
Distance 1
Winbox routes
PPTP
- YuSong
- 252 -
RouterOS
10.0.103.1 pong: ttl=255 time=3 ms
10.0.103.1 pong: ttl=255 time=3 ms
ping interrupted
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 3/3.0/3 ms
PPTP LocalHomeOffice
19.4 PPTP
PPTP
[RemoteOffice]
ToInternet 192.168.81.1/24
Office 10.150.1.254/24
PPTP
- YuSong
- 253 -
RouterOS
[admin@RemoteOffice] ppp secret> add name=ex service=pptp password=123456
local-address=10.150.1.254 remote-address=10.150.1.2
[admin@RemoteOffice] ppp secret> print detail
Flags: X - disabled
0
pptp
NAME
0 R ToInternet
1 R Office
MTU
MAC-ADDRESS
ARP
- YuSong
- 254 -
RouterOS
2 nat masquerade
chain=srcnat action=masquerade
winbox masquerade
Windows PPTP
Windows NT200098SE 98 PPTP Windows 98SE2000 ME Windows
PPTP 95NT 98 Microsoft ISP Windows
PPTP
- 255 -
RouterOS
VPNPPTP'Dial-up Networking' 'Create a new connection' VPN
VPN VPN IP IP
'new'
'connect' 9 'NetBEUI', 'IPX/SPX compatible'
'Log on to network''connect' 2
Windows 98SE VPN 'Start''Setting''Control Panel''Add/Remove
Program''Windows setup' 'Communications''Details''Virtual
Private Networking'
PPTP
TCP 1723 TCP 47
PPTP L2TP
PPTP L2TP PPP
- YuSong
- 256 -
RouterOS
- YuSong
- 257 -
RouterOS
- YuSong
- 258 -
RouterOS
L2TP Windows
L2TP Windows XP L2TP L2TP IPSec Windows XP
1) Windows XP Regedt32
HKEY_Local_Machine \ System \ CurrentControl Set \ Services \ RasMan \Parameters
2)
ProhibitIpSec
reg_dword
windows L2TP
20.2 VPN
MikroTik VPN VPN
VPN VPN VoIP ISP VoIP
VPN
- YuSong
- 259 -
RouterOS
PPTP L2TP
- YuSong
- 260 -
RouterOS
VoIP IP
Open VPN
OpenVPN Linux WindowsRouterOS v3.x OpenVPN
ppp RouterOS OpenVPN tcp udp
Windows GUI windows OpenVPN GUI
http://www.openvpn.se/download.html .
OpenVPN SSL linux OpenVPN
http://cacert.org
21.1 OVPN
OVPN OVPN
OVPN linux
- YuSong
- 261 -
RouterOS
file list
- YuSong
- 262 -
RouterOS
import ca.crt
ca.key KR key
- YuSong
- 263 -
RouterOS
require-client-certificate
- YuSong
- 264 -
RouterOS
OVPN 192.168.10.2-192.168.10.254
IP
/ppp secret
- YuSong
- 265 -
RouterOS
OVPN
OVPN 2 OVPN
- YuSong
- 266 -
RouterOS
Dial-out Connect-to=10.200.15.228user=123password=123
OVPN DR
- YuSong
- 267 -
RouterOS
OVPN Client R
- YuSong
- 268 -
RouterOS
bridge
ports ether2-lan
- YuSong
- 269 -
RouterOS
- YuSong
- 270 -
RouterOS
OVPN Client
ovpn-out1 mode ethernet
- YuSong
- 271 -
RouterOS
EoIP
SSTP
Secure Socket Tunneling Protocol (SSTP) SSL3.0 PPP
TCP 443
SSL SSTP
SSTP PPTP L2TP
PPTP L2TP VPN
NATWEB PROXY
PPTP
TCP GRE
ISP
; NAT NAT GRE
PPTP TCP GRE ;WEB PROXY
PPTP
L2TP OVER IPSEC IKE ESP
WEB PROXY L2TP OVER IPSEC
SSTP VPN VPN SSL3.0
SSTP TCP 443
SSTP
/interface sstp-client
name (; : )
password (; : "")
profile (name; Default: default-encryption) PPP profile
proxy (IP:Port; : 0.0.0.0:443)HTTP
- YuSong
- 272 -
RouterOS
user (; : )
SSTP 10.1.101.1sstp-test123
[admin@MikroTik] /interface sstp-client>add user=sstp-test password=123 \
\... connect-to=10.1.101.1 disabled=no
[admin@MikroTik] /interface sstp-client> print
Flags: X - disabled, R - running
0 R name="sstp-out1" max-mtu=1500 max-mru=1500 mrru=disabled connect-to=10.1.101.1:443
user="sstp-test" password="123" proxy=0.0.0.0:443 profile=default
certificate=none keepalive-timeout=60 add-default-route=no dial-on-demand=no
authentication=pap,chap,mschap1,mschap2
SSTP
: /interface sstp-server
SSTP PPTP
PPP PPP
max-mru (; : 1500)
max-mtu (; : 1500)
mrru ( | ; : disabled) MTU
IP
SSTP
- YuSong
- 273 -
RouterOS
[admin@MikroTik] /interface sstp-server server> set certificate=server
[admin@MikroTik] /interface sstp-server server> set enabled=yes
[admin@MikroTik] /interface sstp-server server> print
enabled: yes
port: 443
max-mtu: 1500
max-mru: 1500
mrru: disabled
keepalive-timeout: 60
default-profile: default
certificate: server
require-client-certificate: no
authentication: pap,chap,mschap1,mschap2
[admin@MikroTik] /interface sstp-server server>
Monitor
[admin@dzeltenais_burkaans] /interface sstp-server> monitor 0
status: "connected"
uptime: 17m47s
idle-time: 17m47s
user: "sstp-test"
caller-id: "10.1.101.18:43886"
mtu: 1500
22.1
SSTP SSTP
IP ( EoIP )
- YuSong
- 274 -
RouterOS
SSTP windows2008
OVPN
- YuSong
- 275 -
RouterOS
certificate: server
require-client-certificate: no
authentication: pap,chap,mschap1,mschap2
SSTP IP IP 192.168.80.1.
SSTP SSTP windows2008,windows vista
vista sp1
SSTP
[admin@RemoteOffice] /interface sstp-server> print
Flags: X - disabled, D - dynamic, R - running
#
NAME
USER
0 DR <sstp-... Laptop
MTU
CLIENT-ADDRESS
UPTIME
1500
10.1.101.18:43886 1h47s
ENCODING
NAME
MTU
MAC-ADDRESS
ARP
0 R ether1
1 R ether2
proxy-arp ping
22.2 SSTP
SSTP
- YuSong
- 276 -
RouterOS
1"
SSTP
- YuSong
- 277 -
RouterOS
authentication: pap,chap,mschap1,mschap2
Home SSTP
[admin@Home] /interface sstp-client> add user=Home password=123 connect-to=192.168.80.1
disabled=no
[admin@Home] /interface sstp-client> print
Flags: X - disabled, R - running
0 R name="sstp-out1" max-mtu=1500 max-mru=1500 mrru=disabled connect-to=192.168.80.1:443
user="Home" password="123" proxy=0.0.0.0:443 profile=default certificate=none
keepalive-timeout=60 add-default-route=no dial-on-demand=no
authentication=pap,chap,mschap1,mschap2
[admin@Home] /interface sstp-client>
Home Office
[admin@Home] /ip route> add dst-address=10.1.101.0/24 gateway=172.16.1.1
ping
EoIP
EoIPEthernet over IP IP MikroTik RouterOS
EoIP
EoIP
LAN
LAN
2.
- YuSong
- 278 -
RouterOS
IP EoIP
: system
: Level3
: /interface eoip
EoIP IP EoIP IPIP PPTP 128bit PPPoE IP
ID
EoIP
IP
EoIP 65536
23.1 EoIP
: /interface eoip
arp (disabled | enabled | proxy-arp | reply-only; default: enabled) -
mac-address (MAC ) - EoIP MAC 00-00-5E-80-00-00
00-00-5E-FF-FF-FF MAC
mtu (; default: 1500) -
name (; : eoip-tunnelN)
remote-address - EoIP IP MikroTik
tunnel-id ()
tunnel-id tunnel-id
tunnel-id
mtu 1500
- YuSong
- 279 -
RouterOS
23.2 EoIP
officeA officeB Eoip 2
- YuSong
- 280 -
RouterOS
officeB Eoip
- YuSong
- 281 -
RouterOS
NAT EoIP
EOIP out-interface WAN
ping EoIP
EoIP MAC MAC
- YuSong
- 282 -
RouterOS
IPSec
IPSec
(replay)
IP IP
AHESP Internet IKE
IP AH ESP
IKE AH ESP
IPSec
IPSec IPSec
24.1 IPSec
RouterOS IPsec VPN
IPsec VPN :
192.168.88.1/24--R1---192.168.11.11/24 -------- 192.168.11.18/24---R2---192.168.103.1/24
R1
ip address :
- YuSong
- 283 -
RouterOS
ip routes
- YuSong
- 284 -
RouterOS
action tunnel
- YuSong
- 285 -
RouterOS
ip firewall nat
- YuSong
- 286 -
RouterOS
- YuSong
- 287 -
RouterOS
action masquerade
R1 winbox R1 R2
R2
ip address :
- YuSong
- 288 -
RouterOS
ip routes
- YuSong
- 289 -
RouterOS
action tunnel :
- YuSong
- 290 -
RouterOS
ip firewall nat
action accept
- YuSong
- 291 -
RouterOS
nat :
acion masquerade
- YuSong
- 292 -
RouterOS
R2
NAT accept masquerade
- YuSong
- 293 -
RouterOS
IPSec
IPsec windows PC IP L2TP IP /ip ipsec
security peer address PC IP secret yusongHash-algorithm
shagenerate-policy
10.200.15.60 peer
- YuSong
- 294 -
RouterOS
address=10.200.15.59 windows
:500 ;
generate-policy=yes IPSec
RouterOS
RouterOS L2TP PPTP PPP L2TP
- YuSong
- 295 -
RouterOS
- YuSong
- 296 -
RouterOS
Windows
Windows 2 IPSec
Win7
\ Internet\
VPN
10.200.15.228
VPN
- YuSong
- 297 -
RouterOS
10.200.15.228
- YuSong
- 298 -
RouterOS
yusong
123 123
- YuSong
- 299 -
RouterOS
remote peers IP
Policies
PPP active
- YuSong
- 300 -
RouterOS
Bonding
Bonding
Bongding IP
25.1 Bonding
2 Router1 Router2
bonding
1. IP bonding
2. Router1 bonding
Router2
3. bonding
4. Router1
- YuSong
- 301 -
RouterOS
bonding
: system
: Level1
: /interface bonding
link-monitoring :
ARP arp-interval
link-monitoring
- YuSong
- 302 -
RouterOS
slave MAC
balance-xor XOR
broadcast
2 ISP Internet
office1
TYPE
MTU
0 R isp1
NAME
ether
1500
1 R isp2
ether
1500
ADDRESS
1.1.1.1/24
10.1.0.111/24
NETWORK
BROADCAST
1.1.1.0
1.1.1.255
10.1.0.0
INTERFACE
isp2
10.1.0.255
isp1
Office2
NAME
TYPE
- YuSong
MTU
- 303 -
RouterOS
0 R isp2
ether
1500
1 R isp1
ether
1500
ADDRESS
2.2.2.1/24
10.1.0.112/24
NETWORK
BROADCAST
2.2.2.0
2.2.2.255
10.1.0.0
10.1.0.255
INTERFACE
isp2
isp1
- YuSong
- 304 -
RouterOS
0 R name="eoip-tunnel1" mtu=1500 mac-address=FE:FD:00:00:00:01 arp=enabled
remote-address=1.1.1.1 tunnel-id=1
Bonding Office1
ADDRESS
1.1.1.1/24
10.1.0.111/24
3.3.3.1/24
NETWORK
BROADCAST
1.1.1.0
1.1.1.255
10.1.0.0
3.3.3.0
10.1.0.255
3.3.3.255
INTERFACE
isp2
isp1
bonding1
Office2
ADDRESS
2.2.2.1/24
10.1.0.112/24
3.3.3.2/24
NETWORK
BROADCAST
2.2.2.0
2.2.2.255
10.1.0.0
3.3.3.0
10.1.0.255
3.3.3.255
INTERFACE
isp2
isp1
bonding1
- YuSong
- 305 -
RouterOS
bonding RouterOS
VLAN
VLAN 802.1Q VLAN LAN LAN
4095 VLAN VLAN ID Cisco
: system
: Level1 (limited to 1 vlan) , Level3
: /interface vlan
: VLAN (IEEE 802.1Q)
VLAN
VLAN VLAN
MikroTik RouterOS ( Cisco IOS Linux)
VLAN OSI VLAN MikroTik
RouterOS forward-protocols ip, arp other
VLAN VLAN VLAN
MAC VLAN
VLAN VLAN
VLAN VLAN
Realtek 8139
Intel PRO/100
VIA VT6105
VLAN >1496
- YuSong
- 306 -
RouterOS
26.1 VLAN
: /interface vlan
interface () - VLAN
mtu (; : 1500)
name () -
vlan-id (; : 1) - LAN VLAN VLAN
ether1 test
vlan-id=1 VLAN
NAME
0 X test
MTU ARP
VLAN-ID INTERFACE
1500 enabled
ether1
NAME
0 R test
MTU ARP
1500 enabled
VLAN-ID INTERFACE
1
ether1
26.2 VLAN
hub MikroTik RouterOS VLAN ether1
VLAN IP ping
VLAN
- YuSong
- 307 -
RouterOS
[admin@MikroTik] interface vlan> add name=test vlan-id=32 interface=ether1
[admin@MikroTik] interface vlan> print
Flags: X - disabled, R - running
#
NAME
0 R test
MTU ARP
VLAN-ID INTERFACE
1500 enabled
32
ether1
VLAN
IP VLAN
Router 1 :
ADDRESS
NETWORK
BROADCAST
INTERFACE
10.0.0.204/24
10.0.0.0
10.0.0.255
ether1
10.20.0.1/24
10.20.0.0
10.20.0.255
pc1
10.10.10.1/24
10.10.10.0
10.10.10.255
test
[admin@MikroTik] ip address>
Router 2 :
ADDRESS
NETWORK
BROADCAST
10.0.0.201/24
10.0.0.0
10.0.0.255
10.10.10.2/24
10.10.10.0
10.10.10.255
INTERFACE
ether1
test
[admin@MikroTik] ip address>
- YuSong
- 308 -
RouterOS
round-trip min/avg/max = 10/11/13 ms
[admin@MikroTik] ip address>
- YuSong
- 309 -
RouterOS
Web
MikroTik RouterOS
HTTP
URL
()
()
NAT
: web-proxy
: Level3
: /ip proxywinboxip web-proxy
: HTTP/1.0, HTTP/1.1, FTP
: ()
- YuSong
- 310 -
RouterOS
web IP IP
8000
- YuSong
- 311 -
RouterOS
cache-administrator: "dmitry@mikrotik.com"
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>
27.1
: /ip proxy access
6
action
dst-port (port{1,10}) -
hits (: ) -
local-port (port) - web web
method (any | connect | delete | get | head | options | post | put | trace) - HTTP
HTTP
path (wildcard) -
redirect-to () - URL
src-address (IP address/netmask) - IP
dst-host
dst-path"example"
"example.com"'*''?'
(':')
\\ \
\. . ()
[ or ]
- YuSong
- 312 -
RouterOS
IP internal-use-onlyweb
Firewall Manual
27.2
: /ip proxy direct
parent-proxy
action
dst-port (port{1,10}) -
hits (: ) -
local-port (port) - web web
method (any | connect | delete | get | head | options | post | put | trace) - HTTP (
HTTP )
path (wildcard) - web
src-address (IP address/netmask) - IP
deny
27.3
: /ip web-proxy cache
web web
dst-port ({1,10}) -
hits (: ) -
local-port () - web web
- YuSong
- 313 -
RouterOS
method (any | connect | delete | get | head | options | post | put | trace) - HTTP (
HTTP )
path (wildcard) - web
src-address (IP /) - IP
27.4
: /ip proxy monitor
cache-used (: ) -
hits (: )
hits-sent-to-clients (: )
ram-cache-used (: ) RAM
received-from-servers (: )
requests (: )
sent-to-clients (: )
status (: ; default: stopped)
stopped
rebuilding-cache
running -
stopping - 10s
clearing-cache
creating-cache
dns-missing DNS /ip dns
invalid-address -
invalid-cache-administrator - e-mail
invalid-hostname
error-logged
reserved-for-cache () web
total-ram-used (: ) RAM
uptime (: ) -
27.5
: /ip proxy connections
dst-address (: IP ) IP
protocol (: )
rx-bytes (: ) -
- YuSong
- 314 -
RouterOS
src-address (: IP ) IP
state (: closing | connecting | converting | hotspot | idle | resolving | rx-header | tx-body | tx-eof |
tx-header | waiting | )
closing -
connecting - toe
hotspot hotspot hotspot
idle -
resolving DNS
rx-header HTTP
tx-body HTTP
tx-eof - ()
tx-header HTTP
waiting
tx-bytes (: ) -
27.6
: /ip proxy inserts
()
denied (: ) -
errors (: )
no-memory (: )
successes (: ) -
too-large (: )
27.7
: /ip proxy lookups
denied (: ) -
expired (: ) -
no-expiration-info (: ) -
non-cacheable (: ) -
not-found (: ) -
successes (: ) -
: /ip proxy
- YuSong
- 315 -
RouterOS
web
check-drive -
clear-cache -
format-drive -
27.8 HTTP
OPTIONS
Request-URI
GET
Request-URI Request-URI GET
HTTP GET
HEAD
GET
HEAD Request-URI
POST
Request-URI
POST Request-URI
POST Cache-Control Expires
PUT
Request-URI Request-URI
Request-URI
URI
- YuSong
- 316 -
RouterOS
Request-URI
TRACE
200OK
0 Max-Forwards
TRACE
27.9 Web
web-proxy
web-proxy
- YuSong
- 317 -
RouterOS
80 web-proxy 8080
Proxy
http://www.163.com
- YuSong
- 318 -
RouterOS
/ip proxy access
path=*.exe action=deny
path=*.mp3 action=deny
path=*.zip action=deny
path=*.rar action=deny
MetaRouter
RouterOS v3.30 Xen v3.30 KVM Xen RouterOS v4.0 2
MetaRouter KVM
Metarouter
MetaRouter MikroTik RouterBOARD 400 (mips-be) RouterOS
MikroTik MetaRouter MetaRouter
Xen
Xen
- YuSong
- 319 -
RouterOS
KVM
Kernel-based Virtual MachineKVM x86 RouterOS PC
KVM CPU
Intel VT-x AMD-V
16MB
28.1
Xen MetaRouter
VOIP
LDAP
RouterOS MailHttpFtp
VPN
VPN
ISP
WISP
()
The Dude
28.2 MetaRouter
MetaRouter RouterOS 4.0beta1 3.21 MetaRouter, RB400
Metarouter
RouterOS Metarouter 16M RAM16M
Metarouter RAM
- YuSong
- 320 -
RouterOS
8 Metarouter 16 8
MetaRouter VLAN MetaRouter
MetaRouter
ISP
/metarouter
add
enable
disable
console
interface
MetaRouter
NAME
MEMORY-SIZE DISK-SIZE
mr0
16MiB
0kiB
USED-DISK
377kiB
STATE
running
name:
memory-size: RAM
disk-size: HDD KB 0, ) *
state: MetaRouter
NAME
MEMORY-SIZE DISK-SIZE
mr1
16MiB
0kiB
USED-DISK
3kiB
STATE
running
Interface Interface
- YuSong
- 321 -
RouterOS
comment
disabled
dynamic-mac-address type
virtual-machine
vm-mac-address
interface
NAME
TYPE
MTU
8 R ether9
ether
1500
9 R test
bridge
1500
10 DR vif1
vif
1500
console :
/metarouter console 0
NAME
TYPE
0 R ether1
ether
MTU
1500
MetaRouter CTRL + A Q
[admin@MikroTik] >
[Q - quit connection]
[A - send Ctrl-A prefix]
[B - send break]
[R - autoconfigure rate]
Welcome back!
28.3 MetaRouter
- YuSong
- 322 -
RouterOS
- YuSong
- 323 -
RouterOS
1. MetaRouter
NAME
client1
MEMORY-SIZE DISK-SIZE
16MiB
0kiB
USED-DISK
221kiB
STATE
running
[admin@CDNAT] /metarouter>
- YuSong
- 324 -
RouterOS
2. MetaRouter
VIRTUAL-MACHINE
TYPE
VM-MAC-ADDRESS
0 A client1
dynamic 02:01:9A:28:66:9C
1 A client1
dynamic 02:78:49:4F:90:19
3. MetaRouter vif2
()
INTERFACE
ether2
bridge1
BRIDGE
10
none
vif2
bridge1
0x80
10
none
- YuSong
- 325 -
RouterOS
4. MetaRouter IP ether1
vif1 MetaRouter vif1 lan
ADDRESS
NETWORK
10.200.15.56/24
10.200.15.0
10.0.1.1/24
10.0.1.0
BROADCAST
10.200.15.255
10.0.1.255
INTERFACE
ether1
vif1
5. metarouter console
Starting...
Starting services...
MikroTik 3.22
MikroTik Login: admin
Password:
- YuSong
- 326 -
RouterOS
6. metarouter
NAME
MTU
MAC-ADDRESS
ARP
0 R ether1
1500 02:49:E8:55:8E:E8
enabled
1 R ether2
1500 02:16:16:90:EF:0E
enabled
NAME
MTU
MAC-ADDRESS
ARP
0 R wan
1 R lan
IP
ADDRESS
NETWORK
BROADCAST
INTERFACE
10.0.1.2/24
10.0.1.0
10.0.1.255
wan
10.0.2.1/24
10.0.2.0
10.0.2.255
lan
DST-ADDRESS
0 A S 0.0.0.0/0
PREF-SRC
G GATEWAY
DISTANCE INTERFACE
r 10.0.1.1
wan
1 ADC 10.0.1.0/24
10.0.1.2
wan
2 ADC 10.0.2.0/24
10.0.2.1
lan
nat
winbox metarouter
- YuSong
- 327 -
RouterOS
winbox MetarRouter
RouterOS 1 client1
MetaRotuer
10.0.3.0/24 MetaRouter RouterBOARD
- YuSong
- 328 -
RouterOS
Log
RouterOS log
email syslog
RouterOS
/log
: /system logging
TOPICS
ACTION PREFIX
info
memory
error
memory
warning
memory
critical
echo
firewall
memory
29.1 Logging
: /system logging action
- YuSong
- 329 -
RouterOS
remote (IP address:port ; : 0.0.0.0:514) IP UDP ( action
remote)
target (disk | echo | email | memory | remote; : memory)
disk
echo
email email
memory
remote
action
action long 1000 /log
1000
NAME
TARGET REMOTE
0 * memory
memory
1 * disk
disk
2 * echo
echo
3 * remote
remote 0.0.0.0:514
long
memory
29.2 Dude
MikroTik syslog RouterOS 1000
The Dude
The Dude RouterOS
The Dude 3.0beta8 RouterOS system logging
- YuSong
- 330 -
RouterOS
- YuSong
- 331 -
RouterOS
The Dude
- YuSong
- 332 -
RouterOS
29.3 Log
: /log
/system logging
message (: )
time (: )
topics (: )
- YuSong
- 333 -
RouterOS
MESSAGE
MESSAGE
RouterOS Store
RouterOS 3.15 store Web-proxy
User-Manager The Dude 3.23 RouterOS log Store
RouterOS PC RouterBOARD
RouterBOARD CF/MircoSD PC U winbox
store
- YuSong
- 334 -
RouterOS
30.1 RouterOS U
U PC 1 16G U RouterOS PC
USB Store Disk usb1
invalid RouterOS U
usb1 U Format Driver
- YuSong
- 335 -
RouterOS
usb1 ready
30.2 log
RouterOS3.23 log RouterOS
U
system logging Action files type disk
- YuSong
- 336 -
RouterOS
Disk
Typelog disk
<filename>.0.txt<filename>.1.txt<filename>.n.txt
- YuSong
- 337 -
RouterOS
log
- YuSong
- 338 -
RouterOS
CPU
30.3 Web-Proxy U
Web
U
Store Proxy web-proxy usb1
- YuSong
- 339 -
RouterOS
30.4 Store
Store The Dude
- YuSong
- 340 -
RouterOS
IP
IP
Hotspot PPP RouterOS
: system
: Level1
: /user, /ppp, /ip accounting, /radius
:
30.1 IP
: /ip accounting
IP PPPPPTPPPPoE
ISDN HotSpot
IP
- YuSong
- 341 -
RouterOS
account-local-traffic (yes | no; : no) - /
threshold (; : 256) - IP 8192
IP uncounted
IP
30.2 IP
: /ip accounting snapshot
IP
bytes (: ) -
dst-address (: IP address) - IP
dst-user (: ) ()
packets (: ) -
src-address (: IP address) - IP
src-user (: )
PPP HotSpot
IP
DST-ADDRESS
PACKETS
BYTES
0 192.168.0.2
159.148.172.197 474
19130
1 192.168.0.2
10.0.0.4
120
2 192.168.0.2
192.150.20.254
32
3142
3 192.150.20.254
192.168.0.2
26
2857
4 10.0.0.4
192.168.0.2
117
5 159.148.147.196 192.168.0.2
136
6 192.168.0.2
159.148.147.196 1
7 159.148.172.197 192.168.0.2
835
SRC-USER
DST-USER
40
1192962
30.3 Web IP
- YuSong
- 342 -
RouterOS
: /ip accounting web-access
web Unix/Linux wget MikroTik
web web web snapshot Snapshot web
wget http TCP Snapshot wget
Web wget URLhttp://routerIP/accounting/ip.cgi
RotuerOS ip accounting
- YuSong
- 343 -
RouterOS
Scheduler
.
: system
: Level1
: /system scheduler
32.1
interval (; : 0s) -
name ()
on-event () /system script
run-count (: ) , 1
start-date ()
start-time ()
startup 3 .
run-count
start-time startup 3
start-time=startup interval=0
1 1 logtest
- YuSong
- 344 -
RouterOS
[admin@MikroTik] system script> add name=logtest source=:log info test
[admin@MikroTik] system script> print
0
name="script1" owner="admin"
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff
last-started=may/16/2008 21:32:51 run-count=3 source=:log info " test"
[admin@MikroTik] system script> .. scheduler
[admin@MikroTik] system scheduler> add name=run-1h interval=1h on-event=logtest
[admin@MikroTik] system scheduler> print
Flags: X - disabled
#
NAME
run-1h
logtest
mar/30/2004 06:11:35
1h
RUN-COUNT
0
Schedule Winbox
2 2 cust0 9 64kb/s
5 128kb/s( 2.9 cust0
3.0 cust0)
- YuSong
- 345 -
RouterOS
\... Cust0 limit-at=64000}
[admin@MikroTik] system script> add name=stop_limit source={/queue simple set \
\... Cust0 limit-at=128000}
[admin@MikroTik] system script> print
0 name="start_limit" source="/queue simple set Cust0 limit-at=64000"
owner=admin run-count=0
NAME
set-64k
1d
RUN-COUNT
1d
3
[admin@MikroTik] system script> add name=e-backup source={/system backup
save name=email; /tool e-mail send to="root@host.com" subject=([/system
{... identity get name] . " Backup") file=email.backup}
[admin@MikroTik] system script> print
0 name="e-backup" source="/system backup save name=ema... owner=admin
run-count=0
NAME
7d
RUN-COUNT
1
- YuSong
- 346 -
RouterOS
[admin@MikroTik] tool e-mail>
4
12 12 x:
NAME
x-up
1d
x-down
1d
log-x
oct/30/2008 00:00:00
1h
RUN-COUNT
RouterOS
33.1Netwatch
Netwatch ping
: advanced-tools
: Level1
: /tool netwatch
: none
Netwatch IP ICMP ping
netwatch
- YuSong
- 347 -
RouterOS
down-script () unknown up down
host (IP ; : 0.0.0.0) IP
interval (; : 1s) ping
status (: up | down | unknown)
up up
down down
unknown
timeout (; : 1s) ping timeout
down
up-script () - unknown down up
gw_1 gw_2
HOST
TIMEOUT
INTERVAL
STATUS
10.0.0.217
997ms
10s
up
up "gw_2"
[admin@MikroTik] > /ip route set [/ip route find dst 0.0.0.0] gateway 10.0.0.217
[admin@MikroTik] > /ip route set [/ip route find dst 0.0.0.0] gateway 10.0.0.1
10.0.0.217
- YuSong
- 348 -
RouterOS
10.0.0.215 e-mail
33.2Graphing
Graphing RouterOS
: system, routerboard(optional)
: Level1
: /tool graphing
Graphing
Routerboard ()
Interfaces
simple queues
allow-address
- YuSong
- 349 -
RouterOS
: /tool graphing
192.168.0.0/24 ether1 :
INTERFACE ALLOW-ADDRESS
ether1
192.168.0.0/24
STORE-ON-DISK
yes
- YuSong
- 350 -
RouterOS
[admin@NAT] tool graphing interface>
Graphing
: /tool graphing queue
/queue simple
CPU usage
Memory usage
Disk usage
IP 192.168.0.0/24
ALLOW-ADDRESS
STORE-ON-DISK
192.168.0.0/24
yes
- YuSong
- 351 -
RouterOS
33.3Bandwidth-text
MikroTik
Server
: /tool bandwidth-server
allocate-udp-ports-from UDP
authenticate (yes | no; : yes)
enable (yes | no; : no)
max-sessions bandwidth-test
Bandwidth :
- YuSong
- 352 -
RouterOS
[admin@MikroTik] tool> bandwidth-server session print
# CLIENT
0 35.35.35.1
udp
send
admin
1 25.25.25.1
udp
send
admin
2 36.36.36.1
udp
send
admin
[admin@MikroTik] tool>
bandwidth-test
Client
: /tool bandwidth-test
(IP address) - IP
assume-lost-time (; : 0s) Bandwidth Server
direction (receive / transmit / both; : receive) -
do ( | string; : "") -
duration (; : 0s) -
0s
interval (: 20ms..5s; : 1s)
local-tx-speed (; : 0) (bits per second)
0
local-udp-tx-size (: 40..64000) UDP
password (; : "")
protocol (udp | tcp; : udp)
random-data (yes | no; : no) yesBandwidth
( CPUrandom-data no)
remote-tx-speed (; : 0) (bits per second)
0
remote-udp-tx-size (: 40..64000) UDP
user (; : "") -
- YuSong
- 353 -
RouterOS
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>
33.4Torch ()
torch .
. Torch .
: /tool torch
()
dst-address (IP address/netmask) : 0.0.0.0/0 .
freeze-frame-interval () -
port ( | )
protocol (any | any-ip | 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)
any -
any-ip
src-address (IP address/netmask) : 0.0.0.0/0
DST-PORT
1439
23 (telnet)
TX
1.7kbps
RX
368bps
[admin@MikroTik] tool>
IP ether1
RX
tcp
1.06kbps
608bps
udp
896bps
3.7kbps
icmp 480bps
480bps
- YuSong
- 354 -
RouterOS
ospf 0bps
192bps
[admin@MikroTik] tool>
IP 10.0.0.144/32 ether1
10.0.0.144
TX
RX
1.01kbps
608bps
480bps
480bps
icmp 10.0.0.144
[admin@MikroTik] tool>
tcp/udp ether1
DST-PORT
TX
1.06kbps
RX
tcp
3430
22 (ssh)
608bps
udp
2812
1813 (radius-acct)
512bps
2.11kbps
tcp
1059
139 (netbios-ssn)
248bps
360bps
[admin@MikroTik] tool>
QQ
QQ QQ QQ QQ
QQ
RouterOS QQ IP RouterOS torch
Torch /tool Torch
interface QQ 8000 dst-port 8000
8000 QQ 80
- YuSong
- 355 -
RouterOS
- YuSong
- 356 -
RouterOS
Winbox
torch QQ IP QQ
33.5 E-mail
E-mail e-mailEmail
TLS
: /tool e-mail
SMTP
from (; : <>) email
password (; : "")SMTP
server (IP:Port; : 0.0.0.0:25)SMTP IP
username (; : "")SMTP
Email /tool e-mail send
:
body (; : )
file (; : ) Email
- YuSong
- 357 -
RouterOS
from (; : ) email .
password (; : ) SMTP
server (IP:Port; : ) IP SMTP
subject (; : ).
tls (yes|no; : yes) TLS
to (; : ) emial
user (; : ) SMTP
24 email
1. SMTP
[admin@MikroTik] /tool e-mail> set server=10.1.1.1:25 from="router@mydomain.com"
2. export-send
/export file=export
/tool e-mail send to="config@mydomain.com" subject="$[/system identity get name] export)
\
body="$[/system clock get date] configuration file" file=export.rsc
3.scheduler export-send
/system scheduler
add on-event="export-send" start-time=00:00:00 interval=24h
NAME
TYPE
RX-RATE
TX-RATE
MTU
0 R ether1
ether
1500
1 R bridge1
bridge
1500
2 R ether2
ether
1500
3 R wlan1
wlan
1500
[admin@MikroTik] interface>
/interface bridge
[admin@MikroTik] /interface bridge> add
[admin@MikroTik] /interface bridge> prin
Flags: X - disabled, R - running
0 R name="bridge1" mtu=1500 arp=enabled mac-address=00:00:00:00:00:00
protocol-mode=none priority=0x8000 auto-mac=yes
admin-mac=00:00:00:00:00:00 max-message-age=20s forward-delay=15s
transmit-hold-count=6 ageing-time=5m
[admin@MikroTik] /interface bridge>
- YuSong
- 358 -
RouterOS
E-mail winbox
- YuSong
- 359 -