勉強日記

チラ裏

CCNA試験対策 下巻ch16: Introduction to Controller-Based Networking

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


SDN and Controller-Based Networks

The Data, Control, and Management Planes

  • ネットワークの再定義

The Data Plane

  • Data Plane: データの通信そのものに関する要素
    • Forwarding Planeとも
  • これがないとそもそも通信できない

The Control Plane

  • これがなくても通信はできるが、運用やパフォーマンスに難があるよ、というもの
    • IPルーティングプロトコル
      • ないと静的ルートを設定しないといけない
    • IPv4 ARP
    • IPv6 NDP
    • SwitchのMACアドレス学習
      • これがないとbroadcastしなければならない
    • STP
      • ないとフレームが永久に回り続ける

The Management Plane

  • これがなくても通信そのものに別に影響はないもの

Cisco Switch Data Plane Internals

  • SwitchはData Planeにあたる高負荷の処理を専用のハードウェアでこなしている
    • ASIC: application-specific integrated circuit
    • TCAM: ternary content-addressable memory
  • Control Planeにあたるものは汎用CPUで処理している

Controllers and Software-Defined Architecture

Controllers and Centralized Control

  • 従来は各デバイスで分散管理していたControl Planeを一元化する
Application
 ↓ call NBI
Controller
 ↓ call SBI
Network Devices

The Southbound Interface

  • SBI: Southbound Interface
  • 「紙面上で下側のAPI」の意
    • 図面上でネットワーク機器はコントローラよりも下側に描かれることから
  • ネットワーク機器が提供する
SBIs ACI Cisco APIC-EM Cisco SDA
OpenFlow o
OpFlex o o
CLI(SSH/Telnet) o o
SNMP o
NETCONF/RESTCONF o

The Northbound Interface

  • NBI: Northbound Interface
  • 「紙面上で上側のAPI」の意
    • 図面上でアプリケーションはコントローラよりも上側に描かれることから
  • コントローラが提供する
  • RESTful API

Examples of Network Programmability and SDN

OpenDaylight and OpenFlow

  • ONF: Open Networking Foundation
  • OpenFlow
    • ONFによりつくられたSBI
    • Switchの抽象化・標準化など

The OpenDaylight Controller

  • OpenDaylight
    • オープンソースのSDNコントローラ
    • OpenFlow含むさまざまなSBIを叩き、NBIを提供する

The Cisco Open SDN Controller (OSC)

  • OSC: Open SDN Controller
    • CiscoによるOpenDaylightの商用フォーク
  • すでに終わった製品

Cisco Application Centric Infrastructure (ACI)

ACI Physical Design: Spine and Leaf

ACI Operating Model with Intent-Based Networking

  • IBN: Intent-Based Networking
    • CiscoはOpenFlow的なSDNからIBN的な方向へ舵を切っていくことに
    • ネットワークのインフラを設定するのではなく、ネットワークやアプリケーションを設定する
  • ACI: Application Centric Infrastructure

Cisco APIC Enterprise Module

  • APIC: Application Policy Infrastructure

APIC-EM Basics

  • APIC-EM: APIC Enterprise Module
  • 古い機器を大量に抱えている大企業にもSDNを提供する
  • 古い機器でもTelnet/SSHSNMPを使ってできることはある
    • Topology Map
    • Path Trace
    • Plug and Play
      • 開梱して物理的に接続してL3疎通するまで (Day 0 Installation) を自動化
    • Easy QoS
      • QoSの設定はもっとも骨の折れる部類
      • これを簡略に行える

APIC-EM Replacement

  • APIC-EMは終わろうとしている製品
  • DNA Center (DNAC)へ移行しよう

Comparing Traditional Versus Controller-Based Networks

How Automation Impacts Network Management

  • 汎用プログラム言語でNBI (RESTful)を叩いて設定を行えるように
  • 従来型のネットワーク管理から変わったこと
    • 自動化が簡単に
      • 堅牢
    • ネットワークの再定義 -- SDN
    • インフラのデータをControllerに集約して分析することで、より意味のあるデータを得られるように
      • Path Traceなど
    • 運用コスト(時間)の削減

Comparing Traditional Networks with Controller-Based Networks

  • 従来型から変わったこと
    • 「デバイスごとの個別の設定」よりもすぐれた運用モデル
    • NBIの提供するIntent-Basedな設定
    • SBI経由の一貫した設定
    • ネットワークにもDevOpsが適用可能に
      • 「高い品質を確保しつつ、システムへの変更をコミットしてから通常の運用に移るまでの時間を短縮することを目的とした一連のプラクティス」のこと

英語

  • overt
    • 明白な
  • tidbit
    • ひと口、一片
    • 役立つ情報

CCNA試験対策 下巻ch19: Understanding Ansible, Puppet, and Chef

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


Device Configuration Challenges and Solutions

  • ネットワークエンジニアが1人で1台のデバイスを設定しているうちは configure terminal で設定して copy running-config startup-config していればよい
  • 複数人のネットワークエンジニアで数百数千のデバイスを管理するようになると破綻する

Configuration Drift

  • バイス上で手作業で直接設定を行うと、誰がいつ・どの行の・何を変更し・何を削除したか、といった情報がない
  • 一貫性のない状態になる

Centralized Configuration Files and Version Control

  • 設定ファイルを一元化する
  • 方針は2通り考えられる
    • バイス上の設定を正として、一元管理しているものはバックアップとする
    • 一元管理しているほうを正とする
  • 後者だといろいろなツールの恩恵を得られて良い
  • バージョン管理使え

Configuration Monitoring and Enforcement

  • 設定を一元管理して、バージョン管理もするようになりました
  • まだ問題がある
    • 一元管理している設定ファイルをどうやってデバイスに反映するの?
    • 人の手が介在すると、ここでも構成ドリフトのおそれが生じる
  • Configuration Monitoring, Configuration Enforcementという類のツールを使え
    • 構成ドリフトを監視する
    • 修正もしくはネットワークエンジニアに通知する

Configuration Provisioning

  • 構成管理システムで変更した設定のプロビジョン・デプロイ
  • 求められる機能
    • メイン: 一元管理している設定ファイルのデプロイ
    • デプロイ対象の管理
      • 全部
      • 一部
    • 設定変更が受理/拒否されたときのアクションの設定
    • revert
    • dry-run
    • 設定が正しく反映されていることの確認
    • running-configからstartup-configに永続化するかどうか選べる
    • 設定ファイルのテンプレート化
    • 自動デプロイ

Configuration Templates and Variables

  • 設定ファイルをテンプレート化する
    • バイスによって変える部分は変数として流し込む
    • snowflake(個別のコンフィグファイル)をやめる

Files That Control Configuration Automation

  • 構成管理システムの構成も構成ファイルで行えること

Ansible, Puppet, and Chef Basics

Ansible Puppet Chef
設定ファイル Playbook Manifest Recipe,Runlist
Protocol SSH, NETCONF HTTP (RESTful) HTTP (RESTful)
agentのインストールが必要 no yes yes
push/pull push pull pull
  • IOSにエージェントをインストールできないので、普通はansible

CCNA試験対策 下巻ch15: Cloud Architecture

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


Server Virtualization

Cisco Server Hardware

  • No KVM
    • keyboard, video display, mouseがない、の意
    • 人が前に座って操作する代物ではない
  • 人が直接操作しないので、省スペースが重要になってくる
  • データセンターのラックにはホスト(物理マシン)がぎっしり

Server Virtualization Basics

  • 今日びのハードウェアは1台で1つのOS・アプリケーションを動かすにはリソースが余りがち
  • なので、Hypervisorを動かして、その上でOSを複数動かす
    • 各OSに適切にリソースを割り当てる
  • Hypervisor製品の有名どころ

Networking with Virtual Switches on a Virtualized Host

  • virtual switch (vSwitch)
    • HypervisorやCiscoが提供
    • physical switchのphysical NICVMのvirtual NICを繋ぐ
    • VM間をVLANで接続できる
    • VLAN trunkingもできる

The Physical Data Center Network

  • 物理ホストは当然物理スイッチに接続されている必要がある
  • host - ToR SW - EoR SW というトポロジー
    • ToR: Top of Rack
      • サーバが詰まっているラックの最上段にいるswitch
      • access layerに相当
    • EoR: End of Row
      • distribution layerに相当
      • host, ToRとは別のラックに詰まってるやつ

Workflow with a Virtualized Data Center

  • 従来は、データセンターのサーバ仮想化エンジニアにお願いしてVMをセットアップしてもらっていた
  • 人が介在するので、まだ「クラウド」とはいえない

Cloud Computing Services

  • クラウド」って何?
  • NISTによる定義
    • On-demand self-service
      • データセンターのサーバ仮想化エンジニアに作業依頼するのはこの条件を満たさない
    • Broad network access
      • 様々な種類のネットワークをサポートしていること
        • インターネット含む
    • Resource pooling
    • Rapid elasticity
    • Measured service
      • 透明性と従量課金のため

Private Cloud (On-Premise)

  • NISTによる「クラウド」の定義5つを満たすサービスを、社内向けに提供する形態のこと

Public Cloud

  • 外部向けに売り出すやつ

Cloud and the "As a Service" Model

  • Infrastructure as a Service
  • Software as as Service
  • (Development) Platform as a Service

しってるので略

WAN Traffic Paths to Reach Cloud Services

  • public cloud利用時、WANの向こう側のpublic cloudにどうやって接続するか
  • 良し悪し
Internet Internet VPN MPLS VPN Ethernet WAN Intercloud Exchange
セキュリティ x o o o o
QoS x x o o o
キャパシティプランニング必要 o o o o o
クラウド乗り換えの障壁が低い o o x x o
導入の速さ o o x x x
  • Internet
    • 導入が速い、安い
    • セキュリティに難あり
    • QoSもサポートしない
    • SLAも普通ない
  • Internet VPN
    • Internetのセキュリティ面は大幅改善
    • QoSはサポートしない、SLAも普通ない
  • Private WAN (MPLS VPN, Ethernet WAN)
    • セキュア
    • QoSSLA対応
    • 回線開設に時間と費用がかかる
  • Intercloud WAN
    • Private WANの間接層としてはたらき、クラウド乗り換え障壁の問題を解消する
      • 顧客はIntercloud WANサービスへのPrivate WANを開設する
      • クラウド乗り換え時は新たにPrivate WANを開設する必要がない
    • 間に1社挟まるのがデメリット
  • いずれの場合もネットワークのキャパシティプランニングは必要である
    • 例) 「本社 - (Private WAN) - 支社 - (Internet)」 という構造の場合

CCNA試験対策 下巻ch11: Quality of Service (QoS)

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


Introduction to QoS

  • 例えばWAN edgeのrouterは、WAN側は遅く、LAN側は速い
  • ので、LAN側に数百数千のパケットが渋滞しうる
  • どうする? -- QoS

QoS: Managing Bandwidth, Delay, Jitter, and Loss

  • ネットワークのトラフィックの特性
    • Bandwidth
      • bps
      • 速度と捉えることもできるし、キャパシティと捉えることもできる
        • 10%をvoice、50%をmission-critial、残りを普通のトラフィックに充てる、など
    • Delay
      • one-way delay: 送信して届くまで
      • round-trip delay: パケットを1つ送信して1つ返ってくるまで
    • Jitter
      • delayのばらつき
    • Loss
      • sentを分母とする百分率
      • 要因
        • faulty cabling
        • WANサービス側の問題
        • LAN側のキューあふれ
        • など

Types of Traffic

Data Applications

  • ユーザが求めているのは良いQoE (Quality of Experience)
  • アプリケーションによって求められるQoS特性は異なるという話
    • 例: バッチ
      • delayやjitterは大した問題にならない
      • bandwidthが大きいことやlossが少ないことが重要

Voice and Video Applications

voice video
bandwidth ? 384kbpbs - 20+Mbps
delay < 150ms 200-400ms
jitter < 30ms < 30-50ms
loss < 1% 0.1% - 1%

QoS on Switches and Routers

  • 本章では便宜上packet/frameの区別をしないこととする
    • 重要でないので

Classification and Marking

Classification Basics

  • 他のQoSツールの前段
  • パケットを分類する

Matching (Classification) Basics

  • パケットが通過する全デバイスで複雑なマッチングをするのは得策でない
    • パフォーマンスに悪影響がある
  • 早期に複雑なマッチングを済ませてマーキングし、以降はマーキングに基づいて簡単なマッチングで済ませるのが得策
  • DSCP: Differentiated Services Code Point
    • マーキング用のフィールド

Classification on Routers with ACLs and NBAR

  • QoS実現のためにはパケットの分類が必要
  • ACLでパケットを分類できる
  • ACLでうまく分類できない場合はNBARという選択肢もある
  • NBAR: Network Based Application Recognition
    • 一般的にNBAR2 -- next-generation NBAR のこと
    • アプリケーション層の情報まで利用してパケットを分類する

Marking IP DSCP and Ethernet CoS

  • CoS: L2のQoS用フィールド
  • DSCP: L3のQoS用フィールド
CoS DSCP
voice 5 EF
video 4 AF41
business-critical 2 AF21

Marking the IP Header

  • 送信元ホストから宛先ホストまでずっと残る
    • ルータホップ時、L2フレームは剥がすがL3ヘッダは破棄しない
  • ToSフィールド(8ビット)
    • 昔: IPP: IP Precedence フィールドとして3ビットだけ使われていた
    • 今: DSCPフィールドに6ビット使っている

Marking the Ethernet 802.1Q Header

  • CoS (3ビット)
    • 802.1Qタグに含まれる
    • ので、利用できるのはトランクリンクに限られる
      • VLAN越えられない

Other Marking Fields

Defining Trust Boundaries

  • ホストは好き勝手にDSCPやCoSを設定してパケットを送信できる
  • voice packetじゃないのにEF (Expedited Forwarding)を設定したりできる
  • ので、DSCPやCoSを無条件に信じるわけにはいかない
  • Trust Boundaries
    • ここからのパケットのDSCPやCoSは信じますよ、という境界
    • 典型的にはfirst ingress switchやIP phone

DiffServ Suggested Marking Values

  • DSCP値の標準化みたいな話
  • RFC2475

Expedited Forwarding (EF)

  • 10進数の46番
  • 音声データ用
    • cf. voice signaling packetはCS3

Assured Forwarding (AF)

Best Drop Worst Drop
Best Queue AF41 (34) AF42 (36) AF43 (38)
AF31 (26) AF32 (28) AF33 (30)
AF21 (18) AF22 (20) AF23 (22)
Worst Queue AF11 (10) AF12 (12) AF13 (14)
  • 4種のキュー
  • 各キューの中でのdrop優先度
  • 8の倍数がないのは後述のCSに割り当てられているため

Class Selector (CS)

  • IPP互換
    • 3ビットのIPP (000 ~ 111)が6ビットのDSCP(000000 ~ 111000)になったので、8の倍数
IPP CS DSCP
0 CS0 0
1 CS1 8
2 CS2 16
3 CS3 24
4 CS4 32
5 CS5 40
6 CS6 48
7 CS7 56

Guidelines for DSCP Marking Values

  • 結局どういうときにどれ使えばいいの
    • DSCP EF: Voice payload
    • AF4x: Interactive video
      • ビデオ会議とか
    • AF3x: Streaming video
    • AF2x: High priority (low latency) data
    • CS0: Standard data

Queuing

  • 出力インタフェースがbusyなときにパケットを溜めておくやつ
    1. 受信したパケットをclassifierで分類し
    2. 分類ごとにqueueに積み
    3. schedulerで優先度づけして送信する

Round-Robin Scheduling (Prioritization)

Low Latency Queuing

  • 対話的な音声(電話など)や映像(ビデオ会議など)では、重み付けラウンドロビンでは十分なlow latency/jitter/loss特性を得られない
  • スケジューラにLLQ: Low Latency Queuingを追加することで解決する
    • 最優先なキュー
  • 新たに生じる問題: queue starvation
    • interfaceの処理能力以上のトラフィックがLLQに入ってきたら、他のキューが処理されなくなる
  • 解決法: policing
    • LLQに最大帯域幅を設定し、あふれたパケットを破棄する
  • 新たに生じる問題: 音声パケットのロスが生じる
  • 解決法: CAC: Call Admission Control
    • 詳細は割愛

Shaping and Policing

  • このまま送受信したらトラフィックがあふれてしまう、という時
    • shaping: queueに積んで送信を遅延する
    • policing: 破棄するか、優先度の低い値で再マーキングする

Policing

Where to Use Policing

  • SPのネットワーク機器(受信側)でトラフィック制限
    • 顧客から過剰のトラフィックを送りつけられたら破棄する or 優先度の低い値で再マーキングする

Shaping

  • 送信側で設定
  • トラフィックが設定値をあふれないようにqueueに積んで送信を遅延する

Setting a Good Shaping Time Interval for Voice and Video

  • 送信を遅延するので、当然delayとjitterが増大する
  • 例: 1000Mbpsのinterfaceのegress trafficを200MbpsにShapingする場合
  • shaperのtime intervalが1000msだと、
    200ms送信・800ms待機・200ms送信・800ms待機…という挙動になる
  • 800msのdelayが生じるということ
    • voice packetには耐えない
  • 解決法: shaperのtime intervalを短く設定する
    • 対話的音声や映像には10ms程度
      • 2ms送信・8ms待機…となる

Congestion Avoidance

TCP Windowing Basics

  • windowing
    • window
      • TCPコネクションにおいて、senderが一度に送信してよいバイト数
    • windowに達したら、receiverからackを受け取るまで送信を待機する
    • 待機時間は無駄なので、これを無くすために、receiverはackするたびにwindowを倍々にしていく
    • 輻輳によるパケットロスが検出されたらwindowを狭める
  • tail drop
    • ネットワーク機器のqueueが一杯になり、新たなパケットが破棄される状態

Congestion Avoidance Tools

  • tail dropを未然に防ぐために、TCPセグメントを破棄する
    • TCPコネクションはパケットロスを検出してwindowを狭める
    • tail dropよりも長い目で見てマシ

CCNA試験対策 下巻ch10: Network Address Translation

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


Perspectives on IPv4 Address Scalability

CIDR

  • RFC4632
  • 知ってるので略

Private Addressing

  • RFC1918
  • 知ってるので略

Network Address Translation Concepts

  • RFC3022
  • private networkのprivate IPv4 addressはインターネットでは通用しない
  • ので、インターネットにパケットを送出する際に、source IPv4 addressをISPから買ったpublic registered IPv4 addressに変換する必要がある
  • 逆に、インターネットから入ってくるパケットのdestination IPv4 addressをprivate networkのprivate IPv4 addressに変換する必要もある
  • private network -> public networkにおいて…
    • Inside Local: 変換前のsource address
    • Inside Global: 変換後のsource address
    • Outside Local: 変換前のdestination address
    • Outside Global: 変換後のdestination address

Static NAT

  • NAT Tableを静的に設定するやつ

Dynamic NAT

  • NAT Tableが動的に設定されるやつ
    • localとglobalのIPアドレスの1対1関係自体は変わらない
    • 利用可能なinside global addressのPoolを設定しておく

Overloading NAT with Port Address Translation

NAT Configuration and Troubleshooting

Static NAT Configuration

f:id:wand_ta:20200629001955p:plain

  • 10.1.1.1から170.1.1.1pingする場合
  • NATを設定しない場合、170.1.1.1デフォルトゲートウェイ170.1.1.254で応答パケットが破棄される
    • 10.*.*.* (class A private address)へのroutingがないので

f:id:wand_ta:20200629002003p:plain

  • NATを設定する
  • まず、どのinterfaceがinside、どのinterfaceがoutsideかを設定
    • Static,Dynamic,PAT 共通
NAT(config)#interface g0/0/0
NAT(config-if)#ip nat inside
NAT(config-if)#
NAT(config-if)#interface g0/0/1
NAT(config-if)#ip nat outside
NAT(config-if)#exit
  • NATを静的に設定
NAT(config)#ip nat inside source static 10.1.1.2 200.1.1.2
NAT(config)#ip nat inside source static 10.1.1.1 200.1.1.1
  • NATテーブル確認
    • staticなので設定時点でNATテーブルにエントリが追加されている
NAT#show ip nat translations
Pro  Inside global     Inside local       Outside local      Outside global
---  200.1.1.1         10.1.1.1           ---                ---
---  200.1.1.2         10.1.1.2           ---                ---
  • アドレス変換の統計情報
NAT#show ip nat statistics
Total translations: 2 (2 static, 0 dynamic, 0 extended)
Outside Interfaces: GigabitEthernet0/0/1
Inside Interfaces: GigabitEthernet0/0/0
Hits: 0  Misses: 0
Expired translations: 0
Dynamic mappings:
C:\>ping 170.1.1.1

Pinging 170.1.1.1 with 32 bytes of data:

Request timed out.
Reply from 170.1.1.1: bytes=32 time=12ms TTL=125
Reply from 170.1.1.1: bytes=32 time<1ms TTL=125
Reply from 170.1.1.1: bytes=32 time<1ms TTL=125

Ping statistics for 170.1.1.1:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 12ms, Average = 4ms
  • 統計情報に反映された
NAT#show ip nat statistics
Total translations: 10 (2 static, 8 dynamic, 8 extended)
Outside Interfaces: GigabitEthernet0/0/1
Inside Interfaces: GigabitEthernet0/0/0
Hits: 7  Misses: 8
Expired translations: 0
Dynamic mappings:
  • パケットのIPv4アドレスが書き換わっていることも確認できる
  • pingのsource

f:id:wand_ta:20200629002018p:plain

f:id:wand_ta:20200629002027p:plain

Dynamic NAT Configuration

  • NATを行うrouterでinside/outsideを設定するのは同じ
  • insideはACLでマッチして、outsideは利用可能なpublic registered ip addressesのpoolを定義しておく
NAT(config)#ip nat pool hoge 200.1.1.1 200.1.1.2 netmask 255.255.255.252
NAT(config)#ip nat inside source list 1 pool hoge
NAT(config)#
NAT(config)#access-list 1 permit 10.1.1.2
NAT(config)#access-list 1 permit 10.1.1.1
  • ping from 10.1.1.1
C:\>ping 170.1.1.1

Pinging 170.1.1.1 with 32 bytes of data:

Reply from 170.1.1.1: bytes=32 time=1ms TTL=125
Reply from 170.1.1.1: bytes=32 time<1ms TTL=125
Reply from 170.1.1.1: bytes=32 time<1ms TTL=125
Reply from 170.1.1.1: bytes=32 time<1ms TTL=125

Ping statistics for 170.1.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

Dynamic NAT Verification

  • 10.1.1.1 <-> 200.1.1.1の変換だけがNATテーブルに追加される
NAT#show ip nat translations 
Pro  Inside global     Inside local       Outside local      Outside global
icmp 200.1.1.1:18      10.1.1.1:18        170.1.1.1:18       170.1.1.1:18
icmp 200.1.1.1:19      10.1.1.1:19        170.1.1.1:19       170.1.1.1:19
icmp 200.1.1.1:20      10.1.1.1:20        170.1.1.1:20       170.1.1.1:20
icmp 200.1.1.1:21      10.1.1.1:21        170.1.1.1:21       170.1.1.1:21
  • 統計情報には Dynamic mappings:に情報が追加される
NAT#show ip nat statistics
Total translations: 0 (0 static, 0 dynamic, 0 extended)
Outside Interfaces: GigabitEthernet0/0/1
Inside Interfaces: GigabitEthernet0/0/0
Hits: 11  Misses: 12
Expired translations: 12
Dynamic mappings:
-- Inside Source
access-list 1 pool hoge refCount 0
 pool hoge: netmask 255.255.255.252
       start 200.1.1.1 end 200.1.1.2
       type generic, total addresses 2 , allocated 0 (0%), misses 0
  • NATテーブルの動的に追加されたエントリは clear ip nat translationコマンドで削除できる
NAT#clear ip nat translation *
NAT#show ip nat translations 
(空)

NAT Overload (PAT) Configuration

  • overloadをつけるだけ
  • poolのエントリが1件しかないケースを考える
NAT(config)#ip nat pool hoge 200.1.1.1 200.1.1.1 netmask 255.255.255.252
NAT(config)#ip nat inside source list 1 pool hoge overload 
  • 10.1.1.1, 10.1.1.2 からpingした直後
NAT#show ip nat translations 
Pro  Inside global     Inside local       Outside local      Outside global
icmp 200.1.1.1:10      10.1.1.2:10        170.1.1.1:10       170.1.1.1:10
icmp 200.1.1.1:11      10.1.1.2:11        170.1.1.1:11       170.1.1.1:11
icmp 200.1.1.1:12      10.1.1.2:12        170.1.1.1:12       170.1.1.1:12
icmp 200.1.1.1:30      10.1.1.1:30        170.1.1.1:30       170.1.1.1:30
icmp 200.1.1.1:31      10.1.1.1:31        170.1.1.1:31       170.1.1.1:31
icmp 200.1.1.1:32      10.1.1.1:32        170.1.1.1:32       170.1.1.1:32
icmp 200.1.1.1:33      10.1.1.1:33        170.1.1.1:33       170.1.1.1:33
icmp 200.1.1.1:9       10.1.1.2:9         170.1.1.1:9        170.1.1.1:9
  • IPアドレス200.1.1.1に変換されていることがわかる
  • PATではport番号でmultiplexできるので、pool自体不要で、NAT routerのoutside側interfaceのIPアドレスを利用することもできる
ip nat inside source list 1 interface g0/0/1 overload
  • NAT routerのoutside側、つまり200.1.1.251との変換が行われる
NAT#show ip nat translations 
Pro  Inside global     Inside local       Outside local      Outside global
icmp 200.1.1.251:13    10.1.1.2:13        170.1.1.1:13       170.1.1.1:13
icmp 200.1.1.251:14    10.1.1.2:14        170.1.1.1:14       170.1.1.1:14
icmp 200.1.1.251:15    10.1.1.2:15        170.1.1.1:15       170.1.1.1:15
icmp 200.1.1.251:16    10.1.1.2:16        170.1.1.1:16       170.1.1.1:16
icmp 200.1.1.251:34    10.1.1.1:34        170.1.1.1:34       170.1.1.1:34
icmp 200.1.1.251:35    10.1.1.1:35        170.1.1.1:35       170.1.1.1:35
icmp 200.1.1.251:36    10.1.1.1:36        170.1.1.1:36       170.1.1.1:36
icmp 200.1.1.251:37    10.1.1.1:37        170.1.1.1:37       170.1.1.1:37
  • poolは使わなくなったのでDynamic mappings:の項は無くなった
NAT#show ip nat statistics
Total translations: 8 (0 static, 8 dynamic, 8 extended)
Outside Interfaces: GigabitEthernet0/0/1
Inside Interfaces: GigabitEthernet0/0/0
Hits: 49  Misses: 52
Expired translations: 32
Dynamic mappings:

CCNA試験対策 下巻ch9: Device Management Protocols

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


Chapter 9: Device Management Protocols

System Message Logging (Syslog)

Sending Messages in Real Time to Current Users

  • デフォルトで全severity出力

Storing Log Messages for Later Review

Router(config)#logging ?
  A.B.C.D   IP address of the logging host
  buffered  Set buffered logging parameters
  console   Set console logging parameters
  host      Set syslog server IP address and parameters
  on        Enable logging to all enabled destinations
  trap      Set syslog server logging level
  userinfo  Enable logging of user info on privileged mode enabling
  • buffered
    • 本体のRAM
  • console
    • console
  • monitor
    • vty
      • Packet Tracerでは動かない
  • host
    • syslogサーバ
    • プロダクション環境ではこれ
    • severity levelの設定はtrapで行う(後述)

Log Message Format

Router(config-if)#no shutdown

%LINK-5-CHANGED: Interface GigabitEthernet0/0/0, changed state to up
  • こういうやつ
Router(config)#service timestamps log datetime msec

Router(config)#interface g0/0/1
Router(config-if)#no shutdown

*3 01, 00:04:03.044: %LINK-5-CHANGED: Interface GigabitEthernet0/0/1, changed state to up
  • A timestamp
    • *3 01, 00:04:03.044:
  • The facility on the router that generated the message
    • %LINK
  • The severity level
    • 5
  • A mnemonic for the message
    • CHANGED
  • The description of the message
    • Interface GigabitEthernet0/0/1, changed state to up

Log Message Severity Levels

Keyword Numeral 分類
Emergency 0 severe
Alert 1 severe
Critical 2 impactful
Error 3 impactful
Warning 4 impactful
Notification 5 normal
Informational 6 normal
Debug 7 debug
  • logging console 4 のようにするとコンソールのログ出力をWarning以上(0-4)に絞ることができる
    • Packet Tracerでは動かなかった

Configuring and Verifying System Logging

Router#show logging
Syslog logging: enabled (0 messages dropped, 0 messages rate-limited,
          0 flushes, 0 overruns, xml disabled, filtering disabled)

No Active Message Discriminator.


No Inactive Message Discriminator.


    Console logging: level debugging, 3 messages logged, xml disabled,
          filtering disabled
    Monitor logging: level debugging, 3 messages logged, xml disabled,
          filtering disabled
    Buffer logging:  disabled, xml disabled,
          filtering disabled

    Logging Exception size (4096 bytes)
    Count and timestamp logging messages: disabled
    Persistent logging: disabled

No active filter modules.

ESM: 0 messages dropped
    Trap logging: level informational, 3 message lines logged

The debug Command and Log Messages

  • severity level 7 (debug)は特殊用途
  • debugコマンド出力用
Router(config)#interface loopback 0

Router(config-if)#ip address 172.16.1.1 255.255.255.0
Router(config-if)#^Z

Router#ping 172.16.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/2/5 ms
  • icmpメッセージのdebug logが出る
Router#debug ip icmp 
ICMP packet debugging is on
Router#ping 172.16.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!
ICMP: echo reply sent, src 172.16.1.1, dst 172.16.1.1

ICMP: echo reply rcvd, src 172.16.1.1, dst 172.16.1.1
!
ICMP: echo reply sent, src 172.16.1.1, dst 172.16.1.1

ICMP: echo reply rcvd, src 172.16.1.1, dst 172.16.1.1
!
ICMP: echo reply sent, src 172.16.1.1, dst 172.16.1.1

ICMP: echo reply rcvd, src 172.16.1.1, dst 172.16.1.1
!
ICMP: echo reply sent, src 172.16.1.1, dst 172.16.1.1

ICMP: echo reply rcvd, src 172.16.1.1, dst 172.16.1.1
!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/5 ms

Router#
ICMP: echo reply sent, src 172.16.1.1, dst 172.16.1.1

ICMP: echo reply rcvd, src 172.16.1.1, dst 172.16.1.1

Router#
  • CPUを食うので気をつける
  • 全無効化
Router#no debug all
All possible debugging has been turned off

Network Time Protocol (NTP)

  • 時計を合わせましょうという話
    • メッセージを突合しやすくなる
    • プロトコルによっては時刻がずれすぎると動作しない

Setting the Time and Timezone

Router(config)#clock timezone GST 9
Router(config)#^Z
Router#clock set 19:28:00 28 June 2020
Router#show clock
4:28:3.880 GST Mon Jun 29 2020
Router(config)#clock timezone JST 0
Router(config)#^Z
%SYS-5-CONFIG_I: Configured from console by console

Router#show clock
19:28:25.31 JST Sun Jun 28 2020

Basic NTP Configuration

command as an NTP client as an NTP master
ntp master x o
ntp server o o
  • ntp serverはNTPサーバ/クライアント兼任するので、数珠つなぎできる
    • Stratum 3,4,...
R1(config)#interface g0/0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#ntp master 2
R1(config)#end
R2(config)#interface g0/0/0
R2(config-if)#ip address 10.0.0.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
R2(config-if)#exit
R2(config)#ntp server 10.0.0.1
  • 定期的に時刻同期する
R2#debug ntp packets 
NTP packets debugging is on

R2#6 28 19:41:24.418: NTP: xmit packet to 10.0.0.1
6 28 19:41:40.496: NTP: xmit packet to 10.0.0.1
6 28 19:41:56.560: NTP: xmit packet to 10.0.0.1
6 28 19:42:12.633: NTP: xmit packet to 10.0.0.1
6 28 19:42:28.751: NTP: xmit packet to 10.0.0.1
6 28 19:42:44.856: NTP: xmit packet to 10.0.0.1
6 28 19:43:00.932: NTP: xmit packet to 10.0.0.1
6 28 19:43:17.014: NTP: xmit packet to 10.0.0.1

NTP Reference Clock and Stratum

  • stratumの話
    • NTPの仕様的にNTPサーバには15までしか設定できないので注意
R1#show ntp status
Clock is synchronized, stratum 2, reference is 127.127.1.1
nominal freq is 250.0000 Hz, actual freq is 249.9990 Hz, precision is 2**24
reference time is 0C6E07DE.00000302 (20:30:22.770 UTC 日 6 28 2020)
clock offset is 0.00 msec, root delay is 0.00  msec
root dispersion is 0.00 msec, peer dispersion is 0.48 msec.
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is - 0.000001193 s/s system poll interval is 6, last update was 18 sec ago.
R1#show ntp associations 

address         ref clock       st   when     poll    reach  delay          offset            disp
*~127.127.1.1   .LOCL.          1    11       64      377    0.00           0.00              0.48
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured

Redundant NTP Configuration

ntp server time-a-b-nist.cov
ntp server time-a-g-nist.cov
ntp master
  • インターネット上のNTPサーバーの接続が絶たれたらinternal clockにフェイルオーバーして自身がNTPサーバーになる

NTP Using a Loopback Interface for Better Availability

  • 経路を冗長化しているとき、特定の物理interfaceのIPアドレスを設定すべきでない
    • そのrouterに到達可能でも、そのinterfaceがdownになったらNTPの同期がとれなってしまうため
  • こういうときはloopback interfaceを用いる
    • routerが生きていて、かつ明示的にshutdownしない限り常にup/upな論理interface
    • OSPFのRIDに使ったりもした
  • サーバの設定
R1(config)#interface loopback 0
R1(config-if)#ip address 1.2.3.4 255.255.255.255
R1(config-if)#exit
R1(config)#ntp source loopback 0
  • ntp source <interface>はPacket Tracerで動作しなかった
  • routing確認
R1#show ip route 
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.2.3.4/32 is directly connected, Loopback0
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.0.0/24 is directly connected, GigabitEthernet0/0/0
L       10.0.0.1/32 is directly connected, GigabitEthernet0/0/0

これ:

C       1.2.3.4/32 is directly connected, Loopback0
  • どの物理interfaceから入ってきたかによらず、このrouterにさえ到達できれば疎通できるIPアドレス
  • クライアント側も設定
    • しかるべきrouting設定をしてあること
R2(config)#ntp server 1.2.3.4

Analyzing Topology Using CDP and LLDP

Examining Information Learned by CDP

  • Cisco Discovery Protocol
  • Cisco独自の隣接ノード探索プロトコル
  • やりとりできる情報
    • Device identifier
      • ホスト名など
    • Address list
    • Port identifier
    • Capabilities list
      • routerかswitchか、など
    • Platform
      • モデル、OSレベルなど
R2#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID    Local Intrfce   Holdtme    Capability   Platform    Port ID
R1           Gig 0/0/0        126            R       ISR4300     Gig 0/0/0
R2#show cdp neighbors detail

Device ID: R1
Entry address(es): 
  IP address : 10.0.0.1
Platform: cisco ISR4300, Capabilities: Router
Interface: GigabitEthernet0/0/0, Port ID (outgoing port): GigabitEthernet0/0/0
Holdtime: 152

Version :
Cisco IOS Software [Everest], ISR Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.6.4,RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Sun 08-Jul-18 04:33 by mcpre

advertisement version: 2
Duplex: full
  • hostname指定可能
R2#show cdp entry R1

Device ID: R1
Entry address(es): 
  IP address : 10.0.0.1
Platform: cisco ISR4300, Capabilities: Router
Interface: GigabitEthernet0/0/0, Port ID (outgoing port): GigabitEthernet0/0/0
Holdtime: 133

Version :
Cisco IOS Software [Everest], ISR Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.6.4,RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Sun 08-Jul-18 04:33 by mcpre

advertisement version: 2
Duplex: full

Configuring and Verifying CDP

  • グローバルで有効/無効化設定できる(run)
R2(config)#cdp ?
  run  Enable CDP
  • interfaceごとに設定上書きできる(enable)
    • 送信/受信個別の設定はできない (cf. lldpはできる)
R2(config-if)#cdp ?
  enable  Enable CDP on interface
  • CDP自体の有効/無効の確認、update/holdtime timerの確認
R2#show cdp
Global CDP information:
    Sending CDP packets every 60 seconds
    Sending a holdtime value of 180 seconds
    Sending CDPv2 advertisements is enabled
  • 個々のinterfaceについて確認
R2#show cdp interface ?
  Ethernet         IEEE 802.3
  FastEthernet     FastEthernet IEEE 802.3
  GigabitEthernet  GigabitEthernet IEEE 802.3z
  Serial           Serial
  <cr>
R2#show cdp interface g0/0/0
GigabitEthernet0/0/0 is up, line protocol is up
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
  • トラフィックの統計情報を確認できるらしいがPacket Tracerで動作せず:
R2#show cdp traffic

Examining Information Learned by LLDP

  • Link Layer Discovery Protocol
  • IEEE802.1AB標準
  • デフォルト無効
R2#show lldp neighbors 
% LLDP is not enabled
  • 有効化
R2(config)#lldp run 
R2(config)#^Z
R2#show lldp neighbors 
Capability codes:
    (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
    (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
Device ID           Local Intf     Hold-time  Capability      Port ID
R1                  Gig0/0/0       120        R               Gig0/0/0
  • CDPとの比較
R2#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID    Local Intrfce   Holdtme    Capability   Platform    Port ID
R1           Gig 0/0/0        137            R       ISR4300     Gig 0/0/0
  • LLDPをCDPと比較したときの特徴
    • platform情報がない
    • capability codesが異なる
      • B (bridge) ... L2SW台頭前のportが数個しかないやつ
R2#show lldp neighbors detail 
------------------------------------------------
Chassis id: 0030.A33D.4801
Port id: Gig0/0/0
Port Description: GigabitEthernet0/0/0
System Name: R1
System Description:
Cisco IOS Software [Everest], ISR Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.6.4,RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Sun 08-Jul-18 04:33 by mcpre
Time remaining: 90 seconds
System Capabilities: R
Enabled Capabilities: R
Management Addresses - not advertised
Auto Negotiation - supported, enabled
Physical media capabilities:
    1000baseT(FD)
Media Attachment Unit type: 10
Vlan ID: 1

Total entries displayed: 1
  • show lldp entry <hostname>で特定のhostの情報だけ取得できるはずだが、Packet Tracerで動作せず

Configuring and Verifying LLDP

  • グローバルコンフィグで有効/無効化できる(run)
R2(config)#lldp  ?
  run  Enable LLDP
  • ほか、interfaceごとに受信(receive)/送信(transmit)の有効/無効化ができる
R2(config)#int g0/0/0
R2(config-if)#lldp ?
  receive   Enable LLDP reception on interface
  transmit  Enable LLDP transmission on interface
  • グローバル設定確認
R2#show lldp

Global LLDP Information:
    Status: ACTIVE
    LLDP advertisements are sent every 30 seconds
    LLDP hold time advertised is 120 seconds
    LLDP interface reinitialisation delay is 2 seconds
  • show lldp interface <interface>でインタフェースごとの設定確認もできるはずだがPacket Tracerでは動作せず
  • show lldp trafficで統計情報を確認できるはずだが、やはりPacket Tracerでは動作せず

英語

  • by virtue of
    • おかげで

CCNA試験対策 下巻ch8: DHCP Snooping and ARP Inspection (2/2)

https://www.ciscopress.com/store/ccna-200-301-official-cert-guide-volume-2-9781587147135www.ciscopress.com


Dnyamic ARP Inspection

DAI Concepts

Review of Normal IP ARP

  • ARP SpoofingとDAIの理解のためにはまず正常なARPフローの理解が必要
  • ARP要求側はもちろん、応答側も相手のIPアドレス-MACアドレス対応を学習するという点が肝

Gratuitous ARP as an Attack Vector

  • GARP: Gratuitous ARP
    • 自身のIPアドレスをSource IP address/Target IP addressにセットしてブロードキャストする
  • GARPの目的
    • 自身のIPアドレスの重複検出
      • 返答が返ってきたら重複があるということ
    • broadcast domain内のARPキャッシュ更新
      • ARP応答側も学習するので
  • 後者を攻撃に利用できる
    • ARPキャッシュを汚染し、MITM攻撃に繋げる

Dynamic ARP Inspection Logic

  • DAIのアイディア: DHCP Snooping Binding Tableを用いてARPメッセージの正当性を確認する
  • DHCPを利用していない場合はARP ACLsを利用する
  • DHCPのCHADDRのチェック同様、IEEE802.3ヘッダのsource MAC address等の照合有効化することもできる

Dynamic ARP Inspection Configuration

Configuring ARP Inspection on a Layer 2 Switch

ip arp inspection vlan 1
!
ip dhcp snooping vlan 1
no ip dhcp snooping information option
ip dhcp snooping
...
!
interface GigabitEthernet0/1
 ip arp inspection trust
 ip dhcp snooping trust
 ip dhcp snooping limit rate 10

これと

ip arp inspection vlan 1

これ

interface GigabitEthernet0/1
 ip arp inspection trust
  • ステータス
Switch#show ip arp inspection

Source Mac Validation      : Disabled
Destination Mac Validation : Disabled
IP Address Validation      : Disabled

 Vlan     Configuration    Operation   ACL Match          Static ACL
 ----     -------------    ---------   ---------          ----------
    1     Enabled          Inactive

 Vlan     ACL Logging      DHCP Logging      Probe Logging
 ----     -----------      ------------      -------------
    1     Deny             Deny              Off

 Vlan      Forwarded        Dropped     DHCP Drops      ACL Drops
 ----      ---------        -------     ----------      ---------
    1              4              0              0              0

 Vlan   DHCP Permits    ACL Permits  Probe Permits   Source MAC Failures
 ----   ------------    -----------  -------------   -------------------
    1              4              0              0                     0

 Vlan   Dest MAC Failures   IP Validation Failures   Invalid Protocol Data
 ----   -----------------   ----------------------   ---------------------
    1                   0                        0                       0
  • DAIでDHCP Snooping binding tableに乗っかる場合、テーブルを確認できる
Switch#show ip dhcp snooping binding 
MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface
------------------  ---------------  ----------  -------------  ----  -----------------
00:01:64:DB:A5:C5   10.0.1.52        86400       dhcp-snooping  1     FastEthernet0/1
00:E0:F9:57:1A:AA   10.0.1.51        86400       dhcp-snooping  1     FastEthernet0/2
Total number of bindings: 2
  • DAIの統計情報
Switch#show ip arp inspection statistics 

 Vlan      Forwarded        Dropped     DHCP Drops     ACL Drops
 ----      ---------        -------     ----------     ---------
    1              4              0              0             0

 Vlan   DHCP Permits    ACL Permits   Source MAC Failures
 ----   ------------    -----------   -------------------
    1              4              0                     0

 Vlan   Dest MAC Failures   IP Validation Failures
 ----   -----------------   ----------------------
    1                   0                        0

Limiting DAI Message Rates

Switch(config-if)#ip arp inspection limit rate 8 burst interval 4
  • DHCP Snooping同様↑のように設定できるはずだが、Packet Tracerでは設定できなかった…
  • 設定確認
Switch#show ip arp inspection interface
Interface        Trust State     Rate(pps)    Burst Interval
---------------  -----------     ---------    --------------
Fa0/1            Untrusted              15                 1
Fa0/2            Untrusted              15                 1
...
Gig0/1           Trusted                15                 1
Gig0/2           Untrusted              15                 1
  • Rate
    • packets per seconds
  • Burst Interval
    • 連続してこの秒数Rateを超過したら、当該interfaceはerr-disabledになる

Configuring Optional DAI Message Checks

Switch(config)#ip arp inspection validate ?
  dst-mac  Validate destination MAC address
  ip       Validate IP address
  src-mac  Validate source MAC address
  • デフォルトですべて無効になっている
Switch#show ip arp inspection 

Source Mac Validation      : Disabled
Destination Mac Validation : Disabled
IP Address Validation      : Disabled
...
  • 有効化するとCPUを食うが、より広範な攻撃から防御できるようになる