0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OCI ComputeにセカンダリVNICを追加する

Last updated at Posted at 2025-06-12

色々な人が記載されており、2025.6時点の記載事項になります。
以下参照先を元にしております。
https://qiita.com/West_Tail/items/0111e1c5674a0c9b6c19

基本的にはOCIコンソール操作のみで完結する。

vnicにセカンダリ追加した設定が反映されるには条件があります。

前提のおさらい

oci-utilsに含まれるコマンド
以下は、マニュアルに記載されている、oci-utilsに含まれるコマンド群です

  • ocid
  • /usr/libexec/oci-growfs
  • /usr/bin/oci-iscsi-config
  • /usr/bin/oci-metadata
  • /usr/bin/oci-network-config
  • /usr/bin/oci-network-inspector
  • /usr/bin/oci-notify
  • /usr/bin/oci-public-ip

ocid

ocidデーモンは、Computeに複数のVNICをアタッチしたときに追加したVNIC (セカンダリVNIC) のIPを自動で構成してくれるサービスです。

oci-utilsのサービス・コンポーネント。systemdで開始されたデーモンとして実行されます。このサービスは、iSCSIおよびVNICデバイス構成で変更をスキャンし、インスタンスのOCIメタデータとパブリックIPアドレスをキャッシュします。

デフォルトでは無効になっています。

# systemctl list-unit-files ocid.service
UNIT FILE    STATE   
ocid.service disabled

(例)コンピュート作成後

[opc@XXXXX ~]$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 02:00:17:04:94:05 brd ff:ff:ff:ff:ff:ff

反映開始

(例)vnicを追加すると、以下が反映されます。

[opc@XXXXX ~]$ ip link(上述からの続き)
3: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 02:00:17:00:63:60 brd ff:ff:ff:ff:ff:ff

ただし、反映されません。

# ip -f inet -o addr
[root@gspproxy2 ~]# ip -f inet -o addr
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
2: enp0s6    inet 172.16.2.130/24 brd 172.16.2.255 scope global dynamic enp0s6\       valid_lft 84813sec preferred_lft 84813sec

そこで、ocidサービスを起動させると、セカンダリVNICのIPを自動設定してくれます。

# systemctl start ocid
# systemctl status ocid
● ocid.service - Oracle Cloud Infrastructure utilities daemon
   Loaded: loaded (/etc/systemd/system/ocid.service; enabled; vendor preset: di>
   Active: active (running) since Thu 2025-06-12 14:41:25 JST; 17min ago
 Main PID: 8288 (python3)
    Tasks: 4 (limit: 35640)
   Memory: 610.1M
   CGroup: /system.slice/ocid.service
           mq8288 /usr/bin/python3 /usr/lib/python3.6/site-packages/oci_utils/i>

無事、追加されました。
追記;以下コマンドは追加するためのコマンドではありません。

# ip -f inet -o addr
[root@gspproxy2 ~]# ip -f inet -o addr
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
2: enp0s6    inet 172.16.2.130/24 brd 172.16.2.255 scope global dynamic enp0s6\       valid_lft 84813sec preferred_lft 84813sec
3: enp1s0    inet 172.16.2.126/24 scope global enp1s0\       valid_lft forever preferred_lft forever

OS起動時に、自動でセカンダリVNICにIPを割り当てたい場合は、ocidの自動起動を有効にします。
追記;ここでの記述は恒久的な意味ですがvnicを追加する予定があれば、予め自動起動しておくのもありです。

# systemctl enable ocid
Created symlink from /etc/systemd/system/multi-user.target.wants/ocid.service to /etc/systemd/system/ocid.service.

OCI コンソール(赤枠部分を今回セカンダリとして追加)
追記;vnicの中にセカンダリという構成もできる様子ですが、ocidサービスに自動的に紐づけるには別のvnicを作成するイメージとなります。オンプレミスであれば、ネットワークカードを複数枚差し込むイメージです。(2025.6現在)

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?