juniper常用命令


Juniper防火牆基本命令

 

get interface ethernet0/0  查看 端口

常用查看命令 Get int

查看接口配置信息 Get int ethx/x

查看指定接口配置信息  Get mip
查看映射ip關系  Get route
查看路由表  Get policy id x
查看指定策略 Get nsrp
查看nsrp信息,后可接參數查看具體vsd組、端口監控設置等
Get per cpu de

查看cpu利用率信息   Get per session de

查看每秒新建會話信息 Get session

查看當前會話信息,后可匹配源地址、源端口、目的地址、目的端口、協議等選項
 Get session info
查看當前會話數量   Get system

查看系統信息,包括當前os版本,接口信息,設備運行時間等
Get chaiss

查看設備及板卡序列號,查看設備運行溫度

Get counter stat

查看所有接口計數信息
Get counter stat ethx/x

查看指定接口計數信息
Get counter flow zone trust/untrust

查看指定區域數據流信息
Get counter screen zone untrust/trust
查看指定區域攻擊防護統計信息
Get tech-support

查看設備狀態命令集,一般在出現故障時,收集該信息尋求JTAC支持
常用設置命令Set int ethx/x zone trust/untrust/dmz/ha

配置指定接口進入指定區域(trust/untrust/dmz/ha等)
Set int ethx/x ip x.x.x.x/xx

配置指定接口ip地址  Set int ethx/x manage
配置指定接口管理選項,打開所有管理選項
Set int ethx/x manage web/telnet/ssl/ssh

配置指定接口指定管理選項
Set int ethx/x phy full 100mb

配置指定接口速率及雙工方式
Set int ethx/x phy link-down

配置指定接口shutdown
Set nsrp vsd id 0 monitor interface ethx/x

配置ha監控端口,如此端口斷開,則設備發生主/備切換
Exec nsrp vsd 0 mode backup

手工進行設備主/備切換,在當前的主設備上執行
set route 0.0.0.0/0 interface ethernet1/3 gateway 222.92.116.33

配置路由,需同時指定下一跳接口及ip地址
所有set命令,都可以通過unset命令來取消,相當於cisco中的no
所有命令都可以通過“TAB”鍵進行命令補全,通過“?”來查看后續支持的命令


防火牆基本配置
 

create account [admin | user] <username>   回車

輸入密碼:

再次輸入密碼:

configure account admin 回車

輸入密碼:

再次輸入密碼:

2.port配置

config ports <portlist> auto off {speed [10 | 100 | 1000]} duplex [half | full] auto off

3.Vlan配置

無論是核心還是接入層,都要先創建三個Vlan,並且將所有歸於Default Vlan的端口刪除:

config vlan default del port all

create vlan Server

create vlan User

create vlan Manger

定義802.1q標記

config vlan Server tag 10

config vlan User tag 20

config vlan Manger tag 30

設定Vlan網關地址:

config vlan Server ipa 192.168.41.1/24

config vlan User ipa 192.168.40.1/24

config vlan Manger ipa 192.168.*.*/24

Enable ipforwarding 啟用ip路由轉發,即vlan間路由

Trunk 配置

config vlan Server add port 1-3 t

config vlan User add port 1-3 t

config vlan manger add port 1-3 t

4.VRRP配置

enable vrrp

configure vrrp add vlan UserVlan

configure vrrp vlan UserVlan add master vrid 10 192.168.6.254

configure vrrp vlan UserVlan authentication simple-password extreme

configure vrrp vlan UserVlan vrid 10 priority 200

configure vrrp vlan UserVlan vrid 10 advertisement-interval 15

configure vrrp vlan UserVlan vrid 10 preempt

5.端口鏡像配置

首先將端口從VLAN中刪除

enable mirroring to port 3 #選擇3作為鏡像口

config mirroring add port 1 #把端口1的流量發送到3

config mirroring add port 1 vlan default #把1和vlan default的流量都發送到3

6.port-channel配置

enable sharing <port> grouping <portlist> {port-based | address-based | round-robin}

show port sharing //查看配置

7.stp配置

enable stpd //啟動生成樹

create stpd stp-name //創建一個生成樹

configure stpd <spanning tree name> add vlan <vlan name> {ports <portlist> [dot1d | emistp | pvst-plus]}

configure stpd stpd1 priority 16384

configure vlan marketing add ports 2-3 stpd stpd1 emistp

8.DHCP 中繼配置

enable bootprelay

config bootprelay add <dhcp server ip>

9.NAT配置

Enable nat #啟用nat

Static NAT Rule Example

config nat add out_vlan_1 map source 192.168.1.12/32 to 216.52.8.32/32

Dynamic NAT Rule Example

config nat add out_vlan_1 map source 192.168.1.0/24 to 216.52.8.1 - 216.52.8.31

Portmap NAT Rule Example

config nat add out_vlan_2 map source 192.168.2.0/25 to 216.52.8.32 /28 both portmap

Portmap Min-Max Example

config nat add out_vlan_2 map source 192.168.2.128/25 to 216.52.8.64/28 tcp portmap 1024 - 8192

 

10.OSPF配置

enable ospf 啟用OSPF進程

create ospf area <area identifier> 創建OSPF區域

configure ospf routerid [automatic | <routerid>] 配置Routerid

configure ospf add vlan [<vlan name> | all] area <area identifier> {passive} 把某個vlan加到某個Area中去,相當於Cisco中的

network的作用

configure ospf area <area identifier> add range <ipaddress> <mask> [advertise | noadvertise] {type-3 | type-7} 把某個網段加到

某個Area中去,相當於Cisco中的network的作用

configure ospf vlan <vlan name> neighbor add <ipaddress>

OSPF中路由重發布配置

enable ospf export direct [cost <metric> [ase-type-1 | ase-type-2] {tag <number>} | <route map>]

enable ospf export static [cost <metric> [ase-type-1 | ase-type-2] {tag <number>} | <route map>]

enable ospf originate-default {always} cost <metric> [ase-type-1 | ase-type-2] {tag <number>}

enable ospf originate-router-id

11.SNMP配置

enable snmp access

enable snmp traps

create access-profile <access profile> type [ipaddress | vlan]

config snmp access-profile readonly [<access_profile> | none]配置snmp的只讀訪問列表,none是去除

config snmp access-profile readwrite [<access_profile> | none] 這是控制讀寫控制

config snmp add trapreceiver <ip address> {port <udp_port>} community <communitystring> {from <source ip address>} 配置snmp接

收host和團體字符串

12.安全配置

disable ip-option loose-source-route

disable ip-option strict-source-route

disable ip-option record-route

disable ip-option record-timestamp

disable ipforwarding broadcast

disable udp-echo-server

disable irdp vlan <vlan name>

disable icmp redirect

disable web 關閉web方式訪問交換機

enable cpu-dos-protect

13.Access-Lists配置

create access-list icmp destination source

create access-list ip destination source ports

create access-list tcp destination source ports

create access-list udp destination source ports

 

14.默認路由配置

config iproute add default <gateway>

15.恢復出廠值,但不包括用戶改的時間和用戶帳號信息

unconfig switch {all}

 

16.檢查配置

show version

show config

show session

show management 查看管理信息,以及snmp信息

show banner

show ports configuration

show ports utilization ?

show memory/show cpu-monitoring

show ospf

show access-list {<name> | port <portlist>}

show access-list-monitor

show ospf area <area identifier>

show ospf area detail

show ospf ase-summary

show ospf interfaces {vlan <vlan name> | area <area identifier>}

unconfigure ospf {vlan <vlan name> | area <area identifier>}

 

switch

show switch

show config

show diag

show iparp

show iproute

show ipstat

show log

show tech all

show version detail

17.備份和升級軟件

download image [<hostname> | <ipaddress>] <filename> {primary | secondary}

upload image [<hostname> | <ipaddress>] <filename> {primary | secondary}

use image [primary | secondary]

18.密碼恢復。

Extreme交換機在你丟失或忘記密碼后,需要重新啟動交換機,常按空格鍵,進入Bootrom模式,輸入“h”,

選擇“d: Force Factory default configuration”清除配置文件,最后選擇“f: Boot on board flash”

重新啟動后密碼會被清除掉。注意:恢復密碼后,以前的配置文件將會被清空。

對於extreme x450e-48p 進入bootrom 后 輸入h,然后boot 1 回車即可

18.switch licese 的添加:

enable   licese   xxxx-xxxx-xxxx-xxxx-xxxx

會提示添加成功,顯示Advanced Edge為成功

HN-HUAIHUA-ANQUAN-LS1.33 # show licenses

Enabled License Level:

       Advanced Edge

Enabled Feature Packs:

            None

步驟:a,HN-HUAIHUA-ANQUAN-LS1.34 # show version

Switch : 800190-00-04 0804G-80211 Rev 4.0 BootROM: 1.0.2.2 IMG: 11.6.1.9

XGM2-1 :

Image : ExtremeXOS version 11.6.1.9 v1161b9 by release-manager

      on Wed Nov 29 22:40:47 PST 2006

BootROM : 1.0.2.2

其中 0804G-80211 為交換機的serial number

b然后在裝有licese的信封里找到voucher serial number

c根據這兩個serial number 在指定網站上查找liceses 的key 共16位,

d然后 enable   licese 輸入key值即可

NS系列防火牆安裝與管理
NetScreen防火牆支持多種管理方式:WEB管理,CLI (Telnet) 管理等,由於一般調試工作中,我們最常用的也就是前面兩種。

(ScreenOS 4.0)  首先,使用CONSOLE口進行配置

1.把配送的線的一端插在防火牆的CONSOLE口,線的另一端插在轉換插頭后插在PC的串行口上。

2.打開WINDOWS的附件-》通訊-》超級終端,選擇插有CONSOLE線的串口連接。(設置串口屬性:9600-8-無-硬件)

3.出現提示符號后輸入帳號密碼進入設置命令行界面。(默認帳號:Netscreen;密碼Netscreen)

4.進入Netscreen命令行管理界面

Web管理連接設置

1.設置接口IP;
若所有接口均未配置IP(Netscreen設備初始化設置),需設置一個端口IP,用於連接web管理界面,這里設置trust端口;在命令行模式下輸入:
ns5XT->set int trust ip *

命令說明: A.B.C.D為IP地址,通常設置為一個內網地址,E 為IP地址的掩碼位,通常設為24。

此時通過get interface命令可以看到端口狀態的信息(類似CISCO SHOW 接口命令)

2.啟動接口的web管理功能;
ns5XT->set int trust manage web

3.連通PC和防火牆間的網絡,通過瀏覽器的web界面進行具體功能設置 DW,

建立對於NS-5,NS-10,NS-100防火牆,PC與trust口,DMZ口采用直通電纜連接,PC與untrust口的連接采用交叉線。對於NS-25,NS-200及以上產品,PC與防火牆所有端口的連接都采用直通電纜。

注意:將PC網卡的IP地址設置成與防火牆相應端口的管理IP同一個網段內;

打開IE瀏覽器,鍵入防火牆的管理IP,打開登陸畫面;

防火牆基本設置:

1.設置訪問超時時間: Web:  在Web中的Configuration>Admin>Management中的Enabel Web Management Idle Timeout 中填入訪問超時的分鍾數,並在前面打勾。
CLI:
NS5XT->set admin auth timeout 2.Netscreen的管理權限: 設置超級管理員(Root)
WEB:
進入Configuration>Admin>Administrators ,在這里可以管理所有的管理員。
CLI: D NS5XT->set admin name
NS5XT->set admin password

添加本地管理員 WEB:
點擊New鏈接,打開配置頁。輸入管理員登錄名和密碼,指定權限(可選ALL或Read_ONLY,ALL表示該管理員具有更改配置的權限,READ_ONLY表示該管理員只能查看配置,無權更改)。

CLI: D NS5XT->set admin user password privilege < p>
 

3.設置DNS Web:打開Network>DNS頁面,可配置Host Name(主機名),Domain Name(域名),Primary DNS Server(主域名服務器),Second DNS Server(副哉名服務器),還有DNS每天更新的時間。配置完后按Apply按鍵實施。 
NS5XT->set hostname hMRr6

NS5XT->set domain B
NS5XT->set DNS host

4.設置Zone(安全區域)   Web:

打開Network>Zones頁面,可配置已存在於Netscreen設備的所有Zone(並不是所有Zone都可以配置,有許多默認的Zone 是不允許配置的,在Configure中不會出現Edit)。按New按鍵可以新增一個Zone。 CLI: ho NS5XT->set zone vrouter OWV6jS
 

5.設置Interface(接口) v

WEB:打開Network>Interfaces,選擇需要配置的接口對應的屬性頁(有四個可選接口Trust、Untrust、DMZ和Tunnel,其中Trust、Untrust和DMZ為物理接口,Tunnel接口為邏輯接口,用於VPN。對於ns-5系列防火牆,無DMZ端口)。

點擊對應接口Configure列中的Edit鏈接,打開接口配置窗口。(對於不同模式的Interface,進入后的配置會不同,這里用NAT模式做例子,透明模式會少一些配置的內容) Zone name: 設置從屬的安全區域;

IP Address/Netmask:設置接口的IP和掩碼; Manage IP:設置該接口的管理用IP,該IP必須與接口IP處在同一個網絡段中,如果系統IP被設為0..0.0.0,則該Manage IP默認為接口IP。

Interface Mode:設置接口模式,僅trust接口具有該項。可以選擇NAT模式或Route模式。當trust接口工作在NAT模式時,任何進入該接口的數據包都會被強制做地址轉換。當接口工作在Route模式時,防火牆的默認工作相當與一台路由器,如果要將防火牆實現基於策略的NAT功能,請將trust接口設置成此模式。  Management Services:選中或清除web、telnet、snmp等復選框可以啟用或禁止該接口的相應管理功能。如清除web復選框,再點擊save按鈕后,該接口的web管理功能關閉,用戶無法通過該接口的管理ip進入web管理界面,同時在該接口上的所有web管理連接都將丟失。 wF=W .da2

 

設置完成后點擊Apply按鈕記錄設置。
 CLI:

設置接口IP:
NS5XT->set interface ip

設置接口網關: $NS5XT->set interface < trust|untrust|dmz > gateway J

啟動接口的管理功能:
NS5XT->set interface manage

關閉接口的管理功能:
NS5XT->unset interface manage

設置Trust接口工作模式: NS5XT->set interface trust

結合CLI和WEB方式,我們能很輕松的將NS搞定。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM