I have written a MirageOS kernel which will make an HTTP GET request.
I want to be able to run multiple instances of these simultaneously on Solo5 but am having difficulties setting up the network, I have tried setting up multiple tap devices but this has not worked for me.
to run multiple unikernels, you have to setup a tap interface for each of them. And then, instead of configuring IP addresses on each tap device on the host system, I recommend to use a bridge interface (a virtual switch - see https://www.tldp.org/HOWTO/BRIDGE-STP-HOWTO/set-up-the-bridge.html):
Create a bridge with brctl add mybridge
Configure an IP address on the bridge ip addr add 10.0.0.1/24 dev mybridge ; ip link set dev mybridge up
Create your tap interfaces [tap100; tap101] (here, only the two steps ip tuntap add tap100 mode tap ; ip link set dev tap100 up are necessary – no need to configure an IP address on it)
For each tap interface, add it to the bridge: brctl addif mybridge tapN
Boot your unikernels, assigning a custom IP each: `solo5-hvt --net:service=tap100 – my_unikernel.hvt --ipv4=10.0.0.2/24 --ipv4-gateway=10.0.0.1
Boot your next unikernel solo5-hvt --net:service=tap102 -- my_other_unikernel.hvt --ipv4=10.0.0.3/24 --ipv4-gateway=10.0.0.1
If you’re using linux and iptables, this guide may be helpful (copy & pasted the instructions from there):
$ echo 1 > /proc/sys/net/ipv4/ip_forward # enables IP forwarding
# assuming "eth0" is your default network interface where all the traffic goes to the Internet.
$ /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ /sbin/iptables -A FORWARD -i eth0 -o mybridge -m state --state RELATED,ESTABLISHED -j ACCEPT
$ /sbin/iptables -A FORWARD -i mybridge -o eth0 -j ACCEPT