乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      ros 軟路由防火墻規(guī)則

       shaguada 2012-04-05
      routeros防火墻功能非常靈活。routeros防火墻屬于包過濾防火墻,你可以定義一系列的規(guī)則過濾掉發(fā)往routeros、從routeros 發(fā)出、通過routeros轉(zhuǎn)發(fā)的數(shù)據(jù)包。在routeros防火墻中定義了三個防火墻(過濾)鏈(即input、forward、output),你可 以在這三個鏈當中定義你自己的規(guī)則。


             input意思是指發(fā)往routeros自己的數(shù)據(jù)(也就是目的ip是routeros接口中的一個ip地址);

             output意思是指從routeros發(fā)出去的數(shù)據(jù)(也就是數(shù)據(jù)包源ip是routeros接口中的一個ip地址);

             forward意思是指通過routeros轉(zhuǎn)發(fā)的(比如你內(nèi)部計算機訪問外部網(wǎng)絡(luò),數(shù)據(jù)需要通過你的routeros進行轉(zhuǎn)發(fā)出去)。


             禁 止ping routeros,我們一般需要在input鏈中添加規(guī)則,因為數(shù)據(jù)包是發(fā)給routeros的,數(shù)據(jù)包的目標ip是routeros的一個 接口ip地址。(當然如果你硬是要在output里建立一條規(guī)則過濾掉icmp信息也能做到ping不通,當你ping的數(shù)據(jù)包到達routeos 時,routeos能接收這個數(shù)據(jù)包并做出回應(yīng),當routeros回應(yīng)給你的包要發(fā)出去的時候會檢查output的規(guī)則并過濾掉回應(yīng)你的包。)
      在 每條鏈中的每條規(guī)則都有目標ip,源ip,進入的接口(in interface),非常靈活的去建立規(guī)則。比如ROS禁止PING,禁止外網(wǎng)ping你 routeros,只需要在in interface中選擇你連外部網(wǎng)絡(luò)的接口。禁止內(nèi)部ping的話可以選擇連你內(nèi)部網(wǎng)絡(luò)的接口。如果禁止所有的 ping的話,那么接口選擇all。當然禁止ping 協(xié)議要選擇icmp ,action選擇drop或reject。


             另 外要注意的就是,icmp協(xié)議并不是就指的是ping,而是 ping是使用icmp協(xié)議中的一種(我們ping 出去發(fā)送的數(shù)據(jù)包icmp協(xié)議的類型為 8 代碼為0,在routeros中寫為icmp-options=8:0;而我們對ping做出回應(yīng)icmp類型為0 代碼為0),還有很多東西也屬于 icmp協(xié)議。打個比方,如果你禁止內(nèi)部網(wǎng)絡(luò)ping所有外部網(wǎng)絡(luò),可以在forward鏈中建立一條規(guī)則,協(xié)議為icmp,action為drop,其 他默認,那么你內(nèi)部網(wǎng)絡(luò)ping不通外部任何地址,同時如果你用trancroute命令跟蹤路由也跟蹤不了。在做規(guī)則是要注意每一個細節(jié)。


             還有就是,input,output,forward三條鏈在routeros中默認都是允許所有的數(shù)據(jù)。也就是除非你在規(guī)則中明確禁止,否則允許??梢酝ㄟ^ip firewall set input policy=drop等進行修改默認策略
      ros防火墻名詞解釋

      input - 進入路由,并且需要對其處理
      forward - 路由轉(zhuǎn)發(fā)
      output - 經(jīng)過路由處理,并且從接口出去的包


      action:

      1 accept: 接受
      add-dst-to-address-list - 把一個目標IP地址加入address-list

      add-src-to-address-list - 把一個源IP地址加入address-list

      2 drop - 丟棄
      3 jump - 跳轉(zhuǎn),可以跳轉(zhuǎn)到一個規(guī)則主題里面,如input forward,也可以跳轉(zhuǎn)到某一條里面
      4 log - 日志記錄
      5 passthrough - 忽略此條規(guī)則
      6 reject - 丟棄這個包,并且發(fā)送一個ICMP回應(yīng)消息
      7 return - 把控制返回給jump的所在
      8 tarpit - 捕獲和扣留 進來的TCP連接 (用SYN/ACK回應(yīng)進來的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得到特定列表,不同的數(shù)據(jù)流經(jīng)過不同的chain規(guī)則
      要仔細的選對正確的訪問控制. 如果 input 不是非常的確定和一個新的規(guī)則需要添加注釋,
      transfered through the particular connection
      0的意思是無限的,例如 connection-bytes=2000000-0 意思是2MB以上
      connection-limit (integer | netmask) - 地址的傳輸流量控制
      connection-mark (name) - 傳輸中的標記后的數(shù)據(jù)包
      connection-state (estabilished | invalid | new | related) - 連接的狀態(tài)(連接中,不規(guī)則的連接,新的連接,相互聯(lián)系的連接)
      connection-type 連接的類型 (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp)

      content 包的內(nèi)容


      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 - 每秒最大的包數(shù)量
      by Time option
      Time - 時間
      Burst - 突發(fā)的
      Mode -等級優(yōu)先
      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) -跳轉(zhuǎn)
      limit (integer | time | integer) - 限制
      Count - 每秒最大的包數(shù)量
      Time - 突發(fā)的總時間
      log-prefix (text) - 如果還有定義的字符,加入日志
      out-interface (name) - 流出的接口
      p2p (all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | warez
      | winmx) - P2P協(xié)議
      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) -協(xié)議
      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的意思代表包的轉(zhuǎn)發(fā)
      firewall rule-General
               Dst.Address:要屏蔽的端口
               Protocol:tcp
      Action:drop(丟棄)



      ros限速

      手動限速

      winbox---queues----simple queues

      點“+”,NAME里隨便填,下面是IP地址的確定

      ①Target Address 不 管,Dst. Address里填 你要限制的內(nèi)網(wǎng)機器的IP,比如我這里有個 1號機器 IP為 192.168.1.101,那 dst.address 里就填 192.168.1.101 然后是/32(這里的32不是指掩碼了,個人理解為指定的意思)!

      ②interface里 記著要選你連接外網(wǎng)那個卡,我這里分了“l(fā)ocal和public”,所以選public

      ③ 其他的不管,我們來看最重要的東西拉,Max limit ,這個東西是你限制的上限,注意的是 這里的數(shù)值是比特位,比如我要限制下載的速度為 500K 那么就填入多少呢? 500 X 1000 X 8=400 0000=4M。

      ④ 另 外,很多朋友都有個疑問,到底一般的用戶會有多大流量呢?一般的網(wǎng)絡(luò)游戲,如 夢幻西游 傳奇 封神榜 等等,其下行在 20Kbps以內(nèi)! 最耗網(wǎng)絡(luò)資 源的就是下載-----我們就是為了限制它拉,其次是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是線程數(shù)這里為50
      max-limit=2000000/2000000是上行/下行
      使用:
      WinBox-System-Scripts-+
      Name(腳本名程)
      Source(腳本)
      OK-選擇要運行的腳本-Run Script






      ROS限速的極致應(yīng)用


      一般我們用ros限速只是使用了max-limit,其實ros限速可以更好的運用。比如我們希望客戶打開網(wǎng)頁時速度可以快一些,下載時速度可以慢一些。ros2.9就可以實現(xiàn)。






      max-limit------我們最常用的地方,最大速度
      burst-limit--------突破速度的最大值
      burst-thershold--------突破速度的閥值
      burst-time-------突破速度的時間值

      解釋一下圖片的限制意義

      當 客戶機在30秒(burst-time)內(nèi)的平均值小于突破速度閥值(burst-thershold)180K時,客戶機的最大下載速率可以超過最大限 速值(max-limit)200K,達到突破最大值(burst-limit)400K,如果30秒內(nèi)平均值大于180K,那客戶機的最大速度只能達到 200K。

      這樣也就是當我們開網(wǎng)頁時可以得到一個更大的速度400K,長時間下載時速度只能得到200K,使我們的帶寬可以更有效的利用

      動態(tài)限速
      ROS動態(tài)限速(檢測外網(wǎng)總速度進行限速開關(guān))廢話不說先看腳本原理:
      以下操作全部在WINBOX界面里完成
      介紹:可以實現(xiàn)在總速度不超過9M的情況下自動關(guān)閉所有生成的限速規(guī)則在總速度超過18M的時候自動啟動所有生成的限速規(guī)則。
      說明:在輸入腳本內(nèi)容時不要把兩邊的()帶上,那個是為了區(qū)分非腳本字符。
                   總速度=你的外網(wǎng)網(wǎng)卡當前速度。

      打開 /system/scripts
      腳本:
      :for aaa from 1 to 254 do={/queue simple add name=(ip_ . $aaa) dst-address=(192.168.0. . $aaa) interface=wan max-limit=256000/800000 burst-limit=1000000/3000000 burst-threshold=128000/512000 burst-time=30s/1m         }

      上面是生成限速樹,對網(wǎng)段內(nèi)所有IP的限速列表!

      下面進入正題:
      腳本名:node_on
      腳本內(nèi)容:(:for aaa from 1 to 254 do={/queue sim en [find name=(ip_ . $aaa)]})
      腳本名:node_off
      腳本內(nèi)容:(: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
      在輸入腳本內(nèi)容時不要把兩邊的()帶上,那個是為了區(qū)分非腳本字符。



      RO映射
      ip-firewall-Destination NAT
      General-In. Interface all(如果你是撥號的就選擇pppoe的、固定IP選擇all即可)
               Dst. Address:外網(wǎng)IP/32
               Dst. Port:要映射的端口
               Protocol:tcp(如果映射反恐的就用udp)
      Action action:nat
               TO Dst.Addresses:你的內(nèi)網(wǎng)IP
               TO Dst.Ports:要映射的端口



      ip偽裝


      ip-firewall-Source NAT
      Action Action:masquerade(IP偽裝)
      回流(因為假如說在本網(wǎng)吧做SF需要回流)
      ip-firewall-Source NAT
      在general-Src.address: 192.168.0.0/24         這里特殊說明下         內(nèi)網(wǎng)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里面選擇內(nèi)網(wǎng)在選擇reply-only



      RO設(shè)置的備份(兩總方法)


      files-file list
      backup即可(可以到你的ftp里面找)
      背份資料命令行:system回車
      backup回車
      save name=設(shè)置文件名 回車
      資料恢復命令

      system回車
      backup回車
      load name=文件名         回車

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多