OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:15 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: QEMU -netdev option
PostPosted: Fri Jan 29, 2021 10:54 pm 
Offline
Member
Member

Joined: Fri Nov 22, 2019 5:46 am
Posts: 590
Anyone can tell me how to use the -netdev option with QEMU, if you don't mind?
I don't know about tap or bridge or any other network stuff that the "--help" option mentions. The wikipage didn't mention -netdev at all. It seems to be a newer replacement for -net.

Greetings
Peter


Top
 Profile  
 
 Post subject: Re: QEMU -netdev option
PostPosted: Wed May 05, 2021 2:38 pm 
Offline
Member
Member

Joined: Sun Feb 04, 2018 8:04 pm
Posts: 35
-net allows you to specify the network card and its settings.
-netdev allow you to specify more general settings about that card, particularly in how it interacts with the underlying operating system.
The tun/tap stuff is important, because it controls how your card can communicate on the real network. I don't have a working network stack yet, but my QEMU settings look like this.

Code:
REM Nics I need to emulate are ne2k_pci, e1000, virtio
SET NIC1=-net nic,netdev=mynet1,model=ne2k_pci,macaddr=AA:BB:CC:DD:EE:FF
SET NETDEV1=-netdev type=user,id=mynet1,restrict=no
SET LOGNET1=-object filter-dump,id=f1,netdev=mynet0,file=%LOGDIR%\qemu-net0.pcap

SET NIC2=-net nic,netdev=mynet2,model=e1000,macaddr=AA:BB:CC:DD:EE:FE
SET NETDEV2=-netdev type=user,id=mynet2,restrict=no
SET LOGNET2=-object filter-dump,id=f2,netdev=mynet1,file=%LOGDIR%\qemu-net1.pcap

SET SYSLOG=-D %LOGDIR%/qemu/systemlog.txt
SET TRACE=-trace enable=ide*
SET IDEDISK=-drive file=%BINDIR%\bootable.raw,format=raw,if=ide
REM -monitor stdio  REM lets you see monitor inside the command prompt so you can scroll to that which is invisible in the native monitor

SET QEMUCONFIG= %IDEDISK% -rtc base=localtime -cpu qemu64,+pdpe1gb -m 256M -smp 4 %NIC1% %NIC2% %NETDEV1% %NETDEV2% %NOTRACE%

REM The calling script launches qemu with %QEMUCONFIG% made up of all the above.


REM stuff I'm not using right now.
REM SATA: -M q35
REM logging %SYSLOG% %TRACE%
REM SET NVMEDISK=-device nvme,drive=nvme0,serial=deadbeaf1,num_queues=8 -drive file=%BINDIR%\bootable.raw,if=none,id=nvme0
@REM (extra for above config) %NIC1% %NIC2% %NETDEV1% %NETDEV2% %LOGNET1%



(ignore the NOTRACE variable - it resolves to an empty string. I just prefixed with NO to effectively comment out tracing)

_________________
Code or code not. There is no try.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot], Sa41848 and 62 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group