[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: how to setup user mode network backend and test it?
From: |
ckim |
Subject: |
RE: how to setup user mode network backend and test it? |
Date: |
Fri, 16 Apr 2021 07:35:18 +0900 |
Hello Peter Maydell,
I thought I can set real IP address to the VM(I know with tap networking it's
possible). 129.254.254.x is the address used in our department.
OK, I'll understand that, with just "-netdev user,id=n1 -device
e1000,netdev=n1" option, there are DHP server, DNS server and SMB server at
10.0.2.x as shown in the document provided to me. The document says "You can
use a DHCP client to automatically configure the network in the QEMU VM. The
DHCP server assigns addresses to the hosts starting from 10.0.2.15." Then, do I
get 10.0.2.15 automatically? After linux boots, I don't see that address
assigned to eth0. My initial eth0 state is like this (no IP address)
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
How should I 'run dhcp client'? (maybe I don't know how I can set linux Image
to use DHCP for network setting, I tried ip=dhcp in kernel command line to no
avail.)
Also, in the document it says : "you can download the linux-test-xxx.tar.gz
archive and copy the script qemu-ifup in /etc", but where can I get this
linux-test-xxx.tar.gz file? (I have used tap networking for qemu and rtems in
the past and have those scripts on another machine, but I'm not sure they are
correct/optimal, there are several variants/blocked commands I tried).
Thank you!
Chan Kim
> -----Original Message-----
> From: Peter Maydell <peter.maydell@linaro.org>
> Sent: Thursday, April 15, 2021 10:41 PM
> To: Chan Kim <ckim@etri.re.kr>
> Cc: qemu-discuss <qemu-discuss@nongnu.org>
> Subject: Re: how to setup user mode network backend and test it?
>
> On Thu, 15 Apr 2021 at 14:22, <ckim@etri.re.kr> wrote:
> > I tried qemu networking but it doesn’t work and I can’t figure out what
> is wrong.
> >
> > I first tried “-netdev user,id=n1 -device e1000,netdev=n1” as network
> option,(I added e1000 driver in the linux kernel build too.).
> >
> > By `ip link show` I can see there is the ‘eth0’ interface. So I gave
> > commands below
> >
> >
> >
> > ifconfig eth0 129.254.32.55 netmask 255.255.255.0 up
> >
> > route add default gw 129.254.32.1
>
> Where are you getting these IP addresses from ?
>
> The usual thing with user mode networking is to run a dhcp client inside
> the guest and let that deal with it (there is a fake DHCP server provided
> by QEMU that the guest will see on the usermode network). You should get
> an address in the 10.0.2.x range.
>
> https://qemu-project.gitlab.io/qemu/system/net.html#using-the-user-mode-
> network-stack
>
> thanks
> -- PMM