Skip to content

Instantly share code, notes, and snippets.

@wojtekka
Last active February 8, 2022 10:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wojtekka/6c532afa9437c9b6696e789caa6ecf4a to your computer and use it in GitHub Desktop.
Save wojtekka/6c532afa9437c9b6696e789caa6ecf4a to your computer and use it in GitHub Desktop.
Raspberry Pi Zero USB network with DHCP server
#!/bin/sh
echo "dwc2" >> /etc/modules
echo "g_ether" >> /etc/modules
echo "dtoverlay=dwc2" >> /boot/config.txt
cat > /etc/systemd/network/usb0.network << EOF
[Match]
Name=usb0
[Network]
DHCPServer=yes
Address=192.168.7.1/24
[DHCPServer]
PoolOffset=2
PoolSize=16
EOF
systemctl enable systemd-networkd.service
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment