4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【junos】wildcard rangeでコマンドを一気に投入してみる

Last updated at Posted at 2019-12-30

はじめに

<バージョン>
Model: vmx
Junos: 18.4R1.8

コードを使わなくてもwildcard rangeを用いてコマンドを一気に投入できます。

コマンド例

[]内で範囲指定などをするだけなので、コーディング等の知識は不要です。(参考資料[1])

用途 方法 設定例
範囲指定 -でつなぐ wildcard range set interfaces lt-0/0/0 unit [1-10] family inet address 192.168.0.1/30
範囲指定 + 除外 !で除外範囲を指定 wildcard range set interfaces lt-0/0/0 unit [1-10,!3-7] family inet address 192.168.0.1/30
特定の値を指定 ,でつなぐ wildcard range set interfaces lt-0/0/0 unit [1,3,5] family inet address 192.168.0.1/30
等間隔で指定 /で間隔を指定 wildcard range set interfaces lt-0/0/0 unit [1-10/2] family inet address 192.168.0.1/30

注意点

以下のように変数箇所が2か所あると、変数の全パターンが入ります。

test@ip-<address># wildcard range set interfaces lt-0/0/0 unit [1-2] family inet address 192.168.0.[1-2]/32
-
[edit]
test@ip-<address># show | compare
[edit]
+  interfaces {
+      lt-0/0/0 {
+          unit 1 {
+              family inet {
+                  address 192.168.0.1/32;
+                  address 192.168.0.2/32;
+              }
+          }
+          unit 2 {
+              family inet {
+                  address 192.168.0.1/32;
+                  address 192.168.0.2/32;
+              }
+          }
+      }
+  }

参考資料

[[1]Example: Using the Wildcard Command with the Range Option]
(https://www.juniper.net/documentation/en_US/junos/topics/example/junos-cli-wildcard-range-configuring.html)

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?