Skip to content

Commit

Permalink
fix: properly setup outbound network connectivity in getting started
Browse files Browse the repository at this point in the history
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.

Suggested-by: Pablo Barbáchano <[email protected]>
Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Nov 28, 2024
1 parent 4c33853 commit 8d01d76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ sudo ip link set dev "$TAP_DEV" up

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

HOST_IFACE="eth0"
HOST_IFACE=$(ip -j route list default |jq -r '.[0].dev')

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

0 comments on commit 8d01d76

Please sign in to comment.