LoginSignup
5
5

More than 5 years have passed since last update.

Ubuntu 17.10でのIPアドレス変更(固定IPアドレス)

Posted at

17.10から、IPアドレスの変更が/etc/network/interfacesを弄る方式から変わったようなので、メモとして残しておきます。

interfaceの確認

ifconfigもしくはip addrを実行して変更対象のinterface名を確認しておきます

root@localhost:~# ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

IPアドレス変更

/etc/netplan/01-netcfg.yamlを開き、後はお好みでIPアドレスを変更していきます。以下は設定例になります

root@localhost:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      addresses: [192.168.1.3/24]
      gateway4: 192.168.11.1
      nameservers:
        addresses: [192.168.11.1,192.168.11.2]
      dhcp6: no

IPアドレス変更の反映

netplan applyを実行して反映して完了です。再起動までは必要ないです

root@localhost:~# netplan apply

参考

Configuring Static IP Addresses on Ubuntu 17.10 Servers – Website for Students

5
5
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
5
5