1、 Juniper SRX防火墙配备手册一、JUNOS操作系统简介 1.1 层次化配备构造 JUNOS采用基于FreeBSD内核软件模块化操作系统,支持CLI命令行和WEBUI两种接口配备方式,本文重要对CLI命令行方式进行配备阐明。JUNOS CLI使用层次化配备构造,分为操作(operational)和配备(configure)两类模式,在操作模式下可对当前配备、设备运营状态、路由及会话表等状态进行查看及设备运维操作,并通过执行config或edit命令进入配备模式,在配备模式下可对各有关模块进行配备并可以执行操作模式下所有命令(run)。在配备模式下JUNOS采用分层分级模块下配备构造,如
2、下图所示,edit命令进入下一级配备(类似unix cd命令),exit命令退回上一级,top命令回到根级。1.2 JunOS配备管理 JUNOS通过set语句进行配备,配备输入后并不会及时生效,而是作为候选配备(Candidate Config)等待管理员提交确认,管理员通过输入commit命令来提交配备,配备内容在通过SRX语法检查后才会生效,一旦commit通过后当前配备即成为有效配备(Active config)。此外,JUNOS容许执行commit命令时规定管理员对提交配备进行两次确认,如执行commit confirmed 2命令规定管理员必要在输入此命令后2分钟内再次输入comm
3、it以确认提交,否则2分钟后配备将自动回退,这样可以避免远程配备变更时管理员失去对SRX远程连接风险。在执行commit命令前可通过配备模式下show命令查看当前候选配备(Candidate Config),在执行commit后配备模式下可通过run show config命令查看当前有效配备(Active config)。此外可通过执行show | compare比对候选配备和有效配备差别。 SRX上由于配备大容量硬盘存储器,缺省按先后commit顺序自动保存50份有效配备,并可通过执行rolback和commit命令返回到此前配备(如rollback 0/commit可返回到前一commi
4、t配备);也可以直接通过执行save configname.conf手动保存当前配备,并执行load override configname.conf / commit调用前期手动保存配备。执行load factory-default / commit命令可恢复到出厂缺省配备。 SRX可对模块化配备进行功能关闭与激活,如执行deactivate security nat/comit命令可使NAT有关配备不生效,并可通过执行activate security nat/commit使NAT配备再次生效。 SRX通过set语句来配备防火墙,通过delete语句来删除配备,如delete securi
5、ty nat和edit security nat / delete同样,均可删除security防火墙层级下所有NAT有关配备,删除配备和ScreenOS不同,配备过程中需加以留意。1.3 SRX重要配备内容 布置SRX防火墙重要有如下几种方面需要进行配备: System:重要是系统级内容配备,如主机名、管理员账号口令及权限、时钟时区、Syslog、SNMP、系统级开放远程管理服务(如telnet)等内容。 Interface:接口有关配备内容。 Security:是SRX防火墙重要配备内容,安全有关某些内容所有在Security层级下完毕配备,如NAT、Zone、Policy、Address
6、-book、Ipsec、Screen、Idp等,可简朴理解为ScreenOS防火墙安全有关内容都迁移至此配备层次下,除了Application自定义服务。 Application:自定义服务单独在此进行配备,配备内容与ScreenOS基本一致。 routing-options: 配备静态路由或router-id等系统全局路由属性配备。二、SRX防火墙配备对照阐明 方略解决流程图2.1 初始安装 2.1.1 登陆 Console口(通用超级终端缺省配备)连接SRX,root顾客登陆,密码为空 login:root Password:- JUNOS 9.5R1.8 built -07-16 15:
7、04:30 UTC root% cli / /进入操作模式root root configure /进入配备模式 edit Root# 2.1.2 设立root顾客口令 设立root顾客口令 root# set system root-authentication plain-text-password root# new password :root123 root# retype new password:root123 editroot# set system login class super-user idle-timeout 3 设立当前顾客超时时间密码将以密文方式显示 root#
8、 show system root-authentication encrypted-password $1$xavDeUe6$fNM6olGU.8.M7B62u05D6.;# SECRET-DATA注意:强烈建议不要使用其他加密选项来加密root和其他user口令(如encrypted-password加密方式),此配备参数规定输入口令应是经加密算法加密后字符串,采用这种加密方式手工输入时存在密码无法通过验证风险。 2.1.3 设立远程登陆管理顾客 root# set system login user lab class super-user authentication plain-te
9、xt-password /创立顾客labroot# new password :lab123 /配备顾客lab密码root# retype new password:lab123 注:此lab顾客拥有超级管理员权限,可用于console和远程管理访问,另也可自行灵活定义其他不同管理权限顾客。2.1.4 管理SRX有关配备rootshow system uptime /查看时间root#run set date YYYYMMDDhhmm.ss /设立系统时钟root#set system time-zone Asia/beijing /设立时区为北京root#set system host-na
10、me SRX3400-A /设立主机名root#set system name-server 1.1.1.1 /设立DNS服务器root#set system ntp server 202.120.2.101 /设立NTP服务器rootshow ntp associations rootshow ntp status /查看NTProotshow security alg status /查看ALG状态ALG Status : DNS :Enabled FTP :Enabled H323 :Enabled MGCP :Enabled MSRPC :Enabled PPTP :Enabled R
11、SH :Enabled RTSP :Enabled SCCP :Enabled SIP :Enabled SQL :Enabled SUNRPC :Enabled TALK :Enabled TFTP :Enabled IKE-ESP :Disabledroot#set system services ftp root#set system services telnet root#set system services web-management http /在系统级启动ftp/telnet/http远程接入管理服务rootrequest system reboot /重启系统rootre
12、quest system power-off / 关闭系统rootshow version /查看版本信息Model:srx210bJUNOS Software Release 10.4R5.5rootshow system uptime /查看系统启动时间 Current time:-08-11 05:09:15 UTCSystem booted:-08-11 01:12:48 UTC (03:56:27 ago)Protocols started:-08-11 01:15:28 UTC (03:53:47 ago)Last configured:-08-11 03:11:08 UTC (0
13、1:58:07 ago) by root 5:09AM up 3:56,1 user,load averages:0.01,0.02,0.00rootShow chassis haredware /查看硬件板卡及序列号 Hardware inventory:Item Version Part number Serial number DescriptionChassis AC5210AA0079 SRX210bRouting Engine REV 40 AACN5249 RE-SRX210BFPC 0 FPC PIC 0 2x GE,6x FE,1x 3GPower Supply 0root
14、show chassis environment /查看硬件板卡当前状态 Class Item Status MeasurementTemp Routing Engine OK 52 degrees C / 125 degrees F Routing Engine CPU Absent Fans SRX210 Chassis fan OK Spinning at normal speedPower Power Supply 0 OK rootshow chassis routing-engine /查看主控板(RE)资源使用及状态Routing Engine status: Temperatu
15、re 52 degrees C / 125 degrees F Total memory 512 MB Max 415 MB used ( 81 percent) Control plane memory 336 MB Max 306 MB used ( 91 percent) Data plane memory 176 MB Max 107 MB used ( 61 percent) CPU utilization: User 4 percent Background 0 percent Kernel 5 percent Interrupt 0 percent Idle 91 percent
16、 Model RE-SRX210B Serial ID AACN5249 Start time -08-11 01:12:47 UTC Uptime 4 hours,17 minutes,57 seconds Last reboot reason 0x200:chassis control reset Load averages: 1 minute 5 minute 15 minute 0.09 0.05 0.01rootshow system license /查看授权License usage: Licenses Licenses Licenses Expiry Feature name
17、used installed needed ax411-wlan-ap 0 2 0 permanentrootshow system processes extensive /查看系统运用率last pid: 1968; load averages: 0.01, 0.03, 0.00 up 0+04:20:28 05:32:46111 processes:17 running,83 sleeping,11 waitingMem:120M Active,87M Inact,231M Wired,30M Cache,61M Buf,1356K FreeSwap:PID USERNAME THR P
18、RI NICE SIZE RES STATE C TIME WCPU COMMAND 1097 root 4 76 0 194M 34836K select 0 298:05 98.44% flowd_octeon 22 root 1 171 52 0K 16K RUN 0 203:47 84.96% idle:cpu0 24 root 1 -20 -139 0K 16K RUN 0 5:42 0.00% swi7:clock 21 root 1 171 52 0K 16K RUN 1 2:21 0.00% idle:cpu1 5 root 1 -84 0 0K 16K rtfifo 0 1:
19、02 0.00% rtfifo_kern_recv 1109 root 1 76 0 9724K 3796K select 0 0:46 0.00% rtlogd 868 root 1 76 0 7004K 2588K select 0 0:37 0.00% eventd 52 root 1 -8 0 0K 16K mdwait 0 0:34 0.00% md0 1085 root 1 76 0 16984K 10676K select 0 0:29 0.00% snmpd 1088 root 1 76 0 14288K 4788K select 0 0:23 0.00% l2ald 1090
20、 root 2 76 0 4K 6476K select 0 0:22 0.00% pfed 1115 root 1 76 0 4180K 1104K select 0 0:19 0.00% license-check 1087 root 1 4 0 39620K 2K kqread 0 0:15 0.00% rpd 23 root 1 -40 -159 0K 16K WAIT 0 0:15 0.00% swi2:net-(more 39%)-rootmonitor interface ge-0/0/0 /动态记录接口数据包转发信息Interface:ge-0/0/0.0,Enabled,Li
21、nk is UpFlags:SNMP-TrapsEncapsulation:ENET2Local statistics: Current delta Input bytes: 2986416 4121 Output bytes: 47303 90 Input packets: 47631 64 Output packets: 969 1Remote statistics: Input bytes: 94404820 (1896 bps) 6685 Output bytes: 9553700 (952 bps) 2078 Input packets: 111689 (4 pps) 50 Outp
22、ut packets: 59369 (2 pps) 29Traffic statistics: Input bytes: 97391236 Output bytes: , 10806 Next=n,Quit=q or ESC,Freeze=f,Thaw=t,Clear=c,Interface=irootmonitor traffic interface ge-0/0/0 / 动态报文抓取verbose output suppressed,use or for full protocol decodeAddress resolution is ON. Use to avoid any rever
23、se lookup delay.Address resolution timeout is 4s.Listening on ge-0/0/0.0,capture size 96 bytesReverse lookup for 172.56.1.23 failed (check DNS reachability).Other reverse lookup failures will not be reported.Use to avoid reverse lookups on IP addresses.05:41:02.773631 In arp who-has 172.56.1.23 tell
24、 172.56.1.2405:41:02.783007 In arp who-has 172.56.1.21 tell 172.56.1.2405:41:02.787524 In arp who-has 172.56.6.135 tell 172.56.7.305:41:02.884849 In IPX 00000000.00:13:8f:74:bc:19.0455 00000000.ff:ff:ff:ff:ff:ff.0455:ipx-netbios 5005:41:03.437039 In arp who-has 172.56.7.41 tell 172.56.1.2405:41:03.5
25、09837 Out IP truncated-ip - 10 bytes missing!172.56.3.34.55730 .domain: 51866+|domain05:41:03.568547 In STP 802.1d,Config,Flags none,bridge-id 8000.00:06:53:48:8a:80.8010,length 4305:41:03.678096 In IPX 00000000.00:13:8f:74:bc:19.0455 00000000.ff:ff:ff:ff:ff:ff.0455:ipx-netbios 502.1.5 接口初始化接口阐明:roo
26、t% cli /进入操作模式root root show interfaces /查看接口状态调节输出详细限度rootshow intefaces terserootshow interfaces briefrootshow interfaces detailrootshow interfaces extensive /由上到下查看接口信息越来越详细rootshow interfaces detail | match fe-0/0/0 /使用管道符匹配特定核心字roothelp reference security policy-security /查看配备参照信息root help apro
27、pos security /协助搜索核心字有关操作命令root configure /进入配备模式 edit root# root# show interfaces /查看接口配备状态为接口配备IP地址两种办法:set配备:root#set interfaces ge-0/0/0.0 family inet address 1.1.1.1/24 /为接口配备IP地址root#show interfaces ge-0/0/0.0 family inet /查看接口配备address 1.1.1.1./24edit 配备直接指定到某个层级:edit root#edit interfaces ge-
28、0/0/0.0 family inet /在该层级下为接口配备 edit interfaces ge-0/0/0.0 family inetroot#set address 1.1.1.1/24 /配备IP地址edit interfaces ge-0/0/0.0 family inetroot#up /返回上一级,一层一层退出(也可以使用exit和top退出到edit)edit interfacesRoot#showroot # set system syslog file monitor-log any any /创立名字为monitor-log日记 root # set system sy
29、slog file monitor-log match 172.56.3.34 /监控接口root # run monitor start monitor-log /开始监控root #run monitor stop /停止监控删除配备:root#delete interfaces ge-0/0/0.0 /普通删除配备命令root#wildcard delete interfaces fe-0* /通配符匹配删除配备命令matched:fe-0/0/0matched:fe-0/0/1 matched:fe-0/0/2matched:fe-0/0/3matched:fe-0/0/4matche
30、d:fe-0/0/5matched:fe-0/0/6matched:fe-0/0/7delete 8 objecgts?yes,no(no)yes配备address-book (address-book就是为地址命名,以便调用)editroot# edit security zones security-zone outside / 配备outside区域address-bookedit security zones security-zone outsideroot# set address-book address out-address 172.56.3.0/16 /把接口IP放入地址薄
31、out-addressedit security zones security-zone outsideroot# up edit security zonesroot#edit security-zone inside /配备inside区域address-bookedit security zones security-zone insideroot# set address-book address in-address 10.1.1.0/24 /把接口IP放入地址薄in -addressedit security zones security-zone insideroot# exit
32、 edit security zonesroot# exit配备applicationeditroot# edit applications application tcp-1752 /定义服务名字edit applications application tcp-1752root# set protocol tcp source-port 1752 destination-port 1752 /定义合同及端标语editroot# show applications application tcp-1752 protocol tcp; source-port 1752; destination
33、-port 1752;配备application-seteditroot# set applications application-set web-mgt application junos-ssh /配备应用服务集web-mgteditroot# set applications application-set web-mgt application junos-pingeditroot# set applications application-set web-mgt application junos- pc-anywhereeditroot# set applications app
34、lication-set web-mgt application junos-httpeditroot# set applications application-set web-mgt application junos-ftproot# show applications /查看applicationsapplication-set web-mgt application junos-ssh; application junos-ping; application junos-pc-anywhere; application junos-http; application junos-ft
35、p; 替代配备:root#set interfaces ge-0/0/0.0 family inet address 1.1.1.1/24 root# show interfaces ge-0/0/0ge-0/0/0 unit 0 family inet address 1.1.1.1/24root#replace pattern ge-0/0/0 with ge-0/0/1 /一种接口取代另一种接口配备root# show interfaces ge-0/0/1ge-0/0/1 unit 0 family inet address 1.1.1.1/24复制配备:root#set interf
36、aces ge-0/0/0.0 family Ethernet-swithing vlanroot#copy interfaces ge-0/0/0.0 to ge-0/0/1.0 /复制接口配备配备模式下showroot#show /查看配备root#show | display set / 查看set格式配备set version 10.4R5.5set system time-zone asia/beijingset system root-authentication encrypted-password $1$XyydlG84$f46l82dR8C/JHUvzFuq9o.set sy
37、stem name-server 202.96.134.133set system login user lab uid set system login user lab class super-userset system login user lab authentication encrypted-password $1$Y0X8gbap$GZNvirOuGhW.4ZAq4xwHF.set system services sshset system services telnetset system services web-management http interface vlan
38、.0set system services web-management http interface ge-0/0/1.0set system services web-management http interface vlan.3set system services web-management http interface ge-0/0/0.0set system services web-management http interface fe-0/0/4.0set system services web-management https system-generated-certificateset system services web-management https interface vlan.0set system services web-management https interface ge-0/0/1.0set system syslog file nat-log any anyset system syslog file nat-log match RT_FLOW_SESSIONset system