リファクタリング・ウェットウェア

リファクタリング・ウェットウェア ―達人プログラマーの思考法と学習法の読書メモを改めて作成する。。

# 名前 状態 詳細
5 達人 直感で動く ルールは達人を破滅させる。
4 熟練者 自己補正が可能 全体像を把握する。格言を活用できる。
3 上級者 問題解決ができる 初心者・中級者の指導ができる。
2 中級者 全体像を見たがらない 目の前の問題解決にかんしてのみの情報収集を行う。
1 初心者 レシピが必要 例外事項には対処できない。

下にいくほど"ルール"を重視し、上にいくほど"直感"を重要視する。
下にいくほど"問題事象の全体"がきになり、上にいくほど"問題事象の部分"が気になる。
下にいくほど"状況から切り離された絶対的なルール"が必要であり、上にいくほど"状況そのもの"把握が必要となる。

EIGRPその2(基本挙動確認)(draft)

トポロジ

[R1(c1812J)]fa0-----fa0[R2(c1812J)]

アドレス一覧

interface R1 address R2 addrss Routing Protocols
Fa0 192.168.0.1/24 192.168.0.2/24 eigrp,connected
Lo0 10.0.0.1/32 10.0.0.2/32 eigrp
Lo1 10.0.1.1/32 10.0.1.2/32 eigrp

投入設定(R1)

conf t
!
hostname Router1
!
no ip bootp server
no ip domain lookup
!
vtp mode transparent
!
interface Loopback0
 ip address 10.0.0.1 255.255.255.255
 no ip proxy-arp
!
interface Loopback1
 ip address 10.0.1.1 255.255.255.255
 no ip proxy-arp
!
interface FastEthernet0
 ip address 192.168.0.1 255.255.255.0
 no shutdown
!
!
router eigrp 1
 network 10.0.0.0
 network 192.168.0.0
!
end

投入設定(R2)

conf t
!
hostname Router2
!
no ip bootp server
no ip domain lookup
!
vtp mode transparent
!
interface Loopback0
 ip address 10.0.0.2 255.255.255.255
 no ip proxy-arp
!
interface Loopback1
 ip address 10.0.1.2 255.255.255.255
 no ip proxy-arp
!
interface FastEthernet0
 ip address 192.168.0.2 255.255.255.0
 no shutdown
!
!
router eigrp 1
 network 10.0.0.0
 network 192.168.0.0
!
end

確認(R1側でのコマンド実行結果)

  • show ip route
Router1#sh ip route
Codes: 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
       i - IS-IS, su - IS-IS summary, 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

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.0.1.1/32 is directly connected, Loopback1
D       10.0.0.0/8 is a summary, 00:00:09, Null0
C       10.0.0.1/32 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, FastEthernet0
  • show ip protocols
Router1#sh ip protocols
Routing Protocol is "eigrp 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Default networks flagged in outgoing updates
  Default networks accepted from incoming updates
  EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
  EIGRP maximum hopcount 100
  EIGRP maximum metric variance 1
  Redistributing: eigrp 1
  EIGRP NSF-aware route hold timer is 240s
  Automatic network summarization is in effect
  Automatic address summarization:
    192.168.0.0/24 for Loopback0, Loopback1
    10.0.0.0/8 for FastEthernet0
      Summarizing with metric 128256
  Maximum path: 4
  Routing for Networks:
    10.0.0.0
    192.168.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    (this router)         90      00:00:49
    192.168.0.2           90      00:00:49
  Distance: internal 90 external 170
  • show ip eigrp interfaces
Router1#sh ip eigrp interfaces
IP-EIGRP interfaces for process 1

                        Xmit Queue   Mean   Pacing Time   Multicast    Pending
Interface        Peers  Un/Reliable  SRTT   Un/Reliable   Flow Timer   Routes
Lo0                0        0/0         0       0/1            0           0
Fa0                1        0/0       652       0/1         4080           0
Lo1                0        0/0         0       0/1            0           0
  • show ip eigrp neighbors
Router1#sh ip eigrp neighbors
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   192.168.0.2             Fa0               13 00:06:23  652  3912  0  7
  • show ip eigrp topology
Router1#sh ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(10.0.1.1)

Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status

P 10.0.1.1/32, 1 successors, FD is 128256
        via Connected, Loopback1
