AWSとSoftLayerをvxlanで繋いでみる
Japan SoftLayer Summit 2015があり、ちょっとSoftLayerに興味を持ったので、
触って見ました。
いつもならOracle RAC構築に走るのですが、
SoftLayerでのOracle RAC構築は以下のURLで紹介されていますので、今回は個人的にアツイvxlanを使って
AWSとSoftLayerをvxlanで繋いでみます。
Oracle RAC+Softlayerの記事はこちら
http://dba-ha.blogspot.jp/2014/07/softlayer-oracle-rac.html
なお、EC2 with vxlanについては、こちらのエントリで紹介していますので、vxlanについて解説はしません。
http://d.hatena.ne.jp/KNOPP/20141210/1418224473
今回の構成は以下の通りです。
AWS/SoftLayer | ホスト名 | OS(カーネル) | PublicIP | 実インターフェース | vxlan用IP | vxlan用インターフェース |
---|---|---|---|---|---|---|
AWS | A | Amazon linux 2014.09.2.x86_64(3.14.27-25.47.amzn1.x86_64) | 54.200.xx.xx | eth0 | 192.168.1.1 | vxlan0 |
SoftLayer | B | CentOS7(3.10.0-123.20.1.el7.x86_64) | 158.85.xx.xx | eth1 | 192.168.1.2 | vxlan0 |
・事前準備
EC2側、SoftLayer側双方でUDP通信ができるようにしておく。
(ポート番号の指定方法が今のところ不明なので、UDP ALLということで、、、)
・EC2側
###Amazon Linuxにインストールされているiproute2はvxlan(unicast)に対応していないので、 ###最新版をソースから入手しインストール sudo su - yum -y install git bison flex libdb-devel db4-devel gcc git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git cd iproute2 ./configure make make DESTDIR=/usr/share install ###vxlanの構成 #仮装デバイス vxlan0 vlanid 10 使用する物理デバイスはeth0 /usr/share/sbin/ip link add vxlan0 type vxlan id 10 dev eth0 #vxlan0にipアドレスを振る /usr/share/sbin/ip addr add 192.168.1.1/24 broadcast 192.168.1.255 dev vxlan0 #vxlanインターフェースをアップさせる。 /usr/share/sbin/ip link set vxlan0 up #ホストBを登録 /usr/share/sbin/bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 158.85.xx.xx
SoftLayer側
###CentOS7ではiproute2がvxlan(unicast)に対応しているので、iproute2のインストールの必要はありません。 ###ただし、kernel 3.10.0-123.20.1.el7未満だとvxlanをunicastで使おうとするとKernelパニックが起きるので注意(kernel updateが必要) ###softlayerのCentOS7は2/14現在kernelは3.10.0-123.20.1.el7なので、問題無し。 ###vxlanの構成 #仮装デバイス vxlan0 vlanid 10 使用する物理デバイスはeth1(public) ip link add vxlan0 type vxlan id 10 dev eth1 #vxlan0にipアドレスを振る ip addr add 192.168.1.2/24 broadcast 192.168.1.255 dev vxlan0 #vxlanインターフェースをアップさせる。 ip link set vxlan0 up #ホストAを登録 bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 54.200.xx.xx
動作確認 ping ホストB→A
[root@centos ~]# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=44.1 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=21.7 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=21.6 ms 64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=21.7 ms 64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=21.8 ms
動作確認 ping ホストA→B
[root@ip-172-31-39-175 iproute2]# ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. 64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=22.0 ms 64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=21.8 ms 64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=21.9 ms 64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=21.9 ms 64 bytes from 192.168.1.2: icmp_seq=5 ttl=64 time=21.9 ms
動作確認 ホストBへ追加でIP(192.168.1.3/24)付与
[root@centos ~]#ip addr add 192.168.1.3/24 broadcast 192.168.1.255 dev vxlan0
動作確認 ping ホストA→B (追加したIP)
[root@ip-172-31-39-175 iproute2]# ping 192.168.1.3 PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data. 64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=45.3 ms 64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=22.6 ms 64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=22.7 ms 64 bytes from 192.168.1.3: icmp_seq=4 ttl=64 time=22.6 ms 64 bytes from 192.168.1.3: icmp_seq=5 ttl=64 time=22.7 ms
こんな感じでSoftLayer、AWS間で仮想L2ができました。
なお、SoftLayer、AWS間の通信は暗号化されていませんので、ご利用は計画的に。