4
2

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.

Juniper vSRX テスト環境用の簡易初期設定

Posted at

概要

vSRXにはデフォルトで不要な設定が入っているので最初に削除しておきます。
前回、vSRXをデプロイした際に下記の設定だけしています。

  • rootアカウントのパスワード設定
  • sshアカウント(admin)の作成
  • 管理インタフェース(fxp0.0)をDHCPに変更

前提条件

No 項目
1 JUNOSバージョン 20.1R1.11
2 仮想環境 VMware Workstation 15
3 ホストOS Windows 10

設定確認

現在(ほぼデフォルト)の設定を確認してみます。

むかし使っていたJUNOS 12.xのvSRXとは設定内容が異なるようです。
むかしは管理インタフェースがDHCPに設定されてました。

> show configuration | no-more

system {
    root-authentication {
        encrypted-password "$6$ycjsXufy$N.jNQv5Z/oJeJ9ssxSwGER7jtUQ7Vms4Yz0tDMMfOEamB/aB8QEPH7FlQg/9Vc2daI5GgSItsBGOQURIuhHNg0"; ## SECRET-DATA
    }
    login {
        user admin {
            uid 2000;
            class super-user;
            authentication {
                encrypted-password "$6$MMKOjzL0$1YWL5zpXWLwQ4zNgFV7OaabZMb.P.asAdOzIAXdV/p/no5RKKt8BCQn6420BgtjMyei4EY2sw4HfJdy1lSOPR0"; ## SECRET-DATA
            }
        }
    }
    services {
        ssh;
        web-management {
            http {
                interface fxp0.0;
            }
        }
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any any;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }
    license {
        autoupdate {
            url https://ae1.juniper.net/junos/key_retrieval;
        }
    }
}
security {
    log {
        mode stream;
    }
    screen {
        ids-option untrust-screen {
            icmp {
                ping-death;
            }
            ip {
                source-route-option;
                tear-drop;
            }
            tcp {
                syn-flood {
                    alarm-threshold 1024;
                    attack-threshold 200;
                    source-threshold 1024;
                    destination-threshold 2048;
                    queue-size 2000; ## Warning: 'queue-size' is deprecated
                    timeout 20;
                }
                land;
            }
        }
    }
    policies {
        from-zone trust to-zone trust {
            policy default-permit {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
        from-zone trust to-zone untrust {
            policy default-permit {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
    }
    zones {
        security-zone trust {
            tcp-rst;
        }
        security-zone untrust {
            screen untrust-screen;
        }
    }
}
interfaces {
    fxp0 {
        unit 0 {
            family inet {
                dhcp;
            }
        }
    }
}

不要設定の削除

Firewallを使わないのでSecurity関連を削除しておきます。
本番環境だとJ-Web serviceは削除しますが、今回はテストなので残しておきます。

> configure
# delete security
# show | compare
# commit comment "delete security config"

設定を確認します

> show configuration | no-more

system {
    root-authentication {
        encrypted-password "$6$ycjsXufy$N.jNQv5Z/oJeJ9ssxSwGER7jtUQ7Vms4Yz0tDMMfOEamB/aB8QEPH7FlQg/9Vc2daI5GgSItsBGOQURIuhHNg0"; ## SECRET-DATA
    }
    login {
        user admin {
            uid 2000;
            class super-user;
            authentication {
                encrypted-password "$6$MMKOjzL0$1YWL5zpXWLwQ4zNgFV7OaabZMb.P.asAdOzIAXdV/p/no5RKKt8BCQn6420BgtjMyei4EY2sw4HfJdy1lSOPR0"; ## SECRET-DATA
            }
        }
    }
    services {
        ssh;
        web-management {
            http {
                interface fxp0.0;
            }
        }
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any any;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }
    license {
        autoupdate {
            url https://ae1.juniper.net/junos/key_retrieval;
        }
    }
}
interfaces {
    fxp0 {
        unit 0 {
            family inet {
                dhcp;
            }
        }
    }
}

基本設定

本番環境だとSyslogとかACLとか設定しますが、個人テスト環境なので簡単な基本設定だけ。
ホスト名を変更するとプロンプトにホスト名が表示されるようになります。

! ホスト名
# set system host-name vsrx02

! DNSサーバ
# set system name-server 8.8.8.8
# set system name-server 8.8.4.4

! Time Zone
# set system time-zone Asia/Tokyo

! NTPサーバ
# set system ntp server ntp.nict.jp

! SSH有効化(JUNOS 20.1ではデフォルト有効になってた)
# set system services ssh
! rootでのログインを許可する場合
# set system services ssh root-login allow

! リモート操作g
# set system services netconf ssh
# set system services rest http port 3000
# set system services rest enable-explorer

設定を確認してCommitします

# show | compare

[edit system]
+  host-name vsrx02;
[edit system services ssh]
+    root-login allow;
[edit system services]
+    netconf {
+        ssh;
+    }
+    rest {
+        http {
+            port 3000;
+        }
+        enable-explorer;
+    }
[edit system]
+  time-zone Asia/Tokyo;
+  name-server {
+      8.8.8.8;
+      8.8.4.4;
+  }
+  ntp {
+      server 133.243.238.243;
+  }

# commit comment "set base config"

パケットモードに変更

vSRXはデフォルトでフローモードで動作していますが、MPLS/VPLSルータとして使用するためパケットモードに変更します。

! 事前にモードを確認
> show security flow status
  Flow forwarding mode:
    Inet forwarding mode: flow based ★
    Inet6 forwarding mode: flow based
    MPLS forwarding mode: drop ★
    ISO forwarding mode: drop
    Tap mode: disabled (default)
  Flow trace status
    Flow tracing status: off
  Flow session distribution
    Distribution mode: Hash-based
    GTP-U distribution: Disabled
  Flow ipsec performance acceleration: off
  Flow packet ordering
    Ordering mode: Hardware
  Flow power mode IPsec: Disabled
  Fat core group status: off

! パケットモードに変更
# set security forwarding-options family mpls mode packet-based
# commit

! 再起動して設定を反映(2回再起動するので焦らない)
# exit
> request system reboot

! モードを確認
> show security flow status
  Flow forwarding mode:
    Inet forwarding mode: packet based ★
    Inet6 forwarding mode: flow based
    MPLS forwarding mode: packet based ★
    ISO forwarding mode: drop
    Tap mode: disabled (default)
  Flow trace status
    Flow tracing status: off
  Flow session distribution
    Distribution mode: Hash-based
    GTP-U distribution: Disabled
  Flow ipsec performance acceleration: off
  Flow packet ordering
    Ordering mode: Hardware
  Flow power mode IPsec: Disabled
  Fat core group status: off

今回はここまで。

4
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?