2014年3月10日 星期一

VRRP

(VRRP:Virtual Router Redundancy Protocol)
虛擬路由器冗餘協議(VRRP)是一種選擇協議,它可以把一個虛擬路由器的責任動態分配到區域網上的 VRRP 路由器中的一台。控制虛擬路由器 IP 地址的 VRRP 路由器稱為主路由器,它負責轉發數據包到這些虛擬 IP 地址。一旦主路由器不可用,這種選擇過程就提供了動態的故障轉移機制,這就允許虛擬路由器的 IP 地址可以作為終端主機的默認第一跳路由器。使用 VRRP 的好處是有更高的默認路徑的可用性而無需在每個終端主機上配置動態路由或路由發現協議。(http://www.twwiki.com/wiki/VRRP)

Juniper 

EX-3200 為例

Virtual IP : 192.168.1.10
第一台 IP : 192.168.1.11
第二台 IP : 192.168.1.12

#set vlans VLAN10 vlan-id 10
#set vlans VLAN10 l3-interface vlan.10

第一台
#set interfaces vlan unit 10 family inet address 192.168.1.11/24
#set interfaces vlan unit 10 family inet address 192.168.1.11/24 vrrp-group 0 virtual-address 192.168.1.10
#set interfaces vlan unit 10 family inet address 192.168.1.11/24 vrrp-group 0 priority 200
 ***priority 高的為 Master***


第二台
#set interfaces vlan unit 10 family inet address 192.168.1.12/24
#set interfaces vlan unit 10 family inet address 192.168.1.12/24 vrrp-group 0 virtual-address 192.168.1.10
#set interfaces vlan unit 10 family inet address 192.168.1.12/24 vrrp-group 0 priority 100

>show vrrp


Cisco

第一台
R1(config)# interface ethernet0/1
R1(config-if)# ip address 192.168.1.11 255.255.255.0
R1(config-if)# vrrp 1 ip 192.168.1.10
R1(config-if)# vrrp 1 priority 200
R1(config-if)# vrrp 1 authentication md5 key-string cisco
R1(config-if)# no shut

第二台
R2(config)# interface ethernet0/1
R2(config-if)# ip address 192.168.1.12 255.255.255.0
R1(config-if)# vrrp 1 ip 192.168.1.10
R1(config-if)# vrrp 1 priority 100
R2(config-if)# vrrp 1 authentication md5 key-string cisco
R2(config-if)# no shut

2014年2月18日 星期二

NTP DDOS 攻擊

2014年2月出現在歐洲的新攻擊方式,基本上跟 DNS DDOS 攻擊很像

http://technews.tw/2014/02/11/united-states-warning-through-scheduled-server-ntp-new-ddos-hack-attack-tactics/

http://ssorc.tw/?p=4236

http://blog.gslin.org/archives/2014/02/13/4254/%E6%9C%80%E8%BF%91%E7%9A%84-ntp-attack-%E7%9A%84%E6%AA%A2%E6%B8%AC/

http://blog.cloudflare.com/understanding-and-mitigating-ntp-based-ddos-attacks

http://www.computerweekly.com/news/2240214216/NTP-based-DDoS-attacks-a-concern-says-Cloudflare

解決辦法
http://www.team-cymru.org/ReadingRoom/Templates/secure-ntp-template.html

Juniper 的設定方法,Firewall Filter (類似 Cisco ACL)

remote-login ( filter name )
allow-ntp、 deny-ntp ( term name )


set firewall family inet filter remote-login term allow-ntp from source-address 59.124.196.84/32          //設定來源IP

set firewall family inet filter remote-login term allow-ntp from protocol udp          //設定來源協定

set firewall family inet filter remote-login term allow-ntp from destination-port ntp     //目的地port

set firewall family inet filter remote-login term allow-ntp then accep     //符合條件的話允許通過

下列的 term 不同,因為一個 port 只能套用一條 filter ,因此想要設定多項過濾設定就必須用 term 來做區分。

set firewall family inet filter remote-login term deny-ntp from protocol udp     //設定來源協定

set firewall family inet filter remote-login term deny-ntp from destination-port ntp     //目的地port

set firewall family inet filter remote-login term deny-ntp then discard     //符合條件的話就阻擋

set interfaces lo0 unit 1 family inet filter input remote-login     //套用在 lookback 1的 port 上

set system ntp server 59.124.196.84 prefer     //設定 NTP Server IP ,prefer 為優先使用

set system ntp server 192.168.1.254     //設定 NTP Server IP

set system ntp source-address 192.168.1.1     //限制 NTP 的封包來源




上面是 switch 的設定,下列是 route的設定,只差在開頭不同。

set firewall filter ntp term allow-ntp from source-address 59.124.196.84/32
set firewall filter ntp term allow-ntp from protocol udp
set firewall filter ntp term allow-ntp from destination-port ntp
set firewall filter ntp term allow-ntp then accept
set firewall filter ntp term deny-ntp from protocol udp
set firewall filter ntp term deny-ntp from destination-port ntp
set firewall filter ntp term deny-ntp then discard
set firewall filter ntp term not-ntp then accept

2013年12月10日 星期二

Solaris

關機相關指令

init 0     --OK mode

init 5     --關機

init 6     --重新開機


網路

vi /etc/hosts          --修改 IP

::1     localhost
127.0.0.1       localhost      
192.168.1.1     dns-backup      loghost

vi /etc/netmasks          --修改 mask

192.168.1.0      255.255.255.0

grep network /etc/path_to_inst          --查網卡名稱

ifconfig -a     --

2013年10月29日 星期二

Juniper Firewall - ISG-1000、SSG-550

 指令

 get config | include 3389          //顯示設定,並只顯示有關鍵字 "3389" 的設定

 Juniper-6350


set routing-options static route 192.168.5.74/32 discard          //封鎖此 IP



Juniper-ISG1000


set interface "Inter1" mip 10.10.10.50 host 192.168.10.100 netmask 255.255.255.255 vr "trust-vr"          //設定內部 IP 轉址

set address "Untrust" "_1.1.1.15/32" 1.1.1.15 255.255.255.255 "測試用"          //設定外部要連進來的 IP

set service "TCP_80&443" protocol tcp src-port 0-65535 dst-port 80-80          //設定 port

set service "TCP_80&443" + tcp src-port 0-65535 dst-port 443-443          //在同樣名字裡附加其他 port

set policy id  from "Untrust" to "Trust"  "_1.1.1.15/32" "MIP(61.60.127.179)" "TCP_80&443" permit log          //設定 police 允許從外部 IP 連線並經由 MIP 轉址進到內部 Server




Ins5 SSG-550 新增IP


set address "Untrust" "_192.168.5.58/32" 192.168.5.58 255.255.255.255


2013年10月28日 星期一

WAF 網路應用程式防火牆

WAF 網路應用程式防火牆

http://www.amxecure.com/index.php/zh/securecontrol/476-securespherewaf

http://www.informationsecurity.com.tw/article/article_detail.aspx?aid=7276

http://www.techbang.com/posts/1826-waf-web-host-bridge-is-falling-down

作個記錄

2013年2月19日 星期二

Cisco 中文操作手冊

從別人那裏 A 來的隨機器附送的 Cisco中文操作手冊,非常薄的一本,只有簡單的內容

基本設定 :

使用 console port 登入設備 :

一條 USB 轉 RS-232 ( 公頭 ) ( 現在 NB 大多取消了 console port ),一條 RJ-45 轉 console port ( 母頭 ) ( 有些較新的機器 console port 改成使用 RJ-45 的接頭,購買時都會附上一條 RJ-45 轉 console 的轉接線 )。

軟體 :

Windows XP : 內建超級終端機

Windows Vista、7、8 : 建議使用 puttyTeraterm。( 個人是使用 SecureCRTXshell4,可以自動記錄文字成 txt 檔 )


連線設定

Baud rate : 9600
Date : 8 bit
Parity : none
Stop : 1 bit

連線後會要輸入帳號密碼,預設值是 帳號 : admin 密碼 : (無),Web : 帳號 : (無) 密碼 : cisco

連線成功後會進入使用者模式 ( Switch> ),輸入 : enable 後會進入特權模式 ( Switch# ),再輸入 : configure terminal 會進入配置模式 ( Switch(config)# )。


清除所有設定

switch# write erase ( 清除 startup configuration , 執行後 startup configuration回復出廠值 )


建立 VLAN

建立 vlan 2 並命名為 line2

switch# conf t
switch(config)# vlan2
switch(config-vlan)# name line2
switch(config-vlan)# exit

switch# show vlan brief

將 Fa0/1 及 Fa0/2 加入 vlan2 ,並將 Fa0/19 - 24 設定為 Trunk port ( 802.1Q )

switch# conf t
switch(config)# interface range fastethernet0/1-2
switch(config-if-range)# swithport access vlan2
switch(config-if-range)# switch mode access
switch(config-if-range)# exit

switch(config)# interface range fastethernet0/19-24
switch(config-if-range)# swithport trunk encapsulation dot1q
switch(config-if-range)# switch mode trunk
switch(config-if-range)# exit

switch# show vlan brief


啟動 L3 Switch 繞送服務

在未設定的情況下,各 vlan 是無法互通的,必須要輸入指令才能像 Router 一樣在不同 vlan 及網段中繞送封包

switch(config)# ip routing


設定 時間、NTP ( 網路時間設定 )

時間 :
switch# clock set 16:10:40 23 September 2013

時區 :
switch(config)# clock timezone TW +8

指定 debug 檔及 log 檔加上時間標記
switch(config)# service timestamps debug datetime localtime
switch(config)# service timestamps log datetime localtime

檢視 :
switch# show clock

NTP :
switch(config)# ntp int0     ---     設定 NTP 來源介面為 int0

switch(config)# ntp server 10.10.10.10   ---   連線到外部的NTP Server 自動更新時間 ( 可設定
                                                               多台 )

switch(config)# ntp peer 192.168.0.5   ---   設定內部網路的 IP 位置,當有其他設備已經連到
                                                              NTP Server 時,可以用這指令跟那台設備同步時間,
                                                              這指令可以同時設定多個。


檢視 :
switch# show ntp status
switch# show ntp peer
switch# show ntp associations



這薄薄一本幾乎都是教用快速設定或設定精靈........

2012年12月4日 星期二

Fortigate-300A 韌體升級 - Part2

將升級過程遇到的一些問題及解決過程做個紀錄  (現在暫時憑記憶作筆記,內容有些會有誤)

原始版本 : Fortigate-300A 4.0 MR1-Patch10

1. 先將 NB 直接接上防火牆並用 WEB GUI 登入。

2. 從韌體版本下方的按鈕按更新後選擇 MR2 的檔案,按下確認後,
    就會開始更新並自動重開機。

**問題**     自動重開後,就無法進入 WEB,從 Console 進入發現設定被清空還原至出廠狀態

開始解決 :

1.從手冊上,port 1 預設 192.168.1.99/24 ,將 NB 改成 192.168.1.100/24,ping 成功,但是
   仍然無法進入 WEB。

2.從機器前面板還原至出廠預設值,依舊 ping 成功,WEB 失敗。

3.測試另外一組預設 IP,192.168.100.99/24,ping 成功,WEB 失敗。

4.Console 進入,原廠預設帳號 : damin ,密碼 : (空白)

5.輸入指令 :
      #config system interface

      #edit port1

      #acc http https            -- 開啟 port 1 的 WEB 功能

      #end

      #show system interface       -- 確認 port 1 的 https 有開啟

6.問題無解決,只好刪除韌體並使用 TFTP 重新載入。

步驟 :

一、機器關閉電源重新開機,在開機中跑出 "Enter any key....." 時,按下空白鍵。

二、按 G 選擇刪除韌體。

三、按 E 從 TFTP 載入韌體,先輸入 TFTP Server IP (NB的IP),第二空格按 ENTER 跳過,
       接著輸入韌體名稱,包含副檔名,版本為 MR2-Patch1。

四、更新完後選擇 D ,使用預設的設定。

等機器重開機完後,使用 192.167.1.100/24,連上 port 1,登入 https://192.168.1.99 成功。


更新至最新版本韌體 :

1. 重複動作更新自動重開即可,設定檔回復後,就算升級韌體設定也不會消失

2.經過測試從 MR2-Patch1 > Patch4 > Patch7 > Patch10 > Patch13 ,一次跳過 2個更新
   可以正常使用,跳再多則無法保證。( 原廠建議一次最多跳 2、3個版本 )


結論 : 結果還是不知道是 MR2 這版本檔案有問題,還是因為從 MR1 轉到 MR2 的關係
          才會有問題,只能等以後有機會再來測試。

Fortigate-300A 韌體升級

紀錄升級 Fortigate-300A 防火牆的些過程,它的授權已經過期,要先上官網延長授權。

先到官網 http://www.fortinet.com 的下方進入支援網頁


在支援網站選擇 Reqister/Renew

登入帳號密碼

輸入 Contract Registration Code , 這在授權書上會有
接下來再輸入機器的序號,FG300Axxxxxxxxxx 等16碼,這在機器背面的貼紙上。(因已先註冊完成所以無附圖)

中間會跳出同意書按確認後,即授權成功。


之後選擇 Manage/View Products ,可以看見帳號下有哪些機器註冊

像此圖下方有台 FG300A 的 Firewall ,後面有授權到期時間,點機器進去還可以看到詳細
資料


再來是下載韌體,將指標移到 Download 上,選擇 Firmware Images 選項,然後點選下方的 FortiGate

點選後會連接到 FTP,之後就去各版本尋找機器相對應的韌體

在 4.0 的 MR1 Patch10 下,有著現在使用的韌體

 ***注意事項***      

原廠建議要升級韌體一定要按照順序升上去,如下圖的 MR2,要升級到 Patch13 的話就要從 MR2 、MR2 Patch1 ~~ 一路升級到 MR2 Patch13,中間可以稍微跳個 2、3 號,像是 Patch 1、Patch 3、Patch 5、Patch 8 這樣下去,不過如果時間足夠的話建議還是一個一個升上去比較保險。

2012年11月20日 星期二

20121121 cisco 3560-x series

設定 L3 switch 的 IP 繞送

switch(config) # interface GigabitEthernet 0/1
switch(config-if) # no switchport                                   **--重要--** 切換後才能設定 IP
switch(config-if) # ip address X.X.X.217 255.255.255.252
switch(config-if) # no sh


switch(config) # interface vlan1
switch(config-if) # ip address Y.Y.Y.30 255.255.255.224
switch(config-if) # no sh


switch(config) # interface range GigabitEthernet 0/2 - 24         --一次將 port 2~24 全部 no sh
switch(config-if) # no sh


switch(config) # ip route 0.0.0.0 0.0.0.0 X.X.X.218
switch(config) # ip route Y.Y.Y.0 255.255.255.224 Vlan1     --後面不能直接指定 VLAN 的 IP

switch(config) # ip routing                               **--重要--** 要打這行指令才會開啟 IP 繞送


switch # copy run sta

20121120 Juniper EX-2200

將工作上設定的一些指令貼上,設定一台 L3 switch

set system root-authentication encrypted-password "~!@#"          --設定 root 密碼(自動加密)

set interfaces interface-range lan member-range ge-0/0/1 to ge-0/0/23       --將port1~23加入lan群組

set interfaces interface-range lan unit 0 family ethernet-switching vlan members lan      --將 lan 群組加入名為 lan 的 VLAN 中

set interfaces ge-0/0/0 unit 0 family inet address X.X.X.165/30     --設定 port 0 的 IP

set interfaces vlan unit 16 family inet address Y.Y.Y.190/26       --設定 VLAN 16 的 IP

set routing-options static route 0.0.0.0/0 next-hop X.X.X.166        --預設的靜態路由

set routing-options static route Y.Y.Y.128/26 next-hop Y.Y.Y.190       --返回的路由設定

set vlans default l3-interface vlan.0             --開啟 VLAN 1 的 L3 繞送

set vlans lan vlan-id 16             --建立 VLAN 16

set vlans lan l3-interface vlan.16             --開啟 VLAN 16 的 L3 繞送

2012年7月5日 星期四

Juniper SRX-100

預設帳號 : root    密碼 : (空)    IP : 192.168.1.1

密碼復原 :

1. 正面電源鈕開機,然後快速按下空白鍵,輸入 =》bootd

2. 輸入後再次按下空白鍵,並輸入 Loader > boot -s

3. 看見提示 for/bin/sh 時,輸入 recovery

4. 進入系統後,刪除 root 密碼  root# delete system root-authentication

5. 重新輸入密碼 root# set system root-authentication plain-text-password   ,然後 commit


設定 IP :
#set interfaces vlan unit 0 family inet address 192.168.0.1/24

#set interfaces fe-0/0/0 unit 0 family inet address 192.168.1.1/24

#set interfaces fe-0/0/1 unit 0 family inet address 192.168.0.254/24

** 設定 fe-0/0/1 時,要先刪除原本的 family **
#delete  interfaces fe-0/0/1 unit 0 family


靜態路由 : 

#set routin-options static  route 0.0.0.0/0 next-hop 192.168.0.254


刪除不用的 DHCP :
#delete system services dhcp


防火牆 ( 四行一組 ) ( any-to-any 作為範例 )

設定 trust 至 untrust 的來源 IP : ANY
#set security policies from-zone trust to-zone untrust policy truse-to-untrust match source-address any

設定 trust 至 untrust 的目的 IP : ANY
#set security policies from-zone trust to-zone untrust policy truse-to-untrust match destination-address any

設定 trust 至 untrust 的協定 : ANY ( 如 : ping、https、ssh )
#set security policies from-zone trust to-zone untrust policy truse-to-untrust match application any

設定此項為 permit ( 允許 )
#set security policies from-zone trust to-zone untrust policy truse-to-untrust then permit



設定 untrust 至 trust 的來源 IP : ANY
#set security policies from-zone untrust to-zone trust policy truse-to-untrust match source-address any

設定 untrust 至 trust 的目的 IP : ANY 
#set security policies from-zone untrust to-zone trust policy truse-to-untrust match destination-address any

設定 untrust 至 trust 的協定 : ANY ( 如 : ping、https、ssh )
#set security policies from-zone untrust to-zone trust policy truse-to-untrust match application any

設定此項為 permit ( 允許 ) 
#set security policies from-zone untrust to-zone trust policy truse-to-untrust then permit


開啟 WAN 的 ping 功能
#set security zones security-zone untrust interfaces fe-0/0/0.0 host-inbound-traffic system-services ping

#set security zones security-zone untrust interfaces fe-0/0/0.0 host-inbound-traffic system-services https

#set security zones security-zone untrust interfaces fe-0/0/0.0 host-inbound-traffic system-services http

2012年6月5日 星期二

VLAN - trunk 與 access 差別

  • access links : 指的是只屬於一個VLAN,且僅向該VLAN轉發封包的端口,也叫做native VLAN。switches 把封包發送到access-link設備之前, 移去任何的VLAN信息。而且access-link設備不能與其他 VLAN 溝通, 除非封包由 L3 的設備轉送。

  • trunk links : 指的是能夠轉發多個不同VLAN的通信的端口。1條最多可以攜帶1005個VLAN信息。trunk link使你的單獨的 1個端口同時成為數個VLAN的端口。






2012年5月22日 星期二

Juniper

預設帳號 : root
預設密碼 : no

%cli                                   //進入 cli 介面模式
>configure  或  >edit       //進入特權模式
>show system processes extensive     //工作管理員

基本設定
#edit system                                   //進入 system 目錄
#set host-name switch                   //設定主機名稱
#set root-authentication plain-text-password             //設定 root 管理帳號密碼 (之後才能存檔)
#set system login user (name) class super-user       //設定使用者為超級己用者
#set system login user (username) authentication plain-text-password (password)   
//設定使用者密碼

*** 設定密碼時使用 plain-text-password自動進行加密,之後 show 設定時會顯示亂碼***

#commit                                    //儲存設定
#commit check                         //儲存設定並檢查語法是否有錯誤
#rollback 0                                //回到running config,還沒commit的設定全部都會消失
#rollback 1                                //回到上一次commit設定
# show | compare rollback 0   //確認與上次儲存的差異

>request system halt (power-off)   //關機
>request system reboot                   //重新開機

#load factory-authentication            //回復出廠預設值
#set system root-authentication plain-text-password       
//需先設定root密碼再commit才會回復出廠預設值

>request system storage cleanup     //清除硬碟內的檔案及log(設定不變)

#set services telnet                                        //啟動 Telnet 服務
#set services ssh                                           //啟動 SSH 服務
#set services web-management http           //啟動 Web 服務 (使用 Web 介面進行管理)
預設 IP : 192.168.1.1
#set time-zone Asia/Taipei                           //設定時區

#set routing-options static route 0.0.0.0/0 next-hop 192.168.1.254     //指定 DefaultGateway
#set routing-options static route 192.168.10.0/24 next-hop 192.168.1.254  //新增一筆靜態路由
#set interfaces me0 unit 0 family inet address 192.168.1.254            //指定管理介面 IP Address

# set interface ge-0/0/0 unit 0 family inet address.192.168.1.1/24         //設定ip
# delet interface ge-0/0/0 unit 0 family inet address.192.168.1.1/24      //刪除ip


設定 VLAN
#set vlans (name) vlan-id (id)                                                                          //新增一個VLAN (name不能只有數字)
#set interfaces vlan unit (id) family inet address 192.168.1.254/24           //設定VLAN IP
#set vlans (name) l3-interface vlan (id)                                                           //將此VLAN設為L3層
#set interface ge-0/0/0 unit 0 family ethernet-switching vlan members (id)   //將port加入VLAN
#set interface interface-range (name) member-range ge-0/0/0 to ge-0/0/23   
//將多個port加入VLAN


設定 LACP
#set chassis aggregated-devices ethernet device-count 1                             //指定數量
#set interfaces ge-0/0/1 ether-option 802.3ad ae0                                          //指定 LAG port
#set interfaces ge-0/0/2 ether-option 802.3ad ae0                                          //指定 LAG port
#set interfaces ae0 aggregated-ether-options lacp active                              //設定 LACP port
#set interfaces ae0 aggregated-ether-options lacp periodic fast                   //設定 LACP port
#set interfaces ae0 unit 0 family ethernet-switching port-mode access         //設定存取模式
#set interfaces ae0 unit 0 family ethernet-switching vlan members VLAN2   //設定 VLAN
#show interface terse | grep ae                                                                            //檢視 LAG port
#show lacp interface                                                                                              //檢視 LACP



設定 SNMP
#set snmp (community-name) public authorization read-only      //指定為 SNMP Server

#set snmp trap-group trap targets 192.168.1.1                            // 加入 SNMP Server 



 Loader 下更新 OS
一、檔案在 USB 根目錄 ( 沒試過幾次 )

  1.開機時狂按空白鍵進入 loader>

  2.loader> install  file:///jinstall-ex-2200-11.4R2.14-domestic-signed.tgz

二、使用 TFTP Server

  1.開機時狂按空白鍵進入 loader>

  2.loader> set  ipaddr=192.168.100.1

  3.loader> set  netmask=255.255.255.0

  4.loader> set  serverip=192.168.100.10

  5.loader> show                          --確認 IP 有沒有錯誤

  6.loader> install tftp://192.168.100.10/jinstall-ex-2200-11.4R2.14-domestic-signed.tgz



shell

>start shell

進入shell模式,進入後系統為Linux


 MAC 查 port

>ping 192.168.10.40                                              //先 ping IP 收集 arp 表
>show arp | match 192.168.10.40                        //再從 arp 表用 IP 去找 MAC
>show ethernet-switching table | match MAC     //最後從交換表去查 MAC 是從哪個 port 進來的

過程跟 Cisco 教的一樣,只是指令不同而已


硬碟相關
遇到硬碟容量問題

>show system storage          //檢視資料夾容量,可以看到各資料夾容量大小及使用量

>request system storage cleanup          //清空硬碟,除了設定檔之類必要的以外,其他檔案會被清空,連log都會被清掉


virtual-chassis 堆疊

>show virtual-chassis           //檢視機器堆疊的狀態


>request virtual-chassis vc-port set pic-slot 1 port 0 member 0 //設定1/0/0加入member0的堆疊
>request virtual-chassis vc-port delete pic-slot 1 port 0              //刪除堆疊port


#set virtual-chassis member 0 mastership-priority 255   //設定master值(255為最大)


>request virtual-chassis recycle member-id         //回收member-id


Firewall Filter (類似 Cisco ACL)
會設定這東西是因為 2014年2月開始流行起來的 NTP 的 DDOS 攻擊

remote-login ( filter name )
allow-ntp、 deny-ntp ( term name )


set firewall family inet filter remote-login term allow-ntp from source-address 59.124.196.84/32          //設定來源IP

set firewall family inet filter remote-login term allow-ntp from protocol udp          //設定來源協定

set firewall family inet filter remote-login term allow-ntp from destination-port ntp     //目的地port

set firewall family inet filter remote-login term allow-ntp then accep     //符合條件的話允許通過

下列的 term 不同,因為一個 port 只能套用一條 filter ,因此想要設定多項過濾設定就必須用 term 來做區分。

set firewall family inet filter remote-login term deny-ntp from protocol udp     //設定來源協定

set firewall family inet filter remote-login term deny-ntp from destination-port ntp     //目的地port

set firewall family inet filter remote-login term deny-ntp then discard     //符合條件的話就阻擋

set interfaces lo0 unit 1 family inet filter input remote-login     //套用在 lookback 1的 port 上

set system ntp server 59.124.196.84 prefer     //設定 NTP Server IP ,prefer 為優先使用

set system ntp server 192.168.1.254     //設定 NTP Server IP

set system ntp source-address 192.168.1.1     //限制 NTP 的封包來源

上面是 switch 的設定,下列是 route的設定,只差在開頭不同。

set firewall filter ntp term allow-ntp from source-address 59.124.196.84/32
set firewall filter ntp term allow-ntp from protocol udp
set firewall filter ntp term allow-ntp from destination-port ntp
set firewall filter ntp term allow-ntp then accept
set firewall filter ntp term deny-ntp from protocol udp
set firewall filter ntp term deny-ntp from destination-port ntp
set firewall filter ntp term deny-ntp then discard
set firewall filter ntp term not-ntp then accept