Skip to content

Networking

Pierre Olivier edited this page Feb 7, 2021 · 2 revisions

In order to enable network for the unikernel you need to create a tap interface. Moreover, to get access to the unikernel from outside the host, you need to bridge that interface with the physical interface of the host.

To that aim, use the following commands:

# Create the bridge br0
sudo ip link add br0 type bridge

# Add the physical interface to the bridge (change the physical interface
# name enp0s31f6 to the correct one on your machine)
sudo ip link set enp0s31f6 master br0

# At that point you will loose internet connection on the host, to get it back:
sudo dhclient br0

# Create the tap interface
sudo ip tuntap add tap100 mode tap

# Enable proxy ARP for the tap interface
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap100/proxy_arp'

# Enable the tap interface
sudo ip link set dev tap100 up

# Add it to the bridge
sudo ip link set tap100 master br0

# Next you can launch the unikernel, you need to correctly set the
# network-related environment variables for 1) the tap interface you created,
# 2) an IP for the unikernel (should be valid on your LAN) and the gateway's IP:
HERMIT_NETIF=tap100 HERMIT_IP=192.168.1.4 HERMIT_GATEWAY=192.168.1.1