3
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.

Raspberry Pi と Ubuntu 20.04 をクロスケーブルで接続

Last updated at Posted at 2020-04-29

Raspberry Pi と Ubuntu 22.04 を Ethernet クロスケーブルで接続する方法です。

Ubuntu 22.04 のアドレスを、192.168.0.10
Rasbperry Pi のアドレスを、192.168.0.13
とします。

Ubuntu 22.04 の設定

設定 -> ネットワーク
network_apr2900.png

アドレス 192.168.0.10
ネットマスク 255.255.255.0
ゲートウェイ 192.168.0.10
network_apr2901.png

ルートの設定

sudo ip route add 192.168.0.13/32 via 192.168.0.10 dev enp3s0f2

ルートテーブルの確認

$ ip route
default via 192.168.8.1 dev wlp2s0 proto dhcp metric 600 
default via 192.168.0.10 dev enp3s0f2 proto static metric 20100 
169.254.0.0/16 dev enp3s0f2 scope link metric 1000 
192.168.0.0/24 dev enp3s0f2 proto kernel scope link src 192.168.0.10 metric 100 
192.168.8.0/24 dev wlp2s0 proto kernel scope link src 192.168.8.101 metric 600

Raspberry Pi 側の設定

/etc/dhcpcd.conf に次を加える

/etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.13/24
static routers=192.168.0.10

/etc/rc.local に次を加える

/etc/rc.local
ifup eth0

ルートテーブルの確認

$ ip route
default via 192.168.0.10 dev eth0 src 192.168.0.11 metric 202 
192.168.0.0/24 dev eth0 proto dhcp scope link src 192.168.0.11 metric 202

RaspbianOS のバージョン

$ uname -a
Linux violet 5.15.61-v8+ #1579 SMP PREEMPT Fri Aug 26 11:16:44 BST 2022 aarch64 GNU/Linux
3
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
3
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?