QEMU/KVM Attaching a Virtual NIC Directly to a Physical Interface

Man, it took me a while to figure out how to do this! Over on Attaching a Virtual NIC Directly to a Physical Interface I figured out I could use this XML in Virtual Machine Manager (virt-manager) for my NIC device:

<interface type='direct'>
  <source dev='enp9s0' mode='bridge'/>
</interface>

That then gets expanded automatically to something like this:

<interface type="direct">
  <mac address="52:54:00:ce:5b:09"/>
  <source dev="enp9s0" mode="bridge"/>
  <target dev="macvtap4"/>
  <model type="rtl8139"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x10" slot="0x01" function="0x0"/>
</interface>

Update: ah, balls. This doesn’t completely work, because the guest can’t connect to the host, and vice versa, even though both the host and the guest can connect to the internet. This is a problem for another day. Maybe this or this will help?

Good learners

I was reading about Neil Postman and found myself on the inquiry education page. It says that all good learners have:

  • Self-confidence in their learning ability
  • Pleasure in problem solving
  • A keen sense of relevance
  • Reliance on their own judgment over other people’s or society’s
  • No fear of being wrong
  • No haste in answering
  • Flexibility in point of view
  • Respect for facts, and the ability to distinguish between fact and opinion
  • No need for final answers to all questions, and comfort in not knowing an answer to difficult questions rather than settling for a simplistic answer

The Problems of Philosophy, further reading

At the end of The Problems of Philosophy, Bertrand Russell says:

The student who wishes to acquire an elementary knowledge of
philosophy will find it both easier and more profitable to read some
of the works of the great philosophers than to attempt to derive an
all-round view from handbooks. The following are specially
recommended:

AliExpress diodes

I ordered a bunch of SMD diodes from AliExpress (nine different types), and nine packages arrived, but they weren’t labeled. I tested everything to infer what I got, and they didn’t ship me what I ordered. My notes are here and the video of me doing all this is here.

I kept a note of the seller and will try to not order from them again. In the mean time I think I have filed the components that did arrive in the correct drawer.

Below are two happy snaps from this project. I guess on the bright side I got some practice doing SMD soldering and using my signal generator and my scope.

Oh, and I added a new item to my debugging notes, viz “is it plugged into the right socket?” (I had my output cable on the signal generator plugged into the wrong BNC connector on the device, that took some figuring out…)

John's test rig

John's test rig, labeled

Mail log IP address count

The following monster will parse the mail log and report on unique host connections along with a count.

cat /var/log/mail.log | \
  grep ' connect from unknown' | \
  awk '{ print $8 }' | \
  sort | \
  sed -n 's/.*\[\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)\].*/\1/p' | \
  awk '{count[$1]++} END {for (word in count) print count[word], word}' | \
  sort -n

Data formats including YAML

I finally got around to reading about YAML at Wikipedia. Worth doing if you use YAML anywhere and haven’t read the YAML page yet.

The Wikipedia article links to the official website: yaml.org, which is good fun. It’s written in YAML! :D

If you’re interested in data formats and markup languages here’s some other reading on the subject: