All of lore.kernel.org
 help / color / mirror / Atom feed
* Running server from within qemu
@ 2022-10-16 22:23 தாசெ ௩
  2022-10-17 17:24 ` Alex Bennée
  0 siblings, 1 reply; 4+ messages in thread
From: தாசெ ௩ @ 2022-10-16 22:23 UTC (permalink / raw)
  To: qemu-arm

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

Hi,

I am new to using QEMU.  Is it possible to host a simple http/tcp server on
a Linux which is running on qemu, without any accompanying vm (KVM), and
hit that http server from the host OS (say Windows)? What options should I
choose in army (command line args) to run any TCP based server from within
qemu?

As of now I use the following to start my OpenWRT Linux on QEMU:
$ qemu-sysyem-arm -M vert-2.9 -kernel openwrt-22.03.1-armvirt-32-zImage
-no-reboot -nographic -drive
file=openwrt-32-rootfs-ext4.img,if=virtio,format=raw -append
"root=/dev/vda" -m 1G -nic user -nic user

Thankyou

[-- Attachment #2: Type: text/html, Size: 805 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running server from within qemu
  2022-10-16 22:23 Running server from within qemu தாசெ ௩
@ 2022-10-17 17:24 ` Alex Bennée
  2022-10-17 22:13   ` தாசெ ௩
  2022-10-18  0:34   ` தாசெ ௩
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Bennée @ 2022-10-17 17:24 UTC (permalink / raw)
  To: தாசெ ௩; +Cc: qemu-arm


தாசெ ௩ <paxi.three@gmail.com> writes:

> Hi,
>
> I am new to using QEMU.  Is it possible to host a simple http/tcp server on a Linux which is running on qemu, without any
> accompanying vm (KVM), and hit that http server from the host OS (say Windows)? What options should I choose in army
> (command line args) to run any TCP based server from within qemu?
>
> As of now I use the following to start my OpenWRT Linux on QEMU:
> $ qemu-sysyem-arm -M vert-2.9 -kernel openwrt-22.03.1-armvirt-32-zImage -no-reboot -nographic -drive
> file=openwrt-32-rootfs-ext4.img,if=virtio,format=raw -append "root=/dev/vda" -m 1G -nic user -nic user
>

You have two nics in the command line. Anyway using a proper split
-netdev/-device specification:

  -netdev user,id=unet,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=unet

which in this case forwards tcp port 2222 on the host to port 22 on the
guest. Just don't expect brilliant performance. 


> Thankyou


-- 
Alex Bennée

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running server from within qemu
  2022-10-17 17:24 ` Alex Bennée
@ 2022-10-17 22:13   ` தாசெ ௩
  2022-10-18  0:34   ` தாசெ ௩
  1 sibling, 0 replies; 4+ messages in thread
From: தாசெ ௩ @ 2022-10-17 22:13 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-arm

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

Thankyou Alex.  I will try this and let you know..

On Mon, Oct 17, 2022, 10:57 PM Alex Bennée <alex.bennee@linaro.org> wrote:

>
> தாசெ ௩ <paxi.three@gmail.com> writes:
>
> > Hi,
> >
> > I am new to using QEMU.  Is it possible to host a simple http/tcp server
> on a Linux which is running on qemu, without any
> > accompanying vm (KVM), and hit that http server from the host OS (say
> Windows)? What options should I choose in army
> > (command line args) to run any TCP based server from within qemu?
> >
> > As of now I use the following to start my OpenWRT Linux on QEMU:
> > $ qemu-sysyem-arm -M vert-2.9 -kernel openwrt-22.03.1-armvirt-32-zImage
> -no-reboot -nographic -drive
> > file=openwrt-32-rootfs-ext4.img,if=virtio,format=raw -append
> "root=/dev/vda" -m 1G -nic user -nic user
> >
>
> You have two nics in the command line. Anyway using a proper split
> -netdev/-device specification:
>
>   -netdev user,id=unet,hostfwd=tcp::2222-:22 -device
> virtio-net-pci,netdev=unet
>
> which in this case forwards tcp port 2222 on the host to port 22 on the
> guest. Just don't expect brilliant performance.
>
>
> > Thankyou
>
>
> --
> Alex Bennée
>

[-- Attachment #2: Type: text/html, Size: 1662 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running server from within qemu
  2022-10-17 17:24 ` Alex Bennée
  2022-10-17 22:13   ` தாசெ ௩
@ 2022-10-18  0:34   ` தாசெ ௩
  1 sibling, 0 replies; 4+ messages in thread
From: தாசெ ௩ @ 2022-10-18  0:34 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-arm

[-- Attachment #1: Type: text/plain, Size: 4543 bytes --]

Hi Alex,

I tried what you suggested.  I have some observations.

Before going into that that:

The file /etc/config/network within my OpenWRT has:

config interface 'loopback'
option device 'io'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option url_prefix 'fd0d:5e50:c550::/40'

config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'

config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.0.201'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
option device 'eth1'
option proto 'dhcp'

config interface 'wan6'
option device 'eth1'
option proto 'dhcpv6'

Q: Do I need to make any chsnges in the above file and try?
Note: I actually tried changing the confirmation of 'br-lan' as 'dhcp' and
removing ipaddr, netmask and ip6assign, but no major change in the overall
behaviour.

Without applying the change '-netdev.....' suggested by you and with having
two '-nic user', which you pointed out, when I ran 'ifconfig', I got:
br-lan   Link encap:Whether......
              inet address:192.168.0.201 ..
              :
eth0        Link encap:Whether......
                /*no inet addr*/
                 :
eth1         Link encap:Whether......
                 inet addr:10.0.2.15..
                  :
lo               Link encap:Local Loopback
                 inet addr:127.0.0.1..
                 :
With this configuration I am able to access host-network & internet from
within OpenWRT running on QEMU.  But, this is the same configuration where
I couldn't hit the http server running on port 8000 within OpenWRT from the
host OS, which is the issue which I mentioned in my first email.  FYI, from
the host OS, I was trying to hit http://192.168.0.201:8000 . The IP address
of my host OS is 192.168.0.101

Before trying your suggestion, I just thought of reloading qemu with just a
single '-nic user' and when I ran 'ifconfig' within OpenWRT, I got the
following: (see, eth1 is missing)

br-lan   Link encap:Whether......
              inet address:192.168.0.201 ..
              :
eth0        Link encap:Whether......
                /*no inet addr*/
                 :
lo               Link encap:Local Loopback
                 inet addr:127.0.0.1..
                 :

And I couldn't hit any of the external servers from within army/OpenWRT and
hitting http://192.168.0.201:8000 from host OS also failed.

Now, I tried the option you suggested as '-netdev
user,id=unet,hostfwd=tcp::9000-:8000 -device virtio-net-pci,netdev=unet'
alone (without any '-nic user's) so that I can try hitting
http://192.168.0.201:9000 from host OS.  After loading OpenWRT on QEMU, I
tried 'ifconfig' and I got:
br-lan   Link encap:Whether......
              inet address:192.168.0.201 ..
              :
eth0        Link encap:Whether......
                /*no inet addr*/
                 :
lo               Link encap:Local Loopback
                 inet addr:127.0.0.1..
                 :

Which is very similar to the previous case

Here also, I couldn't hit any of the external servers from within
army/OpenWRT and hitting http://192.168.0.201:9000 from host OS also
failed.  Hitting http://192.168.0.101:9000 also failed.

Am I missing anything?

On Mon, Oct 17, 2022, 10:57 PM Alex Bennée <alex.bennee@linaro.org> wrote:

>
> தாசெ ௩ <paxi.three@gmail.com> writes:
>
> > Hi,
> >
> > I am new to using QEMU.  Is it possible to host a simple http/tcp server
> on a Linux which is running on qemu, without any
> > accompanying vm (KVM), and hit that http server from the host OS (say
> Windows)? What options should I choose in army
> > (command line args) to run any TCP based server from within qemu?
> >
> > As of now I use the following to start my OpenWRT Linux on QEMU:
> > $ qemu-sysyem-arm -M vert-2.9 -kernel openwrt-22.03.1-armvirt-32-zImage
> -no-reboot -nographic -drive
> > file=openwrt-32-rootfs-ext4.img,if=virtio,format=raw -append
> "root=/dev/vda" -m 1G -nic user -nic user
> >
>
> You have two nics in the command line. Anyway using a proper split
> -netdev/-device specification:
>
>   -netdev user,id=unet,hostfwd=tcp::2222-:22 -device
> virtio-net-pci,netdev=unet
>
> which in this case forwards tcp port 2222 on the host to port 22 on the
> guest. Just don't expect brilliant performance.
>
>
> > Thankyou
>
>
> --
> Alex Bennée
>

[-- Attachment #2: Type: text/html, Size: 7600 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-18  0:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-16 22:23 Running server from within qemu தாசெ ௩
2022-10-17 17:24 ` Alex Bennée
2022-10-17 22:13   ` தாசெ ௩
2022-10-18  0:34   ` தாசெ ௩

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.