ros防火牆名詞解釋
ros防火牆名詞解釋
input - 進入路由,而且須要對其處理
forward - 路由轉發
output - 通過路由處理,而且從接口出去的包
action:
1 accept: 接受
add-dst-to-address-list - 把一個目標IP地址加入address-list
add-src-to-address-list - 把一個源IP地址加入address-list
2 drop - 丟棄
3 jump - 跳轉,能夠跳轉到一個規則主題裏面,如input forward,也能夠跳轉到某一條裏面
4 log - 日誌記錄
5 passthrough - 忽略此條規則
6 reject - 丟棄這個包,而且發送一個ICMP迴應消息
7 return - 把控制返回給jump的所在
8 tarpit - 捕獲和扣留 進來的TCP鏈接 (用SYN/ACK迴應進來的TCP SYN 包)
address-list (name) - 把從action=add-dst-to-address-list or action=add-src-to-address-list actions獲得的IP地址放入address-list列表. 這個列表要用來對比address-list-timeout 看是何時用address-list parameter從address list中移走
chain (forward | input | output | name) - 使用chain獲得特定列表,不一樣的數據流通過不一樣的chain規則
要仔細的選對正確的訪問控制. 若是 input 不是很是的肯定和一個新的規則須要添加註釋,
transfered through the particular connection
0的意思是無限的,例如 connection-bytes=2000000-0 意思是2MB以上
connection-limit (integer | netmask) - 地址的傳輸流量控制
connection-mark (name) - 傳輸中的標記後的數據包
connection-state (estabilished | invalid | new | related) - 鏈接的狀態(鏈接中,不規則的鏈接,新的鏈接,相互聯繫的鏈接)
connection-type 鏈接的類型 (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp)
content 包的內容
dst-address (IP address | netmask | IP address | IP address) - 目標地址
dst-address-list (name) - 目標地址表
dst-address-type (unicast | local | broadcast | multicast) - 目標地址類型
unicast -點對點
local - 本地地址
broadcast - 廣播
multicast - 多播
dst-limit (integer | time | integer | dst-address | dst-port | src-address | time) - 目標限制
Count - 每秒最大的包數量
by Time option
Time - 時間
Burst - 突發的
Mode -等級優先
Expire - 終止
dst-port 目標端口
hotspot 暫時不作學習
icmp-options (integer | integer) - ICMP 選擇
in-interface (name) - 進入接口
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)
any - match packet with at least one of the ipv4 options
loose-source-routing - match packets with loose source routing option. This option is used toroute the internet datagram based on information supplied by the source
no-record-route - match packets with no record route option. This option is used to route the
internet datagram based on information supplied by the source
no-router-alert - match packets with no router alter option
no-source-routing - match packets with no source routing option
no-timestamp - match packets with no timestamp option
record-route - match packets with record route option
router-alert - match packets with router alter option
strict-source-routing - match packets with strict source routing option
timestamp - match packets with timestamp
jump-target (forward | input | output | name) -跳轉
limit (integer | time | integer) - 限制
Count - 每秒最大的包數量
Time - 突發的總時間
log-prefix (text) - 若是還有定義的字符,加入日誌
out-interface (name) - 流出的接口
p2p (all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | warez
| winmx) - P2P協議
packet-mark (text) - 給包標記
packet-size (integer: 0..65535 | integer: 0..65535) - 包大小
range in bytes
Min - 最小
Max - 最大
phys-in-interface (name) - 物理上的進入接口
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 | integer) -協議
psd (integer | time | integer | integer) - 防止對ROS的端口掃描
random (integer: 1..99) - matches packets randomly with given propability
reject-with (icmp-admin-prohibited | icmp-echo-reply | icmp-host-prohibited |
icmp-host-unreachable | icmp-net-prohibited | icmp-network-unreachable | icmp-port-unreachable |icmp-protocol-unreachable | tcp-reset | integer) - 改變reject的回答方式
routing-mark (name) - 路由標記
src-address (IP address | netmask | IP address | IP address) -源地址
src-address-list (name) -源地址列表
src-address-type (unicast | local | broadcast | multicast) - 源地址類型
src-mac-address (MAC address) - 源MAC地址
src-port (integer: 0..65535 | integer: 0..65535) - 源端口
tcp-flags (ack | cwr | ece | fin | psh | rst | syn | urg) -TCP 標誌類型
ack - acknowledging data
cwr - congestion window reduced
ece - ECN-echo flag (explicit congestion notification)
fin - close connection
psh - push function
rst - drop connection
syn - new connection
urg - urgent data
tcp-mss (integer: 0..65535) - TCP MSS
time (time | time | sat | fri | thu | wed | tue | mon | sun) - allows to create filter based on the packets'
arrival time and date or, for locally generated packets, departure time and date
tos (max-reliability | max-throughput | min-cost | min-delay | normal) - specifies a match for the
value of Type of Service (ToS) field of an IP header
max-reliability - maximize reliability (ToS=4)
max-throughput - maximize throughput (ToS=8)
min-cost - minimize monetary cost (ToS=2)
min-delay - minimize delay (ToS=16)
normal - normal service (ToS=0)
:foreach i in=[/system logging facility find local=memory ] do=[/system logging facility set $i local=none]
RO防syn
ip-firewall-connections
Tracking:TCP Syn Sent Timeout:50
TCP syn received timeout:30
限線程腳本:
:for aaa from 2 to 254 do={/ip firewall filter add chain=forward src-address=(192.168.0. . $aaa) protocol=tcp connection-limit=50,32 action=drop}
RO端口的屏蔽
ip-firewall-Filer Rules裏面選擇
forward的意思表明包的轉發
firewall rule-General
Dst.Address:要屏蔽的端口
Protocol:tcp
Action:drop(丟棄)
ros限速
手動限速
winbox---queues----simple queues
點「+」,NAME裏隨便填,下面是IP地址的肯定
①Target Address 無論,Dst. Address裏填 你要限制的內網機器的IP,好比我這裏有個 1號機器 IP爲 192.168.1.101,那dst.address 裏就填 192.168.1.101 而後是/32(這裏的32不是指掩碼了,我的理解爲指定的意思)!
②interface裏 記着要選你鏈接外網那個卡,我這裏分了「local和public」,因此選public
③ 其餘的無論,咱們來看最重要的東西拉,Max limit ,這個東西是你限制的上限,注意的是 這裏的數值是比特位,好比我要限制 下載的速度爲 500K 那麼就填入多少呢? 500 X 1000 X 8=400 0000=4M。
④ 另外,不少朋友都有個疑問,到底通常的用戶會有多大流量呢?通常的網絡遊戲,如 夢幻西遊 傳奇 封神榜 等等,其下行在 20Kbps之內! 最耗網絡資源的就是下載-----咱們就是爲了限制它拉,其次是VOD點播,通常DVD格式的大約要 2M多吧,因此你看狀況限制拉 別搞的太絕!!!
限速腳本:
:for aaa from 2 to 254 do={/queue simple add name=(queue . $aaa) dst-address=(192.168.0. . $aaa) limit-at=0/0 max-limit=2000000/2000000} 說明:
aaa是變量
2 to 254是2~254
192.168.0. . $aaa是IP
上兩句加起來是192.168.0.2~192.168.0.254
connection-limit=50是線程數這裏爲50
max-limit=2000000/2000000是上行/下行
使用:
WinBox-System-Scripts-+
Name(腳本名程)
Source(腳本)
OK-選擇要運行的腳本-Run Script
ROS限速的極致應用
通常咱們用ros限速只是使用了max-limit,其實ros限速能夠更好的運用。好比咱們但願客戶打開網頁時速度能夠快一些,下載時速度能夠慢一些。ros2.9就能夠實現。
max-limit------咱們最經常使用的地方,最大速度
burst-limit--------突破速度的最大值
burst-thershold--------突破速度的閥值
burst-time-------突破速度的時間值
解釋一下圖片的限制意義
當客戶機在30秒(burst-time)內的平均值小於突破速度閥值(burst-thershold)180K時,客戶機的最大下載速率能夠超過最大 限速值(max-limit)200K,達到突破最大值(burst-limit)400K,若是30秒內平均值大於180K,那客戶機的最大速度只能達 到200K。
這樣也就是當咱們開網頁時能夠獲得一個更大的速度400K,長時間下載時速度只能獲得200K,使咱們的帶寬能夠更有效的利用
動態限速
ROS動態限速(檢測外網總速度進行限速開關)廢話不說先看腳本原理:
如下操做所有在WINBOX界面裏完成
介紹:能夠實如今總速度不超過9M的狀況下自動關閉全部生成的限速規則在總速度超過18M的時候自動啓動全部生成的限速規則。
說明:在輸入腳本內容時不要把兩邊的()帶上,那個是爲了區分非腳本字符。
總速度=你的外網網卡當前速度。
打開 /system/scripts
腳本:
:for aaa from 1 to 254 do={/queue simple add name=(ip_ . $aaa) dst-address=(192.168.0. . $aaa) inter max-limit=256000/800000 burst-limit=1000000/3000000 burst-threshold=128000/512000 burst-time=30s/1m }
上面是生成限速樹,對網段內全部IP的限速列表!
下面進入正題:
腳本名:node_on
腳本內容:(:for aaa from 1 to 254 do={/queue sim en [find name=(ip_ . $aaa)]})
腳本名:node_off
腳本內容:(:for aaa from 1 to 254 do={/queue sim dis [find name=(ip_ . $aaa)]})
scripts(腳本部分)以完成
打開 /tools/traffic monitor
新建:
名:node_18M traffic=received trigger=above on event=node_on threshold:18000000
新建:
名:node_9M traffic=received trigger=below on event=node_off threshold:9000000
在輸入腳本內容時不要把兩邊的()帶上,那個是爲了區分非腳本字符。
RO映射
ip-firewall-Destination NAT
General-In. Interface all(若是你是撥號的就選擇pppoe的、固定IP選擇all便可)
Dst. Address:外網IP/32
Dst. Port:要映射的端口
Protocol:tcp(若是映射反恐的就用udp)
Action action:nat
TO Dst.Addresses:你的內網IP
TO Dst.Ports:要映射的端口
ip假裝
ip-firewall-Source NAT
Action Action:masquerade(IP假裝)
迴流(由於假如說在本網吧作SF須要迴流)
ip-firewall-Source NAT
在general-Src.address: 192.168.0.0/24 這裏特殊說明下 內網ip段 24表明定值不可修改
RO的IP:mac綁定
綁定:foreach i in=[/ip arp find dynamic=yes ] do=[/ip arp add copy-from=$i]
解除綁定:foreach i in=[/ip arp find ] do=[/ip arp remove $i]
完了在interfaces裏面選擇內網在選擇reply-only
RO設置的備份(兩總方法)
files-file list
backup便可(能夠到你的ftp裏面找)
背份資料命令行:system回車
backup回車
save name=設置文件名 回車
資料恢復命令
system回車 backup回車 load name=文件名 回車