{"id":101,"date":"2024-11-06T16:42:07","date_gmt":"2024-11-06T16:42:07","guid":{"rendered":"https:\/\/guillaumesblog.net\/?p=101"},"modified":"2024-11-08T16:30:50","modified_gmt":"2024-11-08T16:30:50","slug":"kvm-virtual-bridge-and-apis","status":"publish","type":"post","link":"https:\/\/guillaumesblog.net\/index.php\/kvm-virtual-bridge-and-apis\/","title":{"rendered":"KVM, virtual bridge and APIs"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Been exploring KVM on Debian12 recently on my lab machines and I wanted to run a few API tests also, and so to get it to work I had to have my VMs on the same subnet as my physical machines first which is a setup I never did before.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">I checked my hosts with <em>lscpu | grep -i virtualization<\/em> and none had the VT-x set on which is the virtualisation setting for Intel CPUs, so I embarked on a journey on UEFI get the feature up and after a bit of fiddling eventually turned it on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then I installed a full suite of tools to play with KVM <em>sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager <\/em>and launched my first two KVM domains with Oracle Linux 8 on them. It worked like a charm and I additionally tried a few options with virsh, the command line interface for VMs, instead of the GUI from virt-manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After that wanted to access my VM command line from the physical host terminal to see if I could do some bootstrapping this way, I could have used SSH but wanted to try something different, so used the serial line instead which required a bit of setup on the guest machine. Setup I actually can&#8217;t find online anymore. (I will edit the post and add it.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once done with prior steps I got these machines on my LAN instead of them being simply NAT\u2019ed, I needed them to be reachable and visible to each other on the same network. I did a bit of research and ended on this brilliant video <a href=\"https:\/\/www.youtube.com\/watch?app=desktop&amp;v=DYpaX4BnNlg\">here<\/a>, which saved me a lot of time and I simply followed the recommended steps. The objective here is to create a virtual bridge on your host and then re-attach your physical NIC to this virtual bridge, as well as any VMs running on your host; I was unfamiliar with the concept, but this make entire sense.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, I was now ready to launch a little python script that would do a calculus when sent two parameter and return the result, I bound it to port 8092 and lifted the firewall rules on the corresponding port. I was now ready to call my API from any machine in the local network with curl and it worked very nicely.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Been exploring KVM on Debian12 recently on my lab machines and I wanted to run a few API tests also, and so to get it to work I had to have my VMs on the same subnet as my physical machines first which is a setup I never did before.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-101","post","type-post","status-publish","format-standard","hentry","category-conversation"],"_links":{"self":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/comments?post=101"}],"version-history":[{"count":11,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":114,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts\/101\/revisions\/114"}],"wp:attachment":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}