Sample Header Ad - 728x90

How to forward internet connection in QEMU?

4 votes
1 answer
2759 views
Following the description on how to start an OpenWrt VM with QEMU , I downloaded the MIPS kernel and started it with this command: qemu-system-mips -kernel openwrt-22.03.3-malta-be-vmlinux-initramfs.elf -nographic -m 256 However there is no internet connection in the VM: root@(none):/# ping google.com ping: bad address 'google.com' How could the host internet connection be used in QEMU? **EDIT** As suggested in the comments, ping will not work because it uses ICMP. However, when using wget the following error occurs: root@OpenWrt:~# wget http://google.com/ Downloading 'http://google.com/ ' Failed to send request: Operation not permitted The network configuration looks like this: root@OpenWrt:~# ifconfig br-lan Link encap:Ethernet HWaddr 52:54:00:12:34:56 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link inet6 addr: fd02:a553:49cb::1/60 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:17 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1248 (1.2 KiB) TX bytes:2822 (2.7 KiB) eth0 Link encap:Ethernet HWaddr 52:54:00:12:34:56 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:17 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1290 (1.2 KiB) TX bytes:2822 (2.7 KiB) Interrupt:10 Base address:0x1060 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:528 errors:0 dropped:0 overruns:0 frame:0 TX packets:528 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:40288 (39.3 KiB) TX bytes:40288 (39.3 KiB)
Asked by Andy (95 rep)
Apr 30, 2023, 05:07 PM
Last activity: May 8, 2023, 03:59 PM