How to setup a TUN/TAP interface using OpenRC
I want Qemu to use a tap network interface, so a VM run by Qemu can access both services the host opens on the private IP, and the Internet. Port forwarding of Qemu behaves unstable in my personal experience.
Actually, I found a script that seems to work. However, I can not turn it into configurations in /etc/conf.d/net.
Examples in the file suggest the following two lines would work:
tuntap_tap0="tap0"
config_tap0="10.0.0/24"
And then
> ls -l /etc/init.d/net.*
/etc/init.d/net.lo
/etc/init.d/net.tap0 -> net.lo
> sudo /etc/init.d/net.tap0 start
* Caching service dependencies ... [ ok ]
* Bringing up interface tap0
* Creating Tun/Tap interface tap0 ...
Unknown tunnel mode "tap0" [ !! ]
* ERROR: net.tap0 failed to start
So, what's the proper way to do this?