IBM Cloud:(小ネタ)2つ目以降のInterfaceにFloating IPを割り当てる方法
2021/06/05 追記
Floating IPをeth0以外に付けるのは、UIでは今はできなくなっており、API・CLI のみで可能になったようです。CLIの場合はibmcloud is in-nic-ipc
を利用します。
eth0以外に割り当てるとルーティングテーブルを変更しないといけないため、(個人的には本当に余計なお世話だと思いますが)それに気づかずにeth0以外に付けた利用者が外部通信できなくなってしまうという混乱を避けるため、本当に分かっている人しか変更させないようにという配慮のようです。
はじめに
ずっとFloating IP(FIP)は
- 1つのVSIに2つ以上のFIPは割り当てられない
- 一番最初のPrimary Interface(eth0)にしか割り振れない
と思っていた。1については現時点でも正しく、確かにすでにFIPが割り当てられている状態で他のInterfaceにFIP追加の画面が出てこない。
2もそうだよなって思っていたら、GUIを見てみたら実際にはPrimary Interface(eth0)だけでなくSecondary Interface(eth1)でもFIPを選択できる構成になっていた。よって、実際に通信が可能かを試してみた。
(なお、少なくとも過去にはこういう画面は出てこなかった記憶があるし、Docsにも以下のような記載が本記事執筆時点(2020/11/29)にはある。)
https://test.cloud.ibm.com/docs/vpc?topic=vpc-faqs-for-vsis&locale=en#faq-vsi-4
During floating IP assignment in a VPC, a customer must specify the vNIC of the instance, is that correct?
Yes, and in fact, it must be the primary network interface of a server.
FIPのeth1(Secondary Interface)への割り当てと設定
やってみると、Customer Portal上では実際に確かに割り当て可能だった。
ただし、このままではFIP経由で通信はできないはずである。なぜなら、以下のようにprimary interfaceであるeth0がdefault gatewayになっているから。
[root@syasuda-dualnic ~]# ip r
default via 10.0.0.1 dev eth0
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.25
10.4.0.0/24 dev eth1 proto kernel scope link src 10.4.0.6
169.254.0.0/16 dev eth0 scope link metric 1002
よって、この設定を変更する必要がある。default gatewayをeth1のgatewayである10.4.0.1に変更するために、以下のような設定ファイルを作成する。
interface "eth1" {
supersede routers 10.4.0.1;
}
dhclientコマンドを利用してもいいが、OS再起動しても変わらないことを確認しておきたいので、OS再起動をして設定が反映されたことを確認する。
[root@syasuda-dualnic ~]# ip r
default via 10.4.0.1 dev eth1
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.25
10.4.0.0/24 dev eth1 proto kernel scope link src 10.4.0.6
169.254.0.0/16 dev eth0 scope link metric 1002
テスト
Secondary Interfaceにアクセスできるようになった!
Shinobu-no-MacBook-Pro:~ yasuda$ ssh [email protected]
The authenticity of host '162.xx.xx.xx (162.xx.xx.xx)' can't be established.
ECDSA key fingerprint is SHA256:bYEv8UMsSudXINj9sWfPo/01Odfxt7TNzdsYwP5hh+8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '162.xx.xx.xx' (ECDSA) to the list of known hosts.
Last login: Sun Nov 29 05:41:11 2020 from 10.0.0.12
おまけ
ドキュメント修正依頼中・・・・・・
Author And Source
この問題について(IBM Cloud:(小ネタ)2つ目以降のInterfaceにFloating IPを割り当てる方法), 我々は、より多くの情報をここで見つけました https://qiita.com/testnin2/items/7a8eb72163b49509abee著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .