Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2797

How can I bring up the tap0 interface in WSL2 for connecting mac os x to internet using qemu / kvm

$
0
0

I've installed ubuntu 20.04 on WSL2 and then I started a vm with qemu and kvm,running mac os x as guest os. It works great,except for the configuration of the net. Infact it is not able to connect to internet. Anyway,this is how looks the ifconfig on ubuntu 20 host :

root@DESKTOP-N9UN2H3:/mnt/i/macos-haxm# ifconfigeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 192.168.72.28 netmask 255.255.240.0 broadcast 192.168.79.255RX packets 17 bytes 2184 (2.1 KB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 14 bytes 1127 (1.1 KB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Instead,this is how I configured qemu to give internet to mac os x :

qemu-system-x86_64 --enable-kvm -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on -monitor stdio -no-reboot -machine q35 -m 16G -usb -device usb-kbd -device usb-tablet -drive if=pflash,format=raw,readonly,file=/mnt/i/macos-haxm/OVMF_CODE.fd -drive if=pflash,format=raw,file=/mnt/i/MacOS-Haxm/OVMF_VARS-1024x768.fd -smbios type=2 -device ide-drive,bus=ide.2,drive=Clover -drive id=Clover,if=none,snapshot=on,format=qcow2,file=/mnt/i/MacOS-Haxm/Clover.qcow2 -device ide-hd,bus=ide.1,drive=LinuxHDD -drive id=LinuxHDD,if=none,file=/mnt/i/MacOS-Haxm/images/mac_hdd_sierra.img,format=qcow2 -device ide-cd,bus=ide.0,drive=LinuxDVD -drive id=LinuxDVD,if=none,snapshot=on,media=cdrom,file=/mnt/i/MacOS-Haxm/images/apple/sierra.iso -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27

it gives no error,but it is not able to grab the connection.

this is how I have configuted the net on mac os x :

mac

To fix it,i tried to create and to bring up the tap0 interface,doing the following :

-) adding this to /etc/network/interfaces :

allow-hotplug tap0auto tap0iface tap0 inet manual    pre-up ip tuntap add tap0 mode tap user root    pre-up ip addr add 192.168.1.153/24 dev tap0    up ip link set dev tap0 up    post-up ip route del 192.168.1.0/24 dev tap0    post-up ip route add 192.168.1.152/32 dev tap0    post-down ip link del dev tap0

-) giving these commands in the linux terminal :

ip tuntap add tap0 mode tapip link set dev tap0 up

but it does not work. When I do ifconfig,you can see that the tap0 interface has no IP assigned :

root@DESKTOP-N9UN2H3:/mnt/i/macos-haxm# ifconfigeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 192.168.73.223  netmask 255.255.240.0  broadcast 192.168.79.255        inet6 fe80::215:5dff:fe55:f27b  prefixlen 64  scopeid 0x20<link>        ether 00:15:5d:55:f2:7b  txqueuelen 1000  (Ethernet)        RX packets 2461  bytes 419247 (419.2 KB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 1168  bytes 1381735 (1.3 MB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10<host>        loop  txqueuelen 1000  (Local Loopback)        RX packets 15  bytes 1149 (1.1 KB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 15  bytes 1149 (1.1 KB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0tap0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500        ether d6:6c:da:f2:1e:c8  txqueuelen 1000  (Ethernet)        RX packets 0  bytes 0 (0.0 B)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 0  bytes 0 (0.0 B)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Viewing all articles
Browse latest Browse all 2797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>