This commit is contained in:
Artur Gurgul 2025-08-28 17:48:34 +02:00
parent 764967c8e0
commit 93f402b012
9 changed files with 299 additions and 4 deletions

20
bin/recipes/net/net-up Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
sudo mkdir -p /etc/systemd/network
cat <<'EOF' | sudo tee /etc/systemd/network/20-enp0s1.network
[Match]
Name=enp0s1
[Network]
DHCP=yes
EOF
sudo systemctl enable --now systemd-networkd
sudo systemctl enable --now systemd-resolved
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo ip link set enp0s1 up
sudo networkctl reload
sudo networkctl reconfigure enp0s1

16
bin/recipes/net/notes.md Normal file
View file

@ -0,0 +1,16 @@
# bring the link up
sudo ip link set enp0s1 up
# give yourself an address in QEMU's usernet
sudo ip addr add 10.0.2.15/24 dev enp0s1
# default gateway for slirp
sudo ip route add default via 10.0.2.2
# DNS via slirp (or use 1.1.1.1 if you prefer)
echo "nameserver 10.0.2.3" | sudo tee /etc/resolv.conf > /dev/null
# sanity checks
ip -4 a show enp0s1
ping -c2 10.0.2.2
ping -c2 deb.debian.org