File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -197,17 +197,16 @@ sudo ip link set dev "$TAP_DEV" up
197197
198198# Enable ip forwarding
199199sudo 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
204208sudo iptables -t nat -D POSTROUTING -o " $HOST_IFACE " -j MASQUERADE || true
205- sudo iptables -D FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT \
206- || true
207- sudo iptables -D FORWARD -i " $TAP_DEV " -o " $HOST_IFACE " -j ACCEPT || true
208209sudo iptables -t nat -A POSTROUTING -o " $HOST_IFACE " -j MASQUERADE
209- sudo iptables -I FORWARD 1 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
210- sudo iptables -I FORWARD 1 -i " $TAP_DEV " -o " $HOST_IFACE " -j ACCEPT
211210
212211API_SOCKET=" /tmp/firecracker.socket"
213212LOGFILE=" ./firecracker.log"
You can’t perform that action at this time.
0 commit comments