[PLUG] DHCP with QEMU

Dick Steffens dick at dicksteffens.com
Fri Jul 13 15:40:43 UTC 2018


On 07/13/2018 12:32 AM, King Beowulf wrote:
> On 07/12/2018 10:26 PM, Dick Steffens wrote:
>> While I've got Win7 up and running, the network setting are screwy. I
>> have my router set to be a DHCP server, with 192.168.0.1 as the default
>> gateway. I also assigned 192.168.0.104 as a static lease for the virtual
>> machine. However, the IPv4 address and default gateway are
>> 192.168.122.153 and 192.168.122.1.
>>
>> I think I've discovered that QEMU provides a DHCP server. What I haven't
>> found is how to tell QEMU not to be a DHCP server but to use my router.
>> Any clues as to where to make that change will be gratefully received.
>>
> Yes, qemu by default runs its own internal DHCP and NAT to isolate the
> VM from the host while providing internet access. This is on purpose for
> best security.

Understood. And that makes sense for what most folks need. My need is to 
be able to take audio files from the host and play them with 
transcription software on the guest. Unfortunately, there isn't software 
up to the task in the Linux world. I used to use something years ago, 
but the audio quality isn't there for difficult recordings. GearPlayer 
has something in it provided by Dolby, and the playback is much cleaner. 
But there isn't a market for GearPlayer on Linux, so I'm stuck with 
Windows. At least they still support Win7.

> If you just need to share files between host and VM,
> best to just use the builtin SAMBA:
>
> -netdev user,id=mynet1,hostname=win7vm,smb=/games/win32/
> -device virtio-net-pci,netdev=mynet1,mac=52:54:00:35:a6:50
>
> where '/games/win32/' is a path on the host. Access that directory
> within the VM via:
>
> \\10.0.2.4\qemu
>
> for the default network config above.  You can add a few options so that
> all VMs on the host can see each another and still be isolated from the
> host (all static IP or one of the VMs also runs a DHCP server).

The guest can see ~/Public already, so that's useful. I can put the 
directory I usually use for sharing files in Public, and get some of 
what I need.

> To have the VM as part of your network. make sure that
> 'qemu-bridge-helper' is installed, then use something like:
>
> -net nic -net tap,ifname=tap0,script=no,downscript=no
>
> or
>
> -device virtio-net,netdev=network0
> -netdev tap,id=network0,ifname=tap0,script=no,downscript=no[,vhost=on]
>
> References
> -----------
> https://en.wikibooks.org/wiki/QEMU/Networking
> https://www.linux-kvm.org/page/Networking
> https://wiki.qemu.org/Documentation/Networking
> https://wiki.archlinux.org/index.php/QEMU#Networking

I also need to see my wife's Win7 machine, so the bridged approach is 
what I'll pursue.

Thanks for the links. Once I get this solved I'll post my solution.

-- 
Regards,

Dick Steffens




More information about the PLUG mailing list