P 10.0.0.0/8, 1 successors, FD is 128256
        via Summary (128256/0), Null0
P 10.0.0.1/32, 1 successors, FD is 128256
        via Connected, Loopback0
P 192.168.0.0/24, 1 successors, FD is 28160
        via Connected, FastEthernet0

設定追加(R1・R2で実施)

  • デフォルトで入っている"auto-summary"が入っている
Router1#sh running-config | section router eigrp 1
router eigrp 1
 network 10.0.0.0
 network 192.168.0.0
 auto-summary
  • なので"auto-summary"を削除
conf t
router eigrp 1
no auto-summary
end
  • "no auto-summary"できれいさっぱり
Router1#sh running-config | section router eigrp 1
router eigrp 1
 network 10.0.0.0
 network 192.168.0.0
 no auto-summary

確認(R1側でのコマンド実行結果)

  • show ip route
Router1#sh ip route
Codes: 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
       i - IS-IS, su - IS-IS summary, 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

     10.0.0.0/32 is subnetted, 4 subnets
D       10.0.0.2 [90/156160] via 192.168.0.2, 00:00:13, FastEthernet0
D       10.0.1.2 [90/156160] via 192.168.0.2, 00:00:13, FastEthernet0
C       10.0.1.1 is directly connected, Loopback1
C       10.0.0.1 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, FastEthernet0
  • show ip protocols
Router1#sh ip protocols
Routing Protocol is "eigrp 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Default networks flagged in outgoing updates
  Default networks accepted from incoming updates
  EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
  EIGRP maximum hopcount 100
  EIGRP maximum metric variance 1
  Redistributing: eigrp 1
  EIGRP NSF-aware route hold timer is 240s
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    10.0.0.0
    192.168.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    (this router)         90      00:05:15
    192.168.0.2           90      00:00:39
  Distance: internal 90 external 170
  • show ip eigrp topology
Router1#sh ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(10.0.1.1)

Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status

P 10.0.0.2/32, 1 successors, FD is 156160
        via 192.168.0.2 (156160/128256), FastEthernet0
P 10.0.1.2/32, 1 successors, FD is 156160
        via 192.168.0.2 (156160/128256), FastEthernet0
P 10.0.1.1/32, 1 successors, FD is 128256
        via Connected, Loopback1
P 10.0.0.1/32, 1 successors, FD is 128256
        via Connected, Loopback0
P 192.168.0.0/24, 1 successors, FD is 28160
        via Connected, FastEthernet0

以下のコマンドは出力が変わらないので省略。。

show ip eigrp interfaces
show ip eigrp neighbors

ipアドレスを扱う(draft)

なんだか、perlIPアドレスの処理をいろいろとしなきゃいけなさそう。。
なので、ちょっと調べてみた。

IPアドレス正規表現

  • "192.168.0.1 255.255.255.255"的なアドレス表記を正規表現で表すと
^(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5]) (\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])$
  • "192.168.0.1/24"的なアドレス表記を正規表現で表すと
^(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4]\d|25[0-5])\/(\d|[12]\d|3[0-2])$
  • 参考URL

IPアドレスの正規表現の解説 - 燈明日記
Perl講座: 正規表現

GRE/NHRP/IPsecVPN...

仕事でちょっと触れることがあったけど、あまりよくわかってない。。
URLだけ、メモしておきます。。
動的 Ipsec マルチポイント VPN (IPsec VPN を測定するためにマルチポイント GRE/NHRP を使用する) - Cisco

DoS/DDoS

用語

  • DoS(Denial of Service):サービス拒否攻撃
  • DDoS(Distributed Denial of Service):分散型サービス拒否攻撃

概要

  • 以下のような手段でサービスを停止させる
    • ネットワーク帯域あふれ
    • サーバなどのリソースの過負荷
    • アプリケーション異常終了

詳細

  • SYN Flood攻撃
  • UDP Flood攻撃
  • ICMP Flood攻撃

ICMP echo requestの大量送付

送信元を(真の攻撃対象に)偽装したICMP echo requestを大量に複数対象に送付する。結果として、真の攻撃対象に対し、一斉にICMP echo replyが送られる。

  • Connection Flood攻撃
  • DDoS(Distributed Denial of Service)攻撃
  • DRDoS(Distributed Reflection DoS)攻撃
  • HTTP GET/POST Flood
  • Applicatoinの脆弱性をつく攻撃

対策