Raspberry Pi/Zero 2W/Ubuntu/24.04: Difference between revisions
Jump to navigation
Jump to search
| Line 338: | Line 338: | ||
sudo mount -a | sudo mount -a | ||
</syntaxhighlight> | |||
|} | |||
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Post-Boot » 10-usb-wan.yaml | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0' lang='yaml'> | |||
ls -lah /etc/netplan/ | |||
cat <<'YML' | sudo /etc/netplan/10-usb-wan.yaml >/dev/null | |||
--- | |||
network: | |||
version: 2 | |||
renderer: networkd | |||
ethernets: | |||
usb0: | |||
dhcp4: false | |||
addresses: | |||
- 192.168.10.2/24 | |||
routes: | |||
- to: default | |||
via: 192.168.10.1 | |||
nameservers: | |||
addresses: | |||
- 192.168.10.1 | |||
- 8.8.8.8 | |||
optional: true | |||
YML | |||
sudo chmod 600 /etc/netplan/10-usb-wan.yaml | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0' lang='bash'> | |||
sudo netplan try --timeout 60 | |||
sudo netplan generate | |||
sudo netplan apply | |||
sudo ip add show usb0 | |||
ping -c3 192.168.10.1 | |||
ping -c3 192.168.10.2 | |||
</syntaxhighlight> | |||
|} | |||
{|class='wikitable mw-collapsible' style='width:100%;margin:6px 0 3px 0' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Post-Boot » 99-usb-gadget.yaml | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0' lang='yaml'> | |||
ls -lah /etc/netplan/ | |||
cat <<'YML' | sudo tee /etc/netplan/99-usb-gadget.yaml >/dev/null | |||
--- | |||
network: | |||
version: 2 | |||
renderer: networkd | |||
ethernets: | |||
usb0: | |||
dhcp4: no | |||
addresses: | |||
- 192.168.8.2/24 | |||
optional: true | |||
YML | |||
sudo chmod 600 /etc/netplan/99-usb-gadget.yaml | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0' lang='bash'> | |||
sudo netplan try --timeout 60 | |||
sudo netplan generate | |||
sudo netplan apply | |||
sudo ip add show usb0 | |||
ping -c3 192.168.8.1 | |||
ETH_USB0="$(ip -o link show | grep '12:a5:cf:42:92:fd' | awk -F': ' '{print $2}')" | |||
sudo ip addr add 192.168.8.1/24 dev "${ETH_USB0}" | |||
sudo ip link set "${ETH_USB0}" up | |||
sudo ip addr show "${ETH_USB0}" | |||
ping -c3 192.168.8.2 | |||
ping -c3 192.168.8.1 | |||
</syntaxhighlight> | |||
|} | |||
{|class='wikitable mw-collapsible' style='width:100%;margin:6px 0 3px 0' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Post-Boot » 70-usb-gadget-net.rules | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0' lang='ini'> | |||
ls -lah /etc/udev/rules.d/ | |||
cat <<'INI' | sudo tee /etc/udev/rules.d/70-usb-gadget-net.rules >/dev/null | |||
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="5e:bc:ca:27:92:b1", NAME="usb0" | |||
INI | |||
# sudo chmod 600 /etc/udev/rules.d/70-usb-gadget-net.rules | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight style='margin:3px 0' lang='bash'> | |||
sudo udevadm control --reload | |||
sudo udevadm trigger | |||
sudo ip add show usb0 | |||
ping -c3 192.168.8.1 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
Revision as of 03:39, 30 December 2025
lsblk
:'
sdb 8:16 1 29.8G 0 disk
├─sdb1 8:17 1 512M 0 part /media/shahed/system-boot
└─sdb2 8:18 1 29.3G 0 part /media/shahed/writable
'
|
ls -alh /media/${USER}/system-boot/{ssh,{config,cmdline}.txt}
:'
-rw-r--r-- 1 shahed shahed 170 Dec 30 01:03 /media/shahed/system-boot/cmdline.txt
-rw-r--r-- 1 shahed shahed 1.8K Dec 29 21:13 /media/shahed/system-boot/config.txt
-rw-r--r-- 1 shahed shahed 0 Dec 29 17:45 /media/shahed/system-boot/ssh
'
| ||||||
ls -lah /media/${USER}/writable/etc/netplan/
:'
total 12K
drwxr-xr-x 2 root root 4.0K Dec 30 08:29 .
drwxr-xr-x 108 root root 4.0K Dec 29 20:55 ..
-rw------- 1 root root 262 Dec 29 17:22 50-cloud-init.yaml
'
|
ls -lah /media/${USER}/writable/etc/udev/rules.d/
:'
total 72K
drwxr-xr-x 2 root root 4.0K Aug 6 01:00 .
drwxr-xr-x 4 root root 4.0K Dec 29 20:47 ..
-rw-r--r-- 1 root root 62K Aug 6 01:00 70-snap.snapd.rules
'
| ||||||
| |||||||
SD Card » Pre-Boot
|
SD Card » Pre-Boot | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||
SD Card » Post-Boot
|
SD Card » Post-Boot | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
References
|
References | ||
|---|---|---|