Juniper SRX常用命令

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>  Encrypted password string
这里后面的密码是要已经经过MD5加密的密文(复制粘贴配置用,他不用交互)

4、覆盖当前修改的配置副本,到运行中的配置
root# commit
配置模式下修改的是副本,这代表你做的一切配置都不一定会生效,commit就是把副本覆盖到当前配置的命令,srx会自动保存这些配置,并且进行编号,编号从0开始,越小时间越近

5、创建用户
set system login user AAA uid 2001
set system login user AAA class super-user
set system login user AAA authentication plain-text-password
"$1$JjTpAOWR$Qdo4LZbv6vIH.9Lfrnmtp1" #这一段就是密文,也就是上面第二种秘密配置方法里要填的东西
[edit]
root@SRX1# edit system login user AAA
[edit system login user AAA]
root@SRX1#
发现没有,上面那个中括号,这个其实是当前路径,而edit可以配置的同时进入该路径,然后就可以在当前路径下的配置参数,这个就是junos的层级配置,试试就知道了。

6、设置接口ip
root@SRX1# set interfaces ge-0/0/0 unit 0 family inet address 1.1.1.2/24
这里注意几点
1、unit就类似与子接口,srx是不允许直接在接口上配ip的
2、如果一个接口ip代表这个物理接口的ip,必须是unit 0

7、替换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

8、多个端口同时设置
[edit]
root@SRX1# wildcard range set interfaces ge-0/0/[0-1,3] link-mode full-duplex
interfaces {
    ge-0/0/0 {
        link-mode full-duplex;
        unit 0 {
            family inet {
                address 1.1.1.2/24;     
            }
        }
    }
    ge-0/0/1 {
        link-mode full-duplex;
    }
    ge-0/0/3 {
        link-mode full-duplex;
    }

9、删除多个
[edit]
root@SRX1# wildcard delete interfaces ge-0/0/[0-1,3]

10、保护配置
protect关键字
unprotect关键字
这两个直接加层级就好,除非使用system zeroize media,不然在保护状态,是干不掉他的。

11、回滚配置,一共存多少个,可以设置
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
  |                    Pipe through a command

12、设置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的一个目录下,可以去官网查一下,我看有人也提问这个问题,回复的还是很准确的。

13、默认回退(后悔机制)
root@SRX1# commit confirmed    
commit confirmed will be automatically rolled back in 10 minutes unless confirmed
commit complete
# commit confirmed will be rolled back in 10 minutes
默认是10分钟,如果在10分钟内没有再commit,他就会自动回滚

14、常用命令
root@SRX1# status     #查看谁正在配置
root@SRX1# delete    #删除当前级别下所有的配置
root@SRX1# run show version    #查看版本
root@SRX1# commit check    #提交检查(检查语法,不生效)
root@SRX1# commit comment TEST1     #给提交的配置打上标记
root@SRX1# active interfaces ge-0/0/0    #启用配置
root@SRX1# deactivate interfaces ge-0/0/0    #不启用(配置不生效)
root@SRX1# set system host-name SRX1    #设置主机名
root@SRX1# run show system users     #查看登陆用户
root@SRX1# run show system commit   #查看rollback
root@SRX1# run show system uptime   #查看设备运行时间
root@SRX1> request system reboot     #重启
root@SRX1> request system power-off   #关机
root@SRX1> show interfaces terse    #查看接口状态和接口IP
root@SRX1> show security monitoring fpc 0   #查看cpu,内存

猜你喜欢

转载自www.cnblogs.com/xwupiaomiao/p/12067763.html