Skip to content

Commit c14528d

Browse files
committed
fix: properly setup outbound network connectivity in getting started
the getting started guide was hardcoding eth0 as the network interface on the host to route outbound microvm network traffic to. However, on EC2 instances (and my laptop), that's wrong, because its not called eth0. So instead dynamically determine the hopefully correct network interface on the host. Fixes: #4930 Suggested-by: Pablo Barbáchano <[email protected]> Signed-off-by: Patrick Roy <[email protected]>
1 parent 4c33853 commit c14528d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/getting-started.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ sudo ip link set dev "$TAP_DEV" up
197197

198198
# Enable ip forwarding
199199
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
200+
sudo iptables -P FORWARD ACCEPT
200201

201-
HOST_IFACE="eth0"
202+
# This tries to determine the name of the host network interface to forward
203+
# VM's outbound network traffic through. If outbound traffic doesn't work,
204+
# double check this returns the correct interface!
205+
HOST_IFACE=$(ip -j route list default |jq -r '.[0].dev')
202206

203207
# Set up microVM internet access
204208
sudo iptables -t nat -D POSTROUTING -o "$HOST_IFACE" -j MASQUERADE || true

0 commit comments

Comments
 (0)