15 lines
386 B
Bash
Executable File
15 lines
386 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Setup interface
|
|
ip tuntap add dev qemu-tap0 mode tap
|
|
ip link set dev qemu-tap0 up
|
|
ip addr add dev qemu-tap0 11.0.0.1/24
|
|
|
|
# Start DHCP server
|
|
systemctl start dnsmasq.service
|
|
|
|
# Setup forwarding to the outer network
|
|
iptables -t nat -A POSTROUTING --src 11.0.0.0/24 -j MASQUERADE
|
|
iptables -A FORWARD --src 11.0.0.0/24 -j ACCEPT
|
|
iptables -A FORWARD --dst 11.0.0.0/24 -j ACCEPT
|