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?

ConoHaVPSのUbuntuサーバーからDBサーバーに接続するためのネットワーク設定

Last updated at Posted at 2025-02-24

基本は公式サイトの以下ドキュメントに従う。

ご利用ガイド DBサーバー接続用ネットワークを使う

上記工程のうち「VPSの設定を行う」の項目はCentOSベースで解説されており、Ubuntuの場合はnetplanで設定することになる。

自分はネットワーク知識が無いため読み替えるのに苦戦したが、以下のように設定すればつながった。

$ sudo vi /etc/netplan/50-cloud-init.yaml 
network:
  version: 2
  ethernets:
    ens4: # `$ ip a`で確認
      addresses:
        - 172.21.xx.xx/23 # ConoHa管理画面の対象Webサーバー「ネットワーク情報」の「shared〜」の「IPアドレス」
      gateway4: 172.21.yy.yy # ConoHa管理画面の対象Webサーバー「ネットワーク情報」の「shared〜」の「ゲートウェイ」
      routes:
        - to: 172.21.74.0/23 # ドキュメントに記載の該当リージョンの固定値
          via: 172.21.yy.yy # gateway4と同様
          metric: 100
      dhcp4: no
# 反映
$ sudo netplan --debug apply
# 確認
$ ping private.xxxx.tyo1.database-hosting.conoha.io
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?