簡単に言うとAmazon VPC内のインスタンスにNICの二枚差しが可能になるサービスなようです。
今までAWSのインスタンスはeth0しか使えなかったので、これは便利になりそうです。
VPC内のネットワーク構成の幅が大きく広がるようなサービスなので、少しだけ触ってみました。
二枚差しって事はVPC内のルーティングテーブルを使わずにVyattaとかでルーティングしたりNATしたり出来るので、それを試します。
※ちなみにこちらにあるように、今までもNAT Addressingを使ってNATをする事は出来ました。
今回テストをした構成は以下のようなイメージとなります。
Vyattaは@j3tm0t0さんが作成されたAMIを使用させて頂きました。
※ENIはManagement Consoleからも作成可能で、インスタンス起動時/起動後どちらでも追加する事が出来ます。
※インスタンス起動後にChange Source/Dest CheckをDisableにする事をお忘れなく。
■割り当てたローカルIPと同じ設定をVyatta側に設定します
- $ configure
- # set interfaces ethernet eth1 address 10.2.2.200/24
- # set interfaces ethernet eth1 smp_affinity auto
- # set interfaces ethernet eth1 speed auto
- # commit
- # run show interfaces ethernet
- Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
- Interface IP Address S/L Description
- --------- ---------- --- -----------
- eth0 10.2.1.200/24 u/u
- eth1 10.2.2.200/24 u/u
- [edit]
- # save
- # set service nat rule 10 type masquerade
- # set service nat rule 10 source address 10.2.2.0/24
- # set service nat rule 10 outbound-interface eth0
- # commit
- # save
- # route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 10.2.2.0 * 255.255.255.0 U 0 0 0 eth0
- default 10.2.2.1 0.0.0.0 UG 0 0 0 eth0
- # route add -net 10.2.1.0 netmask 255.255.255.0 gw 10.2.2.200
- # route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 10.2.1.0 10.2.2.200 255.255.255.0 UG 0 0 0 eth0
- 10.2.2.0 * 255.255.255.0 U 0 0 0 eth0
- default 10.2.2.1 0.0.0.0 UG 0 0 0 eth0
- # ping -c 3 10.2.1.201
- PING 10.2.1.201 (10.2.1.201) 56(84) bytes of data.
- 64 bytes from 10.2.1.201: icmp_seq=1 ttl=63 time=31.2 ms
- 64 bytes from 10.2.1.201: icmp_seq=2 ttl=63 time=0.849 ms
- 64 bytes from 10.2.1.201: icmp_seq=3 ttl=63 time=0.863 ms
- --- 10.2.1.201 ping statistics ---
- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms
- rtt min/avg/max/mdev = 0.849/10.995/31.275/14.340 ms
- # traceroute 10.2.1.201
- traceroute to 10.2.1.201 (10.2.1.201), 30 hops max, 60 byte packets
- 1 10.2.2.200 (10.2.2.200) 0.785 ms 0.769 ms 0.751 ms
- 2 10.2.1.201 (10.2.1.201) 1.088 ms 1.232 ms 1.213 ms
- # tail -f /var/log/httpd/access_log
- 10.2.1.200 - - [25/Dec/2011:12:00:43 +0000] "GET /index.html HTTP/1.1" 200 12 "-" "curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2"
まだ触り始めたばかりですが、ENIはVPCで色々なネットワークを構成出来るのでインフラエンジニア的にはとてもワクワクしますね!