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?

More than 1 year has passed since last update.

Ubuntu 22.04 - ネットワーク設定

Last updated at Posted at 2022-11-29

ネットワークまわりの設定

環境

Ubuntu 22.04 LTS

設定

デフォルトのコンフィグファイルは無効化しておきます。Ubuntu は上から順にファイルを読み込んでいるようなので、デフォルトファイルがあるとうまく設定できません。

$ sudo mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.org

コンフィグファイルを作成/編集します

$ sudo vi /etc/netplan/99-config.yamal

iでインサートモードに入って、次の通りに入力します
(インターフェースやネットワークアドレスは自分の環境に置き換え)

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: false
      addresses:
        - 192.168.1.99/24
      routes:
        - to: default
          via: 192.168.10.254
      nameservers:
        addresses: [8.8.8.8]

Escして:wqで保存します

$ sudo netplan apply

念のため、IP Address/Route を確認しておこう

$ ip address
$ ip route
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?