<div dir="ltr">Hi Amos, <div><br></div><div>I'm a libvirt QE, and I can not understand the setting on <a href="http://libvirt.org">libvirt.org</a> for rng device.</div><div>Could you please help to explain a little? </div><div>(The xml in  <a href="https://libvirt.org/formatdomain.html#elementsRng">https://libvirt.org/formatdomain.html#elementsRng</a>)<br></div><div><div><div><devices></div><div>  <rng model='virtio'></div><div>    <rate period="2000" bytes="1234"/></div><div>    <backend model='random'>/dev/random</backend></div><div>    <!-- OR --></div><div>    <backend model='egd' type='udp'></div><div>      <b><source mode='bind' service='1234'/></b></div><div><b>      <source mode='connect' host='1.2.3.4' service='1234'/></b></div><div>    </backend></div><div>  </rng></div><div></devices></div></div></div><div><br></div><div><div>How did it work with source mode='bind' and source mode='connect' together? </div><div>which process on guest or host will act as server part, which for client part?</div></div><div><br></div><div>One detail example: </div><div>start a vm with below device, and no egd running on host:<br></div><div><div><div> <rng model='virtio'></div><div>      <backend model='egd' type='udp'></div><div>        <source mode='bind' service='1234'/></div><div>        <source mode='connect' host='127.0.0.1' service='1234'/></div><div>      </backend></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/></div><div>    </rng></div><div><br></div><div>qemu command line:</div><div>-chardev udp,id=charrng0,host=127.0.0.1,port=1234,localaddr=,localport=1234 -object rng-egd,id=objrng0,chardev=charrng0 -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x9 </div></div><div><br></div></div><div><div><div class="gmail_signature"><div><br></div><div>In my understanding the purpose of the rng device on guest is to provide guest a hardware RNG device /dev/hwrng which obtain seeds from the host. </div><div>The source can be /dev/random on host, then the xml will be:</div><div><div><rng model='virtio'></div><div>      <backend model='random'>/dev/random</backend></div><div>    </rng></div></div><div><br></div><div>can be hardware on host:</div><div><div><rng model='virtio'></div><div>      <backend model='random'>/dev/hwrng</backend></div><div>    </rng></div></div><div><br></div><div>can be edg daemon running on host:</div><div><div>   <rng model='virtio'></div><div>      <backend model='egd' type='tcp'></div><div>        <source mode='connect' host='127.0.0.1' service='1234'/></div><div>      </backend></div><div>    </rng></div></div><div>(on host, there should be a egd daemon running on tcp <a href="http://127.0.0.1:1234">127.0.0.1:1234</a></div><div> # <a href="http://egd.pl">egd.pl</a> --debug-client --nofork localhost:1234)</div><div><br></div><div>Thank you very much and look forward for your response!</div></div><div class="gmail_signature"><br><br></div><div class="gmail_signature">-------<br>Best Regards,<br>Yalan Zhang<br>IRC: yalzhang<br>Internal phone: 8389413</div></div>
</div></div>