1、日常show操作
# show 检查所有配置 # show | display set 查看set所有格式配置 # show system | display set 查看set格式的system层级配置 # show system login | display set 查看set格式的system层级下的login层级配置 # run show version # run show route 1.1.1.1 # run ping 1.1.1.1 操作模式命令在配置模式下运行,前加run,类似思科do > show configuration | display set 检查操作模式下正在运行的配置 > show chassis hardware 查看硬件组件信息 > show chassis environment 检查硬件组件的状态 > show chassis routing-engine 检查路由发动机状态 > show chassis fpc pic-status 查看板卡online状态 > show chassis fpc detail 检查板卡的详细状态 > show chassis fan 检查风扇状态 > show system alarms 查看设备报警信息 > show system uptime 查看系统当前时间 > show version 查看软件版本 > show interfaces terse 检查所有接口的简要状态 > show interfaces terse ge-0/0/0 检查指定接口的简要状态 > show interfaces xe-0/0/0 查看指定接口信息 > show interfaces extensive 查看所有接口的详细信息(包括接口)error、队列、速率、物理状态等) > show interfaces extensive xe-0/0/0 查看指定接口的详细信息 > show interfaces diagnostics optics 检查光接口功率 > show chassis pic fpc-slot * pic-slot * 查看光模块厂商、波长、类型 > show chassis hardware 查看设备硬件信息,PIC插槽下各接口模块的类型、SN号 > show vlans 查看vlan信息 > show route 查看路由表 > show route 1.1.1.1 检查指定路由 > show system storage 检查存储空间的使用情况 > show system process extensive 检查系统过程 > show lldp neighbor 查看lldp邻居 > show log messages 查看messages log > show log chassisd 查看chassisd log ####防火墙专用 > show security flow session 查看当前所有会话信息 > show security flow session summary 查看当前并发会话总数 > show security policies hit-count 查看所有战略史 > show security monitoring fpc 0 查看转发层面cpu、memory、并发会话、每秒新建等信息 > show chassis cluster status 检查集群状态 > show chassis cluster interfaces 检查集群接口状态
简单的操作和维护命令
1.恢复出厂配置
root> request system zeroize media *media该参数无法在模拟器上配置。 除了系统,此命令将被清除os所有以外的配置,(包括日志、许可证等。)新机器或恢复工厂设置的设备,默认用户名称root,没有密码。
2.加载出厂配置
root# load factory-default 注意模式变更:读取出厂配置,不删除日志、许可证、本地文件等,但重置root。
3、配置ROOT密码
第一种:root# set system root-authentication plain-text-password 这是交互式配置,你试试就知道了 第二种:root# set system root-authentication encrypted-password ? Possible completions: Encrypted password string 看看我的问号显示的内容 这里需要添加一个参数和一个加密密码。这是什么意思? 后面需要跟踪的是已经过去了MD5加密密文(复制粘贴配置,他不需要互动)
4.覆盖当前修改的配置副本,以及运行中的配置
root# commit 正如我之前所说,在配置模式下修改的是副本,这意味着你所做的所有配置都不一定有效,commit对了,srx这些配置将自动保存并编号。编号从0开始,时间越小越近
5.设置主机名
root@SRX1# set system host-name SRX1
6、查看版本
root@SRX1> show version
7.删除当前级别下的所有配置
root@SRX1# delete
8、配置tacas认证
set system authentication-order tacplus set system authentication-order password set system root-authentication plain-text-password(这是交互式配置,试试就知道了) 输入密码: 确认密码: set system tacplus-server 10.21.100.101 secret "$9$eoUKWxdbs4oGXx.5Q3tp0BIclMY2aZUHdVYoGif5uO1" set system tacplus-server 10.21.100.101 single-connection set system tacplus-server 10.21.100.101 source-address 10.150.119.38 set system accounting events login set system accounting events change-log set system accounting events interactive-commands set sysem accounting destination tacplus server 10.21.100.101 secret "$9$UnDHmTz39Cu.mhreMN-VwYoGin6Ap0ITQnCu1yrdbs" set system login class read idle-timeout 3 set system login class read login-alarms set system login class read permissions view set system login class read permissions view-configuration set system login class read allow-commands "(show configuration)|(ping)|(ssh)|(traceroute)" set system login class read deny-commands set set system login user supermi uid 2000 set system login user supermi class super-user set system login user supermi authentication encrypted-password "$5$.wDHyvZZ$IU/wsBzYyhh20JE.1rxK8g/qxl69TbdSOnStJfl43i/" set system login user xiaomi uid 2003 set system login user xiaomi class super-user set system login user xiaomi authentication encrypted-password "$5$x8iFB5RK$Urd3HoQGJuinOivi6Kek6foZBk02Ro5YSOSvvhaDzz1"
9、配置AAA认证,创建用户
set system login user AAA uid 2001 set system login user AAA class super-user set system login user AAA authentication plain-text-password “111JjTpAOWR$Qdo4LZbv6vIH.9Lfrnmtp1”----这一段就是密文,也就是上面第二种秘密配置方法里要填的东西 这个大家自己看下,太简单了 ------------------------------------------第一段尝试--------------------------------------------------- 上面这些如果大家实验过,就会慢慢上手了,这里我总结一下 set是配置命令,后面后面跟的是配置内容 set system login user AAA uid 2001 set system login user AAA class super-user set system login user AAA authentication plain-text-password 这里我们就会发现前面“system login user AAA”这一段是重复的 这里可以使用edit [edit] root@SRX1# edit system login user AAA [edit system login user AAA] 发现没有,上面那个中括号,这个其实是当前路径,而edit可以配置的同时进入该路径,然后就可以在当前路径下的配置参数,这个就是junos的层级配置,试试就知道了。
10、开启ssh
set system services ssh protocol-version v2 set system services ssh rate-limit 3 set system services netconf ssh port 830
11、配置syslog
set system syslog host 10.108.20.28 any any set system syslog host 10.108.20.28 source-address 10.150.119.38 set system syslog host 10.152.64.2 any any set system syslog host 10.152.64.2 source-address 10.150.119.38 set system syslog host 10.44.4.170 any any set system syslog host 10.44.4.170 source-address 10.150.119.38 set system syslog file messages any notice
12、配置NTP
set system ntp server 10.108.6.6 set system ntp source-address 10.150.119.38
13、配置聚合口,聚合口子接口,dot1p的vlan id,子接口ip地址,loopback口地址、替换ip
set interfaces ae0 vlan-tagging set interfaces ae0 unit 912 description UPLINK_xxx set interfaces ae0 unit 912 vlan-id 912 set interfaces ae0 unit 912 family inet address 10.108.253.98/30 set interfaces lo0 unit 0 family inet address 10.150.119.38/32 替换IP [edit] root@SRX1# edit interfaces ge-0/0/0 [edit interfaces ge-0/0/0] root@SRX1# replace pattern 1.1.1.2/24 with 1.1.1.3/24
注意几点:
1、unit就类似与子接口,srx是不允许直接在接口上配ip的; 2、如果一个接口ip代表这个物理接口的ip,必须是unit 0;
14、配置snmp
et snmp community sa.net.xiaomi.com authorization read-only set snmp trap-options source-address lo0
15、浮动静态路由配置方法
配置整体的路由preference: set routing-options static route 192.168.47.5 next-hop 10.10.10.10 preference 7 其中在整体内配置其他优先生效的静态路由,需要使用qualified-next-hop: set routing-options static route 192.168.47.5 qualified-next-hop 10.10.10.7 preference 6
16、ospf配置
set routing-options router-id [router-id] set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface [接口] interface-type p2p set protocols ospf area 0.0.0.0 interface [接口] interface-type p2p set protocols ospf area 0.0.0.0 interface [接口] hello-interval 1 set protocols ospf area 0.0.0.0 interface [接口] dead-interval 4
17、开启lldp
set protocols lldp interface all
18、不启用(配置不生效)、启用
deactivate interfaces ge-0/0/0 ?
可以多种多样,自己尝试下就会知道
启用
active interfaces ge-0/0/0
19、对一个端口范围内进行操作
配置:
删除多个:
[edit] root@SRX1#wildcard delete interfaces ge-0/0/[0,3] ?
20、查看登录情况
root@SRX1# run show system users 7:00AM up 4:04, 1 user, load averages: 0.02, 0.02, 0.00 USER TTY FROM LOGIN@ IDLE WHAT root d0 - 2:59AM - cli
21、查看谁在配置
root@SRX1# status Users currently editing the configuration: root terminal d0 (pid 1291) on since 2017-07-04 03:35:02 UTC [edit]
22、回滚
root@SRX1#rollback ? Possible completions: <[Enter]> Execute this command 0 2017-07-04 06:34:34 UTC by root via cli 1 2017-07-04 05:48:28 UTC by root via cli 2 2017-07-04 03:37:11 UTC by root via cli 3 2017-07-04 03:32:07 UTC by root via cli 4 2017-07-04 03:29:17 UTC by root via cli 5 2017-07-04 03:27:59 UTC by root via cli 6 2017-07-04 03:25:04 UTC by root via cli 7 2017-07-04 02:56:05 UTC by root via other
23、提交检查(不生效)
commit check 基本就是检查语法
24、给提交的配置打上标记
root@SRX1# commit comment TEST1
25、查看rollback
root@SRX1# run show system commit 0 2017-07-04 08:09:03 UTC by root via cli TEST1 1 2017-07-04 06:34:34 UTC by root via cli 2 2017-07-04 05:48:28 UTC by root via cli 3 2017-07-04 03:37:11 UTC by root via cli 4 2017-07-04 03:32:07 UTC by root via cli 5 2017-07-04 03:29:17 UTC by root via cli 6 2017-07-04 03:27:59 UTC by root via cli 7 2017-07-04 03:25:04 UTC by root via cli 8 2017-07-04 02:56:05 UTC by root via other 可以看到标记
26、设置rollback数量
root@SRX1# set system max-configurations-on-rollbacks 50 root@SRX1# set system max-configurations-on-flash 100 Value 100 is not within range (0…49) at ‘100’
可以发现最多一共可以存50个 这两条命令,其实只配第一条也是可以的,他是用来确认rollback的数量的,第二条on-flush是用来设置你有多少个配置保存在设备的config文件所属的文件夹下,但是并不是说剩下的配置他不保存,不保存的话你怎么恢复呢?剩下的其实是保存再var的一个目录下,可以去官网查一下,我看有人也提问这个问题,回复的还是很准确的。
27、查看设备时间
root@SRX1# run show system uptime
28、默认回退(后悔机制)
root@SRX1# commit confirmed commit confirmed will be automatically rolled back in 10 minutes unless confirmed commit complete
默认是10分钟,如果在10分钟内没有再commit,他就会自动回滚
29、重启
root@SRX1> request system reboot
30、关机
root@SRX1> request system power-off
31、查看已配置信息
root>show configuration | display set
32、查看最近一次运行命令
root>show | compare
33、提交检查不生效
root> commit check
34、配置BGP
1. Create a routing options. [edit] user@host# edit routing-options 2. Set the AS number. [edit routing-options] user@host# set autonomous-system 17 3. Configure BGP. [edit] user@host# edit protocols bgp 4. Create the BGP group and add the external neighbor address. [edit protocols bgp] user@host# set group external-peers neighbor 10.10.10.10 5. Set the AS number at the group level. [edit protocols bgp] user@host# set group external-peers peer-as 22 6. Set the AS number at the individual neighbor level. [edit protocols bgp group external-peers] user@host# set neighbor 10.21.7.2 peer-as 79 7. Set the group type. [edit protocols bgp group external-peers] user@host# set type external