hi,
I'm on a corporate network that is filtered (proxy) and I need to run some
tests on a W11 virtual machine that needs to have direct access to the
Internet.
I set up this configuration and route everything that comes out of tap0 to
wlan0 and then to Internet :

        -                              -
         \                            /
          \                          /
           \                        /
   +--------\----------+   +-------/-------+
   |free GW            |   |corporate GW   |
   |192.168.144.254/24 |   |10.10.10.254/24|
   +----------|--------+   +-------|-------+
               \                  /
+---------------|-----------------|------+
|HOST  |wlan0           |  |eth0         |
|      |192.168.144.1/24|  |10.10.10.1/24|
|      +----------------+  +-------------|
|                                        |
|      +-----------------+               |
|      |tap0             |               |
|      |192.168.11.254/24|               |
|      +--------|--------+               |
|               |                        |
| +-------------|--------+               |
| |VM  |eth0             |               |
| |    |192.168.11.1/24  |               |
| |    +-----------------|               |
| +----------------------+               |
+----------------------------------------+

and here are the commands used on the host :

# ip tuntap add tap0 mode tap user me
# ip addr add 192.168.11.254/24 dev tap0
# ip link set tap0 up
# echo 11 tap0 >> /etc/iproute2/rt_tables
# ip rule add from 192.168.11.0 lookup tap0
# ip route add default via 192.168.144.254 dev wlan0 proto dhcp src
192.168.144.1 table tap0
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
$ alias qemu
*alias qemu='TMPDIR=/tmp/ /usr/bin/qemu-system-x86_64 -accel kvm -machine
q35 -m 2048 -device qemu-xhci -device usb-tablet -cpu qemu64,kvm=off
-parallel null -serial mon:stdio'*
$ qemu -hda w11.disk -nic tap,ifname=tap0,script=no,downscript=no

I can ping 8.8.8.8 from my virtual machine and all seems ok.

do you know of an easier way to achieve this direct Internet access ?

regards, lacsaP.

Reply via email to