はじめに
-
最近おもちゃが増えたので最近 Juniper社製 QFX10002 の設定をする機会があったので、設定メモを置いておきます。 - 手元の環境では以下を使用していますが、基本的なことしかやってないので、あまりバージョンや機種依存性はないと思います。
動作確認した機種、JUNOSバージョン
- 機種: Juniper QFX10002-36Q
- JUNOSバージョン: 19.4R2.6
サンプル構成
免責・注意事項
-
本記事を参考にした結果について、当方は責任を負いかねます。あくまでも参考情報として取り扱いください。
-
誤りや最適でない記述が含まれる可能性があります。
- もしあれば、改善方法を指摘してらえると助かります(是非コメント欄にどうぞ)
- 将来のバージョンで仕様が変更され、本記事の内容が適合しなくなる可能性があります
-
独自調査の内容が含まれます。
- マニュアルやネット上の情報を元に自身で動作確認したもので、メーカ/ベンダから
オーサライズを得ておりません - 記事中に記載したリミテーションは、機器の挙動から推測したものがあります
- マニュアルやネット上の情報を元に自身で動作確認したもので、メーカ/ベンダから
-
本記事の内容を元に、メーカ/ベンダに問い合わせることはお控えください。
パスワード設定、ログインユーザ作成
- rootパスワード設定
set system root-authentication plain-text-password
New password: (パスーワード)
Retype new password: (パスーワード)
- ログインユーザ作成(ユーザ名 admin で作成する場合)
set system login user admin class super-user
set system login user admin authentication plain-text-password
New password: (パスーワード)
Retype new password: (パスーワード)
set system login user admin authentication ssh-rsa "ssh-rsa <鍵の内容> micho@example.jp"
マネジメントアドレス設定
- 以下の設定例では、一旦全てのプライベートアドレス空間宛て経路を、
マネジメントネットワーク側に向けています。 - 環境に応じて、適切に書き換えてください。
set interfaces em0 unit 0 family inet address XX.XX.XX.XX/XX
set routing-options rib inet.0 static route 10.0.0.0/8 next-hop XX.XX.XX.XX
set routing-options rib inet.0 static route 10.0.0.0/8 no-readvertise
set routing-options rib inet.0 static route 172.16.0.0/12 next-hop XX.XX.XX.XX
set routing-options rib inet.0 static route 172.16.0.0/12 no-readvertise
set routing-options rib inet.0 static route 192.168.0.0/16 next-hop XX.XX.XX.XX
set routing-options rib inet.0 static route 192.168.0.0/16 no-readvertise
基本設定
- ここまで設定を入れて反映(commit)すると、リモートからtelnet/sshで操作できるように
なると思います。
set system host-name test-qfx10k
set system time-zone Asia/Tokyo
set system services ssh
set system services telnet
NTPサーバ参照設定
set system ntp boot-server 210.188.224.14
set system ntp server 210.188.224.14
SNMP設定
set snmp location west-shinjuku
set snmp contact "micho@example.jp"
set snmp community <コミュニティ名> authorization read-only
ロギング設定
set system syslog user * any emergency
set system syslog file messages any any
set system syslog file messages interactive-commands none
set system syslog file interactive-commands interactive-commands any
Syslog転送設定
set system syslog host XX.XX.XX.XX any any
ポートのスピード設定(100G)
- QFX10002-36Qの場合、デフォルトのポートスピードは40Gbpsになっています。
- 100Gbpsで使用するには、ポート毎にスピード設定が必要です。
- また、全ポートが100Gbpsで使えるわけでなく、飛び飛びの一部ポートのみが使用可能です。
- QFX10002-36Qでは、下図の「緑」で示したポートのみ100Gbpsで使用可能です。
- 100Gでしか使わないのであれば、以下のようにあらかじめ全ポートに、
100Gbpsのスピード設定を入れておくと良いかもしれないです。
! QFX10002-36Qにて、100Gで利用可能な全ポートにあらかじめスピード設定
set chassis fpc 0 pic 0 port 1 speed 100g
set chassis fpc 0 pic 0 port 5 speed 100g
set chassis fpc 0 pic 0 port 7 speed 100g
set chassis fpc 0 pic 0 port 11 speed 100g
set chassis fpc 0 pic 0 port 13 speed 100g
set chassis fpc 0 pic 0 port 17 speed 100g
set chassis fpc 0 pic 0 port 19 speed 100g
set chassis fpc 0 pic 0 port 23 speed 100g
set chassis fpc 0 pic 0 port 25 speed 100g
set chassis fpc 0 pic 0 port 29 speed 100g
set chassis fpc 0 pic 0 port 31 speed 100g
set chassis fpc 0 pic 0 port 35 speed 100g
物理インターフェイスIPアドレス設定
set interfaces et-0/0/X description XXXXX
set interfaces et-0/0/X unit 0 family inet address XX.XX.XX.XX/24
set interfaces et-0/0/X unit 0 family inet6 address XX:XX::XX:XX/64
LAGインターフェイス作成
! ae0が作成される
set chassis aggregated-devices ethernet device-count 1
! ae0へのメンバリンクを追加
set interfaces et-0/0/X ether-options 802.3ad ae0
set interfaces et-0/0/X ether-options 802.3ad ae0
VLANインターフェイスIPアドレス、VRRP設定
- 以下は、VRRP Master側ルータを例として、VRRP priorityは254としています。
Backup側ルータは priority 100 とかにする必要があります。 - IPv4のadvertise-intervalは秒単位で指定します(以下の例だと5秒)。
- IPv6のinet6-advertise-intervalはミリ秒単位で指定します(以下の例だと5秒)。
- accept-dataを設定すると、VIP宛てのパケットを処理(pingに応答したりなど)するようになります。
- QFX10002では、VLAN数(unit数)は2,048個まで、VRRPインスタンスは8,000個までになっているようです。
set interfaces ae0 vlan-tagging
set interfaces ae0 unit 201 vlan-id 201
set interfaces ae0 unit 201 family inet address XX.XX.XX.XX/24 vrrp-group 255 virtual-address XX.XX.XX.XX
set interfaces ae0 unit 201 family inet address XX.XX.XX.XX/24 vrrp-group 255 priority 254
set interfaces ae0 unit 201 family inet address XX.XX.XX.XX/24 vrrp-group 255 advertise-interval 5
set interfaces ae0 unit 201 family inet address XX.XX.XX.XX/24 vrrp-group 255 preempt
set interfaces ae0 unit 201 family inet address XX.XX.XX.XX/24 vrrp-group 255 accept-data
set interfaces ae0 unit 201 family inet6 address XX:XX::XX:XX/64 vrrp-inet6-group 255 virtual-inet6-address XX:XX::XX:XX
set interfaces ae0 unit 201 family inet6 address XX:XX::XX:XX/64 vrrp-inet6-group 255 virtual-link-local-address fe80::1
set interfaces ae0 unit 201 family inet6 address XX:XX::XX:XX/64 vrrp-inet6-group 255 priority 254
set interfaces ae0 unit 201 family inet6 address XX:XX::XX:XX/64 vrrp-inet6-group 255 inet6-advertise-interval 5000
set interfaces ae0 unit 201 family inet6 address XX:XX::XX:XX/64 vrrp-inet6-group 255 accept-data
DHCPリレー設定
set forwarding-options dhcp-relay forward-snooped-clients all-interfaces
set forwarding-options dhcp-relay server-group DHCP XX.XX.XX.XX
set forwarding-options dhcp-relay active-server-group DHCP
set forwarding-options dhcp-relay route-suppression access-internal
set forwarding-options dhcp-relay group DHCP interface ae0.201
補足説明:
-
route-suppression access-internal
について- デフォルトで以下のfeatureが有効になっており、DHCP Relayされたアドレスの経路が
access-internal として/32単位でrouting tableに書き込まれます。 - Routes for DHCP and PPP Subscriber Access Networks
- 今回の構成では不要なので、本設定によりこの動作を無効化しています。
- デフォルトで以下のfeatureが有効になっており、DHCP Relayされたアドレスの経路が
-
forward-snooped-clients all-interfaces
について- DHCP Relayの設定を行うと、DHCPパケットをリレーエージェントがスヌーピングし、
自装置宛でないDHCPパケットもIP Forwardingしなくなるようです。 - 今回の構成のように、ルータを冗長化している場合に、バックアップ側ルータ宛ての
DHCPパケットをアクティブ側ルータがIP Forwardingする必要があるため、
この設定を入れています。
- DHCP Relayの設定を行うと、DHCPパケットをリレーエージェントがスヌーピングし、
帯域制限(ポリシング)設定
- QFX10002では、VLAN単位(unit単位)での帯域制限はできず、protocol family単位での制限設定しか
できないようです。 - 以下は、VLAN201のIPv4のin/out方向それぞれ、IPv6のin/out方向ぞれぞれに、2Gbpsの制限を
かける設定例となっています(IPv4とIPv6合算で4Gbpsまで出せてしまうのは仕方ない)。 - burst-size-limit(Bytes)は、経験的にbps値の32分の1の値を指定するといい感じになることが
知られています。 - ポリサー設定数の上限値は 8,000個 になっているようです。
- そのため、本設置例のように、1VLANあたり4つのポリサーを使用すると、設定可能な
VLAN数の上限は 2,000VLAN (= 8,000 / 4) までとなります。
! 帯域制限値に応じたポリサーのテンプレートを定義
set firewall policer 2000M if-exceeding bandwidth-limit 2g
set firewall policer 2000M if-exceeding burst-size-limit 62500000
set firewall policer 2000M then discard
! VLANごと、protocol familyごと、方向ごとにポリサーを定義
set firewall family inet filter policer-vlan201-ipv4-in term 1 then policer 2000M
set firewall family inet filter policer-vlan201-ipv4-out term 1 then policer 2000M
set firewall family inet6 filter policer-vlan201-ipv6-in term 1 then policer 2000M
set firewall family inet6 filter policer-vlan201-ipv6-out term 1 then policer 2000M
! インターフェイスにポリサーを定義
set interfaces ae0 unit 201 family inet filter input policer-vlan201-ipv4-in
set interfaces ae0 unit 201 family inet filter output policer-vlan201-ipv4-out
set interfaces ae0 unit 201 family inet6 filter input policer-vlan201-ipv6-in
set interfaces ae0 unit 201 family inet6 filter output policer-vlan201-ipv6-out
- 他の帯域でのポリサーテンプレート設定例
set firewall policer 100M if-exceeding bandwidth-limit 100m
set firewall policer 100M if-exceeding burst-size-limit 3125000
set firewall policer 100M then discard
set firewall policer 250M if-exceeding bandwidth-limit 250m
set firewall policer 250M if-exceeding burst-size-limit 7812500
set firewall policer 250M then discard
set firewall policer 500M if-exceeding bandwidth-limit 500m
set firewall policer 500M if-exceeding burst-size-limit 15625000
set firewall policer 500M then discard
set firewall policer 1000M if-exceeding bandwidth-limit 1g
set firewall policer 1000M if-exceeding burst-size-limit 31250000
set firewall policer 1000M then discard
set firewall policer 1500M if-exceeding bandwidth-limit 1500000000
set firewall policer 1500M if-exceeding burst-size-limit 46875000
set firewall policer 1500M then discard
set firewall policer 2500M if-exceeding bandwidth-limit 2500000000
set firewall policer 2500M if-exceeding burst-size-limit 78125000
set firewall policer 2500M then discard
set firewall policer 3000M if-exceeding bandwidth-limit 3g
set firewall policer 3000M if-exceeding burst-size-limit 93750000
set firewall policer 3000M then discard
set firewall policer 5000M if-exceeding bandwidth-limit 5g
set firewall policer 5000M if-exceeding burst-size-limit 156250000
set firewall policer 5000M then discard
BGP設定
以下の構成でピア設定、経路広告を行う設定例です。
- IGP(OSPFなど)は使用せず、iBGPは2台間のリンクの物理IPアドレスで張る
- eBGP(上流ルータ向け)経路交換ポリシー
- 集約経路を広告する(IPv4は/20とIPv6は/48)
- デフォルトルートを受信する
- iBGP(冗長化している隣接ルータ向け)経路交換ポリシー
- 一部を除いて全ての経路(ConnectedやStaticなども含め)を送受信する
! 広告する集約経路のnull routing設定
set routing-options rib inet.0 static route XX.XX.XX.XX/20 discard
set routing-options rib inet6.0 static route XX:XX:XX::/48 discard
! router-idとするループバックアドレスを設定
set interfaces lo0 unit 0 family inet address 192.168.255.1/32
set routing-options router-id 192.168.255.1
set routing-options autonomous-system 65121
set protocols bgp log-updown
set protocols bgp multipath
set protocols bgp group ibgp export to-ibgp
set protocols bgp group ibgp peer-as 65121
set protocols bgp group ibgp local-as 65121
set protocols bgp group ibgp graceful-restart disable
set protocols bgp group ibgp neighbor XX.XX.XX.XX
set protocols bgp group ibgp neighbor XX:XX::XX:XX
set protocols bgp group ebgp import from-ebgp
set protocols bgp group ebgp export to-ebgp
set protocols bgp group ebgp peer-as 65120
set protocols bgp group ebgp local-as 65121
set protocols bgp group ebgp graceful-restart disable
set protocols bgp group ebgp neighbor XX.XX.XX.XX
set protocols bgp group ebgp neighbor XX:XX::XX:XX
! eBGPでは、集約経路のみを広告するように設定
set policy-options policy-statement to-ebgp term origin from route-filter XX.XX.XX.XX/20 exact
set policy-options policy-statement to-ebgp term origin then metric 50
set policy-options policy-statement to-ebgp term origin then accept
set policy-options policy-statement to-ebgp term origin6 from route-filter XX:XX:XX::/48 exact
set policy-options policy-statement to-ebgp term origin6 then metric 50
set policy-options policy-statement to-ebgp term origin6 then accept
set policy-options policy-statement to-ebgp then reject
! eBGPでは、デフォルトルートのみを受信するように設定
set policy-options policy-statement from-ebgp term default from route-filter 0.0.0.0/0 exact
set policy-options policy-statement from-ebgp term default then accept
set policy-options policy-statement from-ebgp term default6 from route-filter ::/0 exact
set policy-options policy-statement from-ebgp term default6 then accept
set policy-options policy-statement from-ebgp then reject
! iBGPでは、一部を除き全ての経路を広告するように設定
set policy-options policy-statement to-ibgp term reject-addr from route-filter XX.XX.XX.XX/XX exact
set policy-options policy-statement to-ibgp term reject-addr then reject
set policy-options policy-statement to-ibgp then next-hop self
set policy-options policy-statement to-ibgp then accept
floating static設定
- デフォルトルートは通常eBGPで受信しますが、それが失われた場合のバックアップ経路を設定する例です。
- 一旦上位ルータにデフォルトルートが向くようにします。
set routing-options rib inet.0 static route 0.0.0.0/0 next-hop XX.XX.XX.XX
set routing-options rib inet.0 static route 0.0.0.0/0 next-hop XX.XX.XX.XX
set routing-options rib inet.0 static route 0.0.0.0/0 preference 200
set routing-options rib inet6.0 static route ::/0 next-hop XX:XX::XX:XX
set routing-options rib inet6.0 static route ::/0 next-hop XX:XX::XX:XX
set routing-options rib inet6.0 static route ::/0 preference 200
ECMP設定
- デフォルトでは、経路単位のバランシング動作になっています。
- より細かい粒度(フロー単位)でバランシングするための設定です。
- 設定構文は
per-packet
になっていますが、実際は5tuplesをベースとした
フロー単位でのバランシング動作となります。例えば、あるTCPセッションを構成する
パケット群は同じリンクに振り分けられます。
set policy-options policy-statement ECMP then load-balance per-packet
set routing-options forwarding-table export ECMP
アクセスコントロール設定
- 自ルータに着信するパケットフィルタリング設定です。
- インターフェイス
lo0
に対して適用することで、全てのインターフェイスから受信する
ルータ自身宛のトラフィックがフィルタリングの対象になります。マネジメントポート(em0)や、
ループバック通信も対象になるので、注意が必要です。 - 転送動作となるパケットには、このフィルタリングルールは適用されません。
IPv4のルール設定:
set policy-options prefix-list V4-BGP-NEIGHBOR apply-path "protocols bgp group <*> neighbor <*.*>"
set policy-options prefix-list V4-SNMP-ACCESS 10.0.0.0/8
set policy-options prefix-list V4-SNMP-ACCESS 172.16.0.0/12
set policy-options prefix-list V4-SNMP-ACCESS 192.168.0.0/16
set policy-options prefix-list V4-TELNET-ACCESS 10.0.0.0/8
set policy-options prefix-list V4-TELNET-ACCESS 172.16.0.0/12
set policy-options prefix-list V4-TELNET-ACCESS 192.168.0.0/16
set policy-options prefix-list V4-NTP-ACCESS 210.188.224.14/32
set firewall family inet filter V4-LOOPBACK term ESTABLISHED-TCP from protocol tcp
set firewall family inet filter V4-LOOPBACK term ESTABLISHED-TCP from tcp-established
set firewall family inet filter V4-LOOPBACK term ESTABLISHED-TCP then accept
set firewall family inet filter V4-LOOPBACK term TELNET from source-prefix-list V4-TELNET-ACCESS
set firewall family inet filter V4-LOOPBACK term TELNET from protocol tcp
set firewall family inet filter V4-LOOPBACK term TELNET from destination-port telnet
set firewall family inet filter V4-LOOPBACK term TELNET then accept
set firewall family inet filter V4-LOOPBACK term SSH from source-prefix-list V4-TELNET-ACCESS
set firewall family inet filter V4-LOOPBACK term SSH from protocol tcp
set firewall family inet filter V4-LOOPBACK term SSH from destination-port ssh
set firewall family inet filter V4-LOOPBACK term SSH then accept
set firewall family inet filter V4-LOOPBACK term NTP from source-prefix-list V4-NTP-ACCESS
set firewall family inet filter V4-LOOPBACK term NTP from protocol udp
set firewall family inet filter V4-LOOPBACK term NTP from destination-port ntp
set firewall family inet filter V4-LOOPBACK term NTP then accept
set firewall family inet filter V4-LOOPBACK term SNMP from source-prefix-list V4-SNMP-ACCESS
set firewall family inet filter V4-LOOPBACK term SNMP from protocol udp
set firewall family inet filter V4-LOOPBACK term SNMP from port snmp
set firewall family inet filter V4-LOOPBACK term SNMP then accept
set firewall family inet filter V4-LOOPBACK term DNS from protocol udp
set firewall family inet filter V4-LOOPBACK term DNS from source-port domain
set firewall family inet filter V4-LOOPBACK term DNS then accept
set firewall family inet filter V4-LOOPBACK term BGP from source-prefix-list V4-BGP-NEIGHBOR
set firewall family inet filter V4-LOOPBACK term BGP from protocol tcp
set firewall family inet filter V4-LOOPBACK term BGP from destination-port bgp
set firewall family inet filter V4-LOOPBACK term BGP then accept
set firewall family inet filter V4-LOOPBACK term ICMP from protocol icmp
set firewall family inet filter V4-LOOPBACK term ICMP from icmp-type echo-request
set firewall family inet filter V4-LOOPBACK term ICMP from icmp-type echo-reply
set firewall family inet filter V4-LOOPBACK term ICMP from icmp-type unreachable
set firewall family inet filter V4-LOOPBACK term ICMP from icmp-type time-exceeded
set firewall family inet filter V4-LOOPBACK term ICMP from icmp-type source-quench
set firewall family inet filter V4-LOOPBACK term ICMP then accept
set firewall family inet filter V4-LOOPBACK term VRRP from protocol vrrp
set firewall family inet filter V4-LOOPBACK term VRRP then accept
set firewall family inet filter V4-LOOPBACK term DHCP from protocol udp
set firewall family inet filter V4-LOOPBACK term DHCP from destination-port 67
set firewall family inet filter V4-LOOPBACK term DHCP then accept
set firewall family inet filter V4-LOOPBACK term LOOPBACK from source-address 192.168.255.1/32
set firewall family inet filter V4-LOOPBACK term LOOPBACK then accept
set firewall family inet filter V4-LOOPBACK term DENY-ALL then count v4-reject
set firewall family inet filter V4-LOOPBACK term DENY-ALL then syslog
set firewall family inet filter V4-LOOPBACK term DENY-ALL then discard
! lo0.0に適用
set interfaces lo0 unit 0 family inet filter input V4-LOOPBACK
IPv6のルール設定:
set policy-options prefix-list V6-BGP-NEIGHBOR apply-path "protocols bgp group <*> neighbor <*:*>"
set firewall family inet6 filter V6-LOOPBACK term ESTABLISHED-TCP from next-header tcp
set firewall family inet6 filter V6-LOOPBACK term ESTABLISHED-TCP from tcp-established
set firewall family inet6 filter V6-LOOPBACK term ESTABLISHED-TCP then accept
set firewall family inet6 filter V6-LOOPBACK term BGP from source-prefix-list V6-BGP-NEIGHBOR
set firewall family inet6 filter V6-LOOPBACK term BGP from next-header tcp
set firewall family inet6 filter V6-LOOPBACK term BGP from destination-port bgp
set firewall family inet6 filter V6-LOOPBACK term BGP then accept
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from next-header icmp6
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type echo-reply
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type echo-request
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type neighbor-advertisement
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type neighbor-solicit
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type destination-unreachable
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type packet-too-big
set firewall family inet6 filter V6-LOOPBACK term ICMP6 from icmp-type time-exceeded
set firewall family inet6 filter V6-LOOPBACK term ICMP6 then accept
set firewall family inet6 filter V6-LOOPBACK term VRRP from next-header vrrp
set firewall family inet6 filter V6-LOOPBACK term VRRP then accept
set firewall family inet6 filter V6-LOOPBACK term DENY-ALL then count v6-reject
set firewall family inet6 filter V6-LOOPBACK term DENY-ALL then syslog
set firewall family inet6 filter V6-LOOPBACK term DENY-ALL then discard
! lo0.0に適用
set interfaces lo0 unit 0 family inet6 filter input V6-LOOPBACK
ARPパラメータ調整
- 通常はいじる必要ないですが、高負荷の場合に以下のようなチューニングを行います。
set system arp aging-timer 240
set system arp passive-learning
set system arp gratuitous-arp-on-ifup
set system arp gratuitous-arp-delay 2
L2スイッチング設定
- とりあえず全VLAN(2-4094)をTrunkさせる設定例です
set vlans all-vlans vlan-id-list 2-4094
set interfaces et-0/0/1 unit 0 family ethernet-switching interface-mode trunk
set interfaces et-0/0/1 unit 0 family ethernet-switching vlan members all
- MACアドレスAging Timeを変更する場合
set protocols l2-learning global-mac-table-aging-time 86400
- 状態確認方法
! 設定済みVLANの表示
show vlans
! MACアドレス学習テーブルの表示
show ethernet-switching table
show ethernet-switching table vlan-id 2
! MACアドレス学習数を表示
show ethernet-switching statistics