タイトル通り。
参考:
.bash
# IP確認。enp3s0の IP を固定する
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e0:51:d8:19:9e:0c brd ff:ff:ff:ff:ff:ff
inet 192.168.11.16/24 brd 192.168.11.255 scope global dynamic noprefixroute enp3s0
valid_lft 169845sec preferred_lft 169845sec
inet6 240b:10:bfc2:2f00:3756:2dc7:e455:fc5a/64 scope global temporary dynamic
valid_lft 14371sec preferred_lft 12571sec
inet6 240b:10:bfc2:2f00:d999:aa82:9a46:516f/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 14371sec preferred_lft 12571sec
inet6 fe80::eea3:bf04:b9b1:33a9/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1c:79:2d:71:85:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.13/24 brd 192.168.11.255 scope global dynamic noprefixroute wlp1s0
valid_lft 172129sec preferred_lft 172129sec
inet6 240b:10:bfc2:2f00:e5cf:aa65:cc48:7a58/64 scope global temporary dynamic
valid_lft 14371sec preferred_lft 12571sec
inet6 240b:10:bfc2:2f00:8421:dc8d:acff:666/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 14371sec preferred_lft 12571sec
inet6 fe80::83e7:a463:c3cc:f86a/64 scope link noprefixroute
valid_lft forever preferred_lft forever
# ifconfig 入っていなかったら↓
sudo apt update
# ifconfigをインストール
sudo apt install net-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 94 not upgraded.
Need to get 204 kB of archives.
After this operation, 811 kB of additional disk space will be used.
Get:1 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 net-tools amd64 2.10-0.1ubuntu4.4 [204 kB]
Fetched 204 kB in 2s (134 kB/s)
Selecting previously unselected package net-tools.
(Reading database ... 195017 files and directories currently installed.)
Preparing to unpack .../net-tools_2.10-0.1ubuntu4.4_amd64.deb ...
Unpacking net-tools (2.10-0.1ubuntu4.4) ...
Setting up net-tools (2.10-0.1ubuntu4.4) ...
Processing triggers for man-db (2.12.0-4build2) ...
# enp3s0 のゲートワイを確認 (netmask 255.255.255.0)
ifconfig -a
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.16 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 fe80::eea3:bf04:b9b1:33a9 prefixlen 64 scopeid 0x20<link>
inet6 240b:10:bfc2:2f00:3756:2dc7:e455:fc5a prefixlen 64 scopeid 0x0<global>
inet6 240b:10:bfc2:2f00:d999:aa82:9a46:516f prefixlen 64 scopeid 0x0<global>
ether e0:51:d8:19:9e:0c txqueuelen 1000 (Ethernet)
RX packets 8446 bytes 8003299 (8.0 MB)
RX errors 0 dropped 1 overruns 0 frame 0
TX packets 2270 bytes 245705 (245.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x80400000-804fffff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 534 bytes 62325 (62.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 534 bytes 62325 (62.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.13 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 240b:10:bfc2:2f00:e5cf:aa65:cc48:7a58 prefixlen 64 scopeid 0x0<global>
inet6 240b:10:bfc2:2f00:8421:dc8d:acff:666 prefixlen 64 scopeid 0x0<global>
inet6 fe80::83e7:a463:c3cc:f86a prefixlen 64 scopeid 0x20<link>
ether 1c:79:2d:71:85:01 txqueuelen 1000 (Ethernet)
RX packets 6906 bytes 5483108 (5.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1508 bytes 228195 (228.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
cd /etc/netplan
ls
01-network-manager-all.yaml 90-NM-62d0f5c8-1d73-446a-8992-b03a07c7b7c0.yaml
50-cloud-init.yaml
.bash
# netplan の設定ファイル
sudo nano 01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
eth0:
dhcp4: no
addresses: [192.168.11.13/24] # 例
gateway4: 192.168.11.1 # 例
nameservers:
addresses: [8.8.8.8,8.8.8.4]
.bash
# 設定ファイルの反映
sudo netplan try
** (process:5755): WARNING **: 14:53:13.856: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:5755): WARNING **: 14:53:13.856: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
** (generate:5757): WARNING **: 14:53:13.862: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (generate:5757): WARNING **: 14:53:13.862: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
** (process:5755): WARNING **: 14:53:14.611: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:5755): WARNING **: 14:53:14.611: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
** (process:5755): WARNING **: 14:53:14.704: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:5755): WARNING **: 14:53:14.704: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
Do you want to keep these settings?
Press ENTER before the timeout to accept the new configuration
Changes will revert in 116 seconds
Configuration accepted.
.bash
# 確認 (enp3s0)
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e0:51:d8:19:9e:0c brd ff:ff:ff:ff:ff:ff
inet 192.168.11.13/24 brd 192.168.11.255 scope global noprefixroute enp3s0
valid_lft forever preferred_lft forever
inet6 fe80::e251:d8ff:fe19:9e0c/64 scope link
valid_lft forever preferred_lft forever
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1c:79:2d:71:85:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.18/24 brd 192.168.11.255 scope global dynamic noprefixroute wlp1s0
valid_lft 172750sec preferred_lft 172750sec
inet6 240b:10:bfc2:2f00:8600:9c1e:b9d3:a38c/64 scope global temporary dynamic
valid_lft 14371sec preferred_lft 12571sec
inet6 240b:10:bfc2:2f00:8421:dc8d:acff:666/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 14371sec preferred_lft 12571sec
inet6 fe80::83e7:a463:c3cc:f86a/64 scope link noprefixroute
valid_lft forever preferred_lft forever