2013年1月8日火曜日

cdn.debian.net と ftp.jp.debian.org の動作に問題があればgithubにおねがい します。

Debianにおけるパッケージ流通はaptが基本的なものになっている。いまどき完全なスタンドアローンで動作しているような例もすくないので、なにかしらaptの御世話になっていることは多いかと思う。

昔のaptの実装ではhttp redirectができないので、http redirectに頼らない誘導方法になっている(現在のaptの実装ではhttp redirectができるので、http.debian.netというサービスが誕生している)。

check_serverの実装自体はRails3.2です。

動作チェック、文句、要望について

以下、内部の説明。

DNSサーバは dns.s.araki.net という名前で、dns_balanceが動作しています。

  • どのDNSを使うかはレイテンシベースのルーティングで3リージョンから選択している。
  • DNSであるdns_balanceは定期的にcheck_serverに対して最新のサーバ生死情報をELBのURL ( http://cdncheck1.araki.net/status/alive )に対してとりにいく。
  • 入手はJSONが使われる。この取得のためのプログラムは gae-surrogate.rbという名前

チェックサーバは、

  • チェック対象である世界中のDebianミラー200台をSQSに順次登録する。
  • チェックサーバの動作は http://cdncheck1.araki.net/view/index で確認できる。

チェックするためのコードはcheck-receive-forward.rbというファイル。

  • SQSからチェック対象ホストを1つ抜き出す。
  • チェックは対象ホストの http://対象サーバのアドレス/debian/project/trace/ftp-master.debian.org を確認し、最終ミラー時刻が8日以内であることを確認する。不達であったり遅延が大きい場合には"alive=0"として登録される。
  • チェック終了したらSQSから消す。
  • チェック結果はSimpleDBに登録

    地理情報の話やAS情報の話は又の機会に。

       

      2013年1月5日土曜日

      NEC IX2105でAmazon VPCにVPN接続する

      UNIVERGE IX2000/IX3000シリーズ : UNIVERGE IX2105 | NECをお借りしたので、VPCに対してVPN接続してみた。

      結果から言うと

      • あっさりつながる
      • 小さい
      • (ふんでも)壊れにくそう
      • (消費電力が小さいので)熱くならない。静か。

      というのは間違いなさそう。十分に速い線がないので、パフォーマンスについては言及できません。






       

      準備として、VPCをつくって、Customerゲートウェイを作成するまでをAWSのマネージメントコンソールで行います。

      1. AWS Management ConsoleのVPCページを開ける
      2. ”Start VPC Wizard”ボタンを押して作成開始
      3. “VPC with a Private Subnet Only and Hardware VPN Access”シナリオを選択
      4. IX2105につけるIPアドレスをいれる
      5. “Use dynamic routing (requires BGP)”を選択してVPCを作成
      6. VPN CONNECTIONS->VPN Connectionsから、作成されたVPN接続の設 定ファイルをダウンロードする。ベンダのところには対応していないのでGenericを入手する。

      すると、以下のようなファイルが入手できているはず。とりあえず、vpn-ix2105.txtとでもしておきます。


      Amazon Web Services
      Virtual Private Cloud

      VPN Connection Configuration
      ================================================================================
      AWS utilizes unique identifiers to manipulate the configuration of
      a VPN Connection. Each VPN Connection is assigned a VPN Connection Identifier
      and is associated with two other identifiers, namely the
      Customer Gateway Identifier and the Virtual Private Gateway Identifier.

      (以下続く)

      ファイルをひとつひとつ見てもいいのですが、さきに入れるべき情報を整理します。

      IPSecで使う鍵の入手


      $ grep '\-\ Pre-Shared Key' vpn-ix2105.txt
      - Pre-Shared Key : トンネル1の鍵
      - Pre-Shared Key : トンネル2の鍵

      設定に必要なAWS側のIPアドレスの入手


      $ grep "\-\ Virtual\ Private\ Gateway" vpn-ix2105.txt
      - Virtual Private Gateway : 27.0.1.16
      - Virtual Private Gateway : 169.254.252.25/30
      - Virtual Private Gateway : 27.0.1.144
      - Virtual Private Gateway : 169.254.252.29/30

      $ grep "\-\ Customer\ Gateway" vpn-ix2105.txt
      - Customer Gateway : IX2105につけるIPアドレス
      - Customer Gateway : 169.254.252.26/30
      - Customer Gateway ASN : 65000
      - Customer Gateway : IX2105につけるIPアドレス
      - Customer Gateway : 169.254.252.30/30
      - Customer Gateway ASN : 65000

      ここまで整理したら、IX2105にシリアルコンソールを挿して設定です。

      まずは初期化してしまいましょう。


      Router#
      Router# configure
      Enter configuration commands, one per line. End with CNTL/Z.
      Router(config)# erase startup-config
      Are you sure you want to erase the startup-configuration? (Yes or [No]): yes
      Router(config)# exit
      Router# default-console command-line
      % You must RELOAD the router for this configuration to take effect.
      Router#

      初期化後の設定はごちゃごちゃ解説するよりそのもの貼ったほうがわかりやすいので
      はっておきます!Good luck!


      !
      timezone +09 00
      !
      logging buffered 131072
      logging subsystem all warn
      logging timestamp datetime
      !
      !
      ip ufs-cache enable
      ip route default GigaEthernet0.1
      ip access-list sec-list permit ip src any dest any
      !
      !
      !
      ike proposal ike-prop encryption aes hash sha group 1024-bit
      !
      ike policy ike-policy1 peer 27.0.1.16 key bbbbbbaaaaaaaaaaaaamavO8waikpkWlL ike-prop
      ike keepalive ike-policy1 10 3
      !
      ike policy ike-policy2 peer 27.0.1.144 key cccccccccdddddddddddddda49yt ike-prop
      ike keepalive ike-policy2 10 3
      !
      ipsec autokey-proposal ipsec-prop esp-aes esp-sha lifetime time 3600
      !
      ipsec autokey-map ipsec-map1 sec-list peer 27.0.1.16 ipsec-prop pfs 1024-bit
      !
      ipsec autokey-map ipsec-map2 sec-list peer 27.0.1.144 ipsec-prop pfs 1024-bit
      !
      ppp profile pppoe
      authentication myname aa@bb.jp
      authentication password aa@bb.jp xxxxxxxxxxxxxxxxx
      !
      router bgp 65000
      neighbor 169.254.252.25 remote-as 10124
      neighbor 169.254.252.25 timers 10 30
      neighbor 169.254.252.25 receive-capability override
      neighbor 169.254.252.29 remote-as 10124
      neighbor 169.254.252.29 timers 10 30
      neighbor 169.254.252.29 receive-capability override
      address-family ipv4 unicast
      originate-default always
      !
      device GigaEthernet0
      !
      device GigaEthernet1
      !
      interface GigaEthernet0.0
      no ip address
      shutdown
      !
      interface GigaEthernet1.0
      description == admin net ==
      ip address 192.168.1.205/24
      no shutdown
      !
      interface GigaEthernet0.1
      description == flets ==
      encapsulation pppoe
      auto-connect
      ppp binding pppoe
      ip address ipcp
      ip napt enable
      ip napt static GigaEthernet0.1 udp 500
      ip napt static GigaEthernet0.1 50
      no shutdown
      !
      interface Loopback0.0
      no ip address
      !
      interface Null0.0
      no ip address
      !
      interface Tunnel0.0
      description == Tunnel 1 ==
      tunnel mode ipsec
      ip address 169.254.252.26/30
      ip tcp adjust-mss auto
      ipsec policy tunnel ipsec-map1 out
      no shutdown
      !
      interface Tunnel1.0
      description == Tunnel #2 ==
      tunnel mode ipsec
      ip address 169.254.252.30/30
      ip tcp adjust-mss auto
      ipsec policy tunnel ipsec-map2 out
      no shutdown

      速度については、所詮フレッツなので負荷をかけるには至りませんでした。
      iperfでの測定に限って言えばVPN経由のほうが速度がでるときもありました。

      いずれにせよ、省スペースでらくらく使えるルータとしてはアリだと思います。消費電力も小さいですし。