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 查看集群接口状态

2、简单运维命令

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 system 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

juniper ipsec vpn隧道配置: 

https://www.juniper.net/documentation/cn/zh/software/junos/vpn-ipsec/topics/topic-map/security-ipsec-basics.html#id-ipsec-overview
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