VM Networking ( Libvirt / Bridge )

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's good everybody welcome to this video on vm networking specifically with libvert and setting up bridge interfaces so this is a next step in the sort of series that i've recently been doing around virtual machines and libvard and kvm this one's going to be completely focused on networking but it is going to assume you have some understanding of the qmu libver kvm stack and if you don't i have a blog post and video on that you might want to pause this and watch that or watch some other content on it before jumping into this networking one but that being said let's get right into it just like most of my videos on youtube this has an accompanying blog post so during or after the video if you want to go through kind of some of the commands that were run some you know more detailed descriptions than i'll probably given this recording feel free to check that out and i'll have the link to that in the description as well and you know as a quick aside i just wanted to say i've been super encouraged by a lot of the feedback i've been getting and i'm really psyched to continue making videos making content on linux programming containers kubernetes and in the coming weeks i'm going to wrap some things up that is going to give me a little bit more runway to to start doing that more and more so really looking forward to pushing out more content do be sure to like throw some comments and let me know what you'd like to see i'd love to hear from you so without further ado vm networking there's kind of three things we're going to dive into here the first piece we're going to get into is just to deep dive into libvert's default network for many of us who start using virtual machines with things like libvert this is oftentimes the initial way we network our vms and then over time we decide we want our virtual machines to be reachable on a larger local area network or at least have some more configuration over or configurability over how that we have them in iraq so this is where we're going to dive into bridge networking interfaces now both libvert and this next section we'll talk about we'll use bridge network interfaces but we'll talk a little bit about how setting one up and kind of making a host act as a bit of a virtual switch along with a along with a hypervisor for your vms is really beneficial we'll automate all that process after we go through it manually and then finally we're going to hook some virtual machines into that that that bridge interface we set up so hopefully you find this educational and interesting and maybe even practical for some of the stuff that you're trying to do so diving right into it the first thing that we need to look at and actually i need to start off by starting libvert on this host because it is not active right now so we'll do system ctl start libvert d all right so that will start libvert for me on my machine and then we're just going to check out the the libvert networks that are available and as many of you know you can you can communicate over command line with libvert by using verse so we'll do a verse net list and assuming you spell it right you're gonna see on my machine i have no networks set up by default so let's go ahead and change that if i do a verse net start for the default network and then do that list one more time we'll see that now the default network is active and again this is something that's really common when you first start using libvert to use the default network it's where virtual machines will typically attach to by default but before we get too advanced with vm networking let's talk about what it even means to have a default network and and how it's laid out so one of the things that we should know by running this command there's a couple things that have occurred and i'm going to kind of make my text a bit smaller because there's going to be a lot of output here all right so the first thing that we need to know is that two new network interfaces got created the first one is the virtual bridge interface and this can be thought of as a virtual switch that's running inside of the host and just like a physical switch the virtual machines will be able to come online and sort of like plug into the switch so that they become routable with one another there is one more interface that gets created it's this virtual bridge nick now this interface i've got some more details in my blog post about why it exists but suffice to say that it's kind of like a dummy interface that gets instantiated that has a mac address such that when the virtual bridge comes up since it's the first thing kind of bonded or or uh brought into that bridge interface the bridge interface is going to inherit that mac address so in short don't worry too much about this virtual bridge nick right now focus mostly on the virtual bridge which is where we're going to be plugging things into now i should also call out that this computer i'm running on does have two interfaces representing hardware so that's the very top one or i should say number two eno1 this is my ethernet interface and then wlp5s0 is representing my wireless card which is completely not in use as you can see my ip address is allocated to my ethernet and that's what we're going to be using in conjunction with bridges and all that good stuff so we have a network as we've seen and we know that it has set up two interfaces for us the most important one being the virtual bridge now another thing that's been set up here is a process which is called dns mask and for those of you familiar with dns mask you might know it in its capacity to actually be a sort of like localized dns cache i mean it can it basically can be a dns server you set up as well but it actually has a lot of extra features it can actually do like pixie booting and tftp stuff and in the case of libvert it's actually acting as a dhcp server so it's handling the ip leases of the virtual machines that we attach to the virtual bridge so if you ever wondered well where do my virtual machines get their eyepiece from if you're using the default network it's probably coming from dns mask in fact if we grab the config file here and then just do a quick less on the config i'll bet i'll have to pseudo that we can see some really interesting information here for example it's attached to virtual bridge and you can actually see the dhcp range that libvert configured inside of here so this is the range of ip addresses that our virtual machines will be assigned on this host all right so virtualbridge was set up a dhcp server was set up as well now that we kind of understand the pieces that were configured what about the virtual machines themselves so let's go ahead and do a quick verse list and you can see i currently have no virtual machines running from a libvert perspective so we'll do a verse list all and these are all the virtual machines i have on this machine you can see a octet bridge vm one that i was screwing with just to kind of get the blog post ready and then one i've got from actually a couple videos ago is just octets which i happen to know uses the default network and if you want to know if one of your existing vms uses the default network you can simply run verse dump xml and you can call the domain which in this case will just be octets and it comes out as a bunch of xml as the command and plot implies but if i just do a quick grep and then ask for network equals i can get that line of the xml and i can see that this octets domain is planning on using the default network so that's exactly what i want and i'm just going to go ahead and then run a verse start octets to get that virtual machine started up and we'll do a list one more time here to see the octet's virtual machine running so now that we have a virtual machine up and it's using the default network what happens you know what what pieces kind of come together to to give it an ip and all that good stuff well we've sort of talked about a bit of this but let's start it looking at the the interface level real quick so we'll do a quick ipa and the new interface that's different from before is actually number six right here so this is a v-net now the type of interface that this is is called a tap interface and this interface is set up to bind to a process in a way so the virtual machine itself is actually tied in to this v-net interface and on my blog i have a example of how you can look up the process id of the vm and then look in the file descriptor info to see that this v-net is bound to it but for this video i don't think you know sidebarring into that is that important but if you can trust me i can tell you that v-net zero is definitely what's attached to the octets in this case virtual machine now you'll notice one important aspect of v-net and that is that it is bound to the virtual bridge and again this is like the vm being plugged into that virtual switch it's taking part in it another thing that we can do since this is all managed locally is we can say versch list dhcp or sorry net dhcp leases i always get my list and all those commands mixed up and if we run this command real quick i'll make the text a little bit smaller so it doesn't uh so it doesn't over wrap too much we'll see one line is going to wrap here but we can actually see the virtual machine that came online so the host name for that octets vm is josh and the ip address that it was assigned via in this case dns mask is 192.168.12212. you can see the mac address of the vm you can even see when that ip lease is going to expire so that's all set up and running well now we've talked about the interfaces and all that stuff and i think it helps to kind of look at this visually to really make sure we're grocking all the moving pieces so let me just go ahead and open this up here and we'll come to that diagram a bit later and let's look at what we've got right now now obviously i've only got one virtual machine set up but with everything we've looked at this is roughly what the flow from the network standpoint looks like virtual machines come up inside the virtual machine they just see an eth0 they kind of feel like they're an ethernet device they don't really know any better but that is bound that process is again bound to v-net zero which v-net zero is plugged into the virtual bridge another virtual machine comes up another v-net tap device comes up and that links into the virtual bridge it's just like plug-in machines into a switch now as packets go from this virtual machine they'll hit the switch they'll go to this virtual machine if this virtual machine asks for something like google.com based on the routing table in the host it will know to go out through the ethernet device and actually hit the gateway probably a router depending on how your home lab set up to actually access google.com and maybe that's the one piece that we should just take a quick look at here since we haven't yet would be the route table of the specific hypervisor so this is what the route table looks like by default you can see the destination set inside of here with the mask and specifically you can see this not only for kind of the local network but also for the vm network itself and depending on how familiar you are gateway000 can actually be a little confusing because in a lot of cases we think of this meaning like all addresses or something but this actually implies that there kind of is no gateway in other words it's gonna happen locally and and if it goes up through here it's gonna you know be an external packet going to google or something and there's this gateway resolution that is basically in my case with my router it actually relates to 192.168.11 we'll dig a little bit more into this later when we when we set it up but it's suffice to say that this routing table is going to let things flow between the vm network within the lan network and then all the way out to the gateway if it's going external as well all right so we've got an understanding of how this is all set up we've got a virtual machine linked up this is that default behavior now the crux of this model where it can fall apart a little bit is there's actually a lot of things i mean there's a lot of network configurations you might be trying to solve for but i think at a very simple level we commonly get ourselves to a place where we say wow this is great but i really want another hypervisor i really want a host that's on my network like say a laptop to be able to go in and actually hit these virtual machines as if they're on the network because keep in mind they have their own right now dhcp server they have their own their own switch they're kind of isolated on the hypervisor itself and that's what we're going to talk about changing in our next section which is going to be on setting up a bridge network now to set up a bridge network i've got to do a little bit of cleanup here so the first thing i'm going to do is when i did netstart i'm actually going to do net destroy on default which is going to bring down that network so we'll list the network again and this will be netlist i can never remember if it's listnet or netlist but we'll get rid of that we'll get rid of that all right now we can see the network is completely down in fact if we just do a quick sanity check with ipas we can see that the virtual net is still here because remember the vm is still up but our ethernet interface and wi-fi interface are the primary ones that are left over so let's go ahead and get rid of that so we'll do verse shut down and we'll do this for the octets domain all right and then if we do sorry the text size is going to change a lot in this video because there's a lot of wrapping that's going to happen if we do ipas now we can see we're in a simpler mode right we've just got our ethernet interface our wireless interface and our loopback okay now to kind of start us off fresh here normally i'd probably just restart my computer and start over but i'm going to just do some quick stuff to make sure that we're starting starting empty and fresh i'm actually going to go ahead and bring down the the ethernet interface and i'm also going to get rid of its ip address and you'll see why that's a little bit important later now let's do a quick and we're going to use the ip tool for this by the way so we're going to do ip and we're going to do link set down actually it's link set i think device right i always forget the order here link set en01 down and we'll do a quick sudo all right and that worked well so we'll do ipa and we can see that eno1 now is in fact in the state of down so that's exactly what we want but i also want to get rid of its ip address because we're going to see when we set up the bridge network that we're going to provide the ip on the bridge level which we'll we'll dive into so let's grab this ip address real quick and let's just do a ip address and it's delete and it's this and i think it's dev eno one you need to put let's see yep that looks good and we'll do the ip one more time oops get that in there all right looking good so en01 our ethernet device no longer has an ip address assigned to it and it is down so it's kind of like we started our system with no kind of networking manager capabilities turned on and this is actually a good part or point to bring this up with what we're about to do we want to make sure that any type of network management daemon is actually turned off because what i'm going to walk you through here is how to set everything up manually then we'll talk about automating it so some common you know management daemons for example so if we did a pseudo system ctl status network manager network manager is a really common one it's most common in the context of desktops so in your server it might not be as common but we want to make sure that this is off and then another one we want to make sure is off is systemd network d now oh and it's actually on for me oops yeah that's good that we checked that so let's go ahead and stop that there okay and then we'll just do a status one more time and it's inactive now good so what's interesting about systemd network d is we're actually going to use this to automate the bridge creation process eventually but for the time being i'm going to keep it off all right so let's talk about setting up a bridge network how it works and do it all manually then to automate it so we'll get rid of that perfect and let's start off by making a bridge device so this is kind of similar to what libvert was doing we need to start off by having a bridge interface and what we're going to do to do that is type in iplink add name br0 which is a pretty common convention you'll see out there for a bridge device and we're going to specify that the type is bridge so i'll go ahead and run sudo on that and next what we're going to do is make sure that the ethernet device is bound to the bridge so the key this is actually one of the key differences between libvert and this model we're going to make sure that the ethernet device is bound to the bridge such that this kind of virtual switch we're setting up with the bridge is taking part in the overall network it's seeing arp requests come from you know upstream and downstream hosts and all that good stuff so let's do a pseudo iplink we're going to set eno1 the ethernet device and specify that it should be bound to br zero all right so we've got the new bridge we've got the ethernet device bound to it now a couple more things that we now need to do so let's zoom out just a little bit here and we're going to do a quick ipa and let's there we go so we've got the bridge device it's down it doesn't have an ip associated we've got en01 and now you can see that it is bound to br0 with this line here now what we want to do is we want to give br0 an ip address something that it can be addressed at and start to respond to arp requests so that when someone says who has this ip it can respond so on and so forth now normally we would do this with some form of dhcp client but again we're doing everything manual first as painful as it might be it's a good it's a good learning tool so we're going to do ip address add and we're going to give it an arbitrary ip address that's in our network segment so i'm going to say 192 168 4716 totally random for this test case though do make sure you choose an ip that's not already being used and then we're going to say dev the device will be br0 and we're going to put in the broadcast address and if you're not super familiar with you know kind of like net masking and broadcast addresses you can look that up on wikipedia but suffice to say that we're going to put in 192168 make this just a tiny bit smaller 255 255 which is kind of another way of saying that we're going to accept broadcast requests inside of 192.168 with these bits any bit that could be here so we'll go ahead and pseudo add that in and now br0 should have an ip address and before we bring br0 and the ethernet device up let's check that real quick so we have got br0 it has an ip address right here which means it should be able to respond to arp requests on that level and obviously en01 is down and br 0 are still down so let's go ahead and bring those interfaces up it's pretty simple to do we're going to run an iplink set up en01 and then we're going to do the same thing for br0 and now these two interfaces should be up and able to receive arp requests and other in other words you know be seen and routed to in a way on the on the internal network so let's just check that out and it looks to me like br0 is up and en01 is up as well pretty good now what does this mean kind of where where are we at at this point okay so i can actually let's let's do this let's ssh into another host on my network this is not the same physical host it's going into actually a vm on a completely different physical host okay so we will go ahead and get in here and i will do a pseudo i to get into root okay and let's just set the ps1 real quick because this will drive me absolutely bonkers if i don't um oops i probably should do that huh okay cool so there we go all right so this this hash is that completely separate host now if we go back to my my my host here my hypervisor i've been working with we know that the ip address is 192.168.1.4.7 right let's go back to the other host and we're going to run a command called arp ping now if you've never used art ping check it out it's really awesome so it'll let you basically ping arp requests so that you can see what mac address gets returned if we do an art ping and specify that the interface it should go out of is eth0 on this host i happen to know the ethernet device is eth0 we'll hit enter and you can see it's pinging and actually getting a response back so basically it gets a unicast reply saying hey this mac address has this ip address and if we go back to our host here you can actually see this mac address 3a ending with 8d is the mac address that's we're seeing a response for right here so this host my my current hypervisor is resolvable from other hosts which is great now there is a detail that you might find interesting that's kind of important in understanding how all these pieces work together which is that on this host now while yes i can be addressed i can't actually go outbound to other hosts to something on the on the internet essentially and we can actually figure out why if we quickly look at the route table for this particular host you'll notice that it is definitely missing some stuff for example it does have the ability to route locally on the bridge interface but it doesn't have a default gateway setup it doesn't have a way to say oh if there's a packet outside of this that needs to kind of that isn't resolvable otherwise it needs to go through the default gateway so to solve that problem all we've got to do is once again bring up a really handy kind of core tool which is the route tool and we're going to say add default gateway and we need to know what our default gateway should be now in most of your home lab environments and you know server environments too it's probably some ip associated with the router in my case my default gateway is always 192.168.1.1 which is a super common gateway address and if i add this in we can now see that reflected in the route table so we know that we still got the local network coverage on the bridge interface but we also have a default gateway setup now again there's some tricks happening to replace that 192.168.11 with kind of a a record here for underscore gateway so don't get too thrown off by that this is essentially that same ip address that i put in up here and we can just make sure that things are good because if we do a ping for google.com now we're able to access the external internet all right so taking a breath for a second and thinking about all this stuff that was a lot of bits that was a lot of setup if you do check out the website i've got a diagram in the site that shows let me go up to it that shows all of these different pieces and points to how they relate so feel free to check that out but the reason that i want to go through what i just showed you is because now you kind of understand how all the pieces fit together and heck if you wanted to you could take those commands put them in a script and have them run on startup but realistically you're probably not going to do that i'm not going to do that i'm sure as hell not going to go in and run all those commands over and over and over again right what we need to do is have a good way to automate all these different pieces you just saw so before we even connect a vm in and i and i show you how to connect a vm into this new bridge interface and prove that it's routable to the large network before we even get there let's talk about automating what you just saw now depending on the distribution that you use you're going to see different opinions on how to automate this setup the one thing that i like is that most modern server distributions are going to leverage i guess it's not so close to my history as i thought they're going to leverage systemd network d this thing that i was talking a little bit about earlier so rather than doing something that's distro specific if we could configure systemd network d to instantiate the bridge bind the ethernet interface to it and call out to dhcp to give the bridge an ip address we've now created an entirely portable automation for instantiating bridge interfaces and that's exactly what i'm going to take you through right now so before i go any further let's go ahead this one's going to require some pretty much constant pseudo access so let's do this all right and then we're going to go ahead and cd into a folder which is etsy systemd network and i think i've already got files here oh no i don't i cleared them out good all right so this is the location where we're going to be putting the instructions for systemd network d to work now first thing that we're going to do is we're going to make a br.netdev device and what this is going to instruct systemd to do is how or i shouldn't say how but it's going to specify what new interface we want created this is a really simple one so we just say net device we give it a name which will just keep our br0 going we're going to do the kind equal to bridge and we're going to save this file up next we're going to set up the instructions to bind the ethernet interface into the bridge interface so if we do a new file i like to prefix this because it's lexographically uh evaluated so i'm going to do one br0 bind dot network and then inside of here whenever we operate on something in a network file we first need to match what devices it applies to in our case we're going to do eno1 because that's my ethernet interface now this does accept wild cards so if you wanted to do something like this you could totally do that but i'm going to keep it hyperspecific and then down here we're going to specify the network we want to bind this to in this case it's going to be the bridge network and it's going to be of course br 0. so this is our bind network instruction set now the interface gets stood up the ethernet interface gets bound what's the piece we're missing well in theory if our machine just turned on we might not have an ip address assigned and we want that to happen through dhcp so the next file we're going to create here is going to be 2-br0 dhcp dot network and in this one pretty similar format first we need to match to say which interface or interfaces this instruction set should apply to we're going to say br0 and then we're going to put in the network clause here and say that we want dhcp ipv4 so we're only concerned about ipv4 and this is how we're going to resolve our interface so let's go ahead and save that up now and now we've got all of these three instruction sets interface gets built ethernet gets bound to it dhcp gets called to give the bridge interface an ip address and those are all the things that we essentially did in that in those last couple steps where we were going kind of spot by spot and putting all these different pieces in so let me get out of sudo real quick we should do some cleanup before we do any testing so obviously i made a bunch of stuff i'm just gonna go ahead and start by doing a iplink delete br0 and we'll sudo that good okay and we will make the text a bit smaller again so we can check out our current interface model so ipa we've got en01 so it looks like eno 1 is good it's not bound to br 0 anymore but it is still up so let's go ahead and bring that back down to really replicate what a restart might look like so we'll do a pseudo link oops ip link set and it is eno1 down so we'll bring en01 down and now this should look like a freshly perfect a freshly started machine okay so normally to test this out i probably would have just restarted my computer but obviously i'm recording a video right now so that wouldn't go too well but we've got this set up it's like we just started up now with the systemd settings in place there's a couple things we typically do first thing is we'd probably run systemctl systemd network d and i think i've i've actually got it enabled already because it was on by surprise so by running this command we're telling our computer when you turn on run this thing which should pick up all the setting files we just specified now it's extra important if you're enabling systemd network d as i alluded to earlier you want to make sure there's not another network management daemon that's going to conflict with this one so if you're running network manager or something else do be advised they could fight over things and and mess up your configuration so we've got that in place that's all good and honestly the best way that i can kind of replicate a restart now is by just starting systemd network d so here's what we'll do we'll go ahead and in this window set up a start systemd network d so this is the command will essentially run and then in this window here we'll do a pseudo journal ctl and we're going to follow or tail the logs for the unit system d network d all right and we can see here let's just keep in mind timestamp wise right so 215912 is going to be the last time that we saw logs from systemd network d we'll come in here we'll hit start i'll put in my password go back to the logs and let's see if anything comes up here so interesting i would have expected something to pop up status system d network d interesting active interesting i wonder what is going on here the status is stuck in processing requests i wonder if it's screwed up because i uh because i stopped it halfway through let's see here so if i do a pseudo system ctl restart systemd network d there we go good deal so i don't know what i screwed up before maybe because like i was messing with stuff while it was still on or something i don't know but nonetheless the restart seemed to do the trick so you can see some of the key things that are happening here right and i'll try to maybe bring it up so i can make it a little bit bigger for you to see uh if you look right around here 220142 br0 was brought was created first off then the link got brought up the en01 link got brought up and you can see right here where the dhcp request went through so when we go and check our ip interface in a moment br 0 should have been assigned 192 168 to 79 and let's see if that's the case so we'll do a quick ipa and that is exactly what happened check it out br0 has 192 1682 79 eno1 has been bound to zero so with those three simple systemd network d configuration files we have fully automated in a distribution portable way how to instantiate bridge networks on our hypervisor pretty cool stuff so now that we've got this in play we're ready to start hooking up virtual machines and you know at this time let's maybe look at a quick graphic of it before we wire in a virtual machine and what the graphic looks like is essentially something like this wherein with our new bridge interface we now have the ethernet interface taking part in it v-net interfaces are still going to come up and are still going to be bound to the virtual machines but rather being isolated in kind of their own pseudo network here they're just going to go ahead and attach directly to the bridge interfaces so as traffic goes out it is going to be able to go through the switch this is a physical switch by the way the physical switch will be able to route through and up into other hosts and other hypervisors in fact when a virtual machine wants to say hey who has this ip address and it's from another virtual machine that arp request will make its way through and be able to respond with the mac address of these vms and if that's at all confusing i think the biggest thing to know now is from the network's perspective these virtual machines are going to look like any old physical host that's basically attached to the port another way to think about this is this one port is going to now see multiple mac addresses behind it and know that if it needs to route to that physical address it can just go through that particular port so let's spin up a virtual machine and see that happen so virtual machine let's see here we're going to do i wonder if i solve the file here no i don't so we're just going to make a new file here and we're going to call this vert.sh and we will make this executable as well chmod x and it will be vert.sh lovely and i'm actually going to copy this from the website so the script is in fact in my blog that accompanies this video so if you want to grab it from there please feel free i figure you don't want to watch me type all this out so we'll paste that in all right and if you saw my other lib video this command probably looks familiar vert install is just a really helpful utility to set up new virtual machines and we're going to call this the best test virtual machine i need to give it a slightly different name here for its ima it's file system disk path if you will and i'm going to set it up to use the ubuntu 1804 installation disk so this is all pretty standard libvert installation of a vert machine but this line is the important one rather than letting it use the default network we are going to specify that it should link its v-net interface remember the v-net interface is this process-bound tap interface into our bridge interface which is also uh which also has as a member eth0 so we go back here we're going to save this up and let's go ahead and run it so we'll do a vert dot sh this should open up a vert viewer just like that and we'll go ahead and make this a little bit easier to read here let's grab it all right and i won't be going through a full ubuntu install i promise but i'm just going to take you all through the part up to the point where it gets the dhcp lease so you all can see how that effectively works now while this is going you know a couple a couple things to note right if we just do a quick verse net list remember there is no libvert network in play here it's purely our local area network and the bridge interface that we set up another thing i'm going to show you as we make progress is my my home labs networking stack is using ubiquity gear so luckily i have a managed switch which can give me information about all the different things that it's got hooked into or knows about and that's exactly what i'm going to show you so this is my physical hardware switch in my home lab you can see it has a multitude of ports inside of here as well in fact i might just want to refresh it to be sure okay cool good good and i'm going to be able to show you some of these different pieces in fact the i have to make sure that you all can see this because my head might get in the way these are the ports on my physical switch and the ubuntu server right here is actually likely coming in this port here which is port two and tugboat should be my hypervisor so we'll talk we'll talk a little bit more about that in a second but let's just make sure we can see the dhcp piece so we'll do done all right here we go it's going to be a little small here but if you take a close look you can see 192 168 2 98 is the ip address that got assigned now this did not come from dns mask this time right this actually came from the uh my overall network gear so if we go back here and we look at ubuntu server check it out 192 168 9 or 298 this is the ip address you all just saw and you can also see the mac address here 5 2 c7 and then right here 5 2 c7 it's in kind of the darker text i know it might be a little bit harder to read in this view so my my uh my vm here has linkedin it's gone up it's used the dhcp server for my overall network and the switch actually knows about it and it knows to go through port number two to get to this mac address right and if we were to go back for just a moment and remind ourselves of what our bridge networks ip address was i know there's a lot of text here but this is br0 right and we know that this is 192.168.279. if we go back to the switch for a moment and we look at tugboat which i know is the name of my hypervisor check it out you've got 192 168 279 it's paired with the same mac address of my hypervisor and it's also going through port 2. so instead of port 2 only seeing my hypervisor mac address it sees the hypervisor and all of the virtual machines as well as if they were just you know as if the switch was plugged into a switch essentially you know it's a maybe a good way to think about it here so all of that set up it's linked together it's routable and one way that we can maybe kind of prove this out is as just a final step here so we now know and i won't even i won't even look at the new vm i stood up i'll just go right to my switch i'll see ubuntu server is this ip address right the dot 98 let's copy that ip now i'm going to ssh into that host we used a little bit earlier and once again do a pseudo once again do a ps because it'll drive me crazy all right now this is on a completely different piece of hardware here so we're gonna go ahead and ping this ip address which is the vm and we've got a response so from this host and let's let's even take a look real quick so if we do if we do a ipa here and we look at this host's mac ip address so 192.168.2.91 let's see if we can quickly find this in my router we're looking for dot 91.91 there it is this host right here is dot 91 so i'll go into it and you can see it's in port 3. it is a physically different host hooked into a physically different port yet it is absolutely able to ping do this one more time to ping the ip of the vm that's hooked into port 2. so in effect by hooking all this up and automating it and all this good stuff we have effectively succeeded at building out this model where there are two hypervisors linked into bridge devices now the other hypervisor there's some more intricate stuff going on than just this but suffice to say let's let's assume they're the same the packets are routing through the inner the switch and the overall network is seeing these as if they were individual machines and just like a home lab should all the hypervisors are now interroutable with their many machines within them and i think that's about it so you know hopefully you found this really interesting even if you have done some of this stuff maybe you kind of learned some new pieces about how x and y work i i think it's a really really cool setup it shows how with again like simple linux tools that are already there you can do really cool elegant stuff um you know not just for a home lab but you know in the real world as well and this is all again detailed on my blog if you found this video at all helpful if you found my blog post helpful you can follow me on twitter my handle's right there you could give this video a like or shoot me a comment and let me know what you liked what you didn't like i love y'all's feedback and i'm really like i mentioned the beginning of the video really looking forward to continuing building out more content with that have an awesome rest of your day and i'll catch you next time thanks
Info
Channel: octetz
Views: 21,183
Rating: undefined out of 5
Keywords: libvirt, networking, linux, kvm, qemu, bridge interface, network interface, linux networking, vm networking, vm networks
Id: 6435eNKpyYw
Channel Id: undefined
Length: 43min 38sec (2618 seconds)
Published: Sun Nov 15 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.