ros防火牆名詞解釋

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=文件名 回車
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章