-
-
Save dezren39/02a0b44d63022ed17f3fbc0c76479c8c to your computer and use it in GitHub Desktop.
nixos qemu networking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
tunctl -u dx -t tap0 | |
ifconfig tap0 102.168.100.1 up | |
# qemu-kvm -hda nixos-disc.img -m 1024 -net nic -net tap,ifname=tap0,script=no | |
# *** Inside the Qemu guest *** | |
# ip addr set 192.168.100.2 dev ens3 | |
# route add default gw 192.168.100.1 | |
# echo 'nameserver 8.8.8.8' >> /etc/resolv.conf | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
iptables -t nat -A POSTROUTING -o wlp0s3 -j MASQUERADE | |
iptables -I FORWARD 1 -i tap0 -j ACCEPT | |
iptables -I FORWARD 1 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment