Linux Containers (LXC) Networking Deep Dive - Video 001 - Getting Started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and good evening and welcome to this video tutorial which is going to be the first in a series of video tutorials on Linux containers so we're gonna take a look at one of the most popular virtualization technologies in the market today which is where we can go ahead and install a basic Linux workstation or a Linux server and then use Linux containers to spin up multiple instances of Linux on the same platform and we can do it in really a matter of seconds and we're really gonna focus and take a deep dive into the networking configuration of Linux containers because that's one of the most common areas of not just confusion but of of difficulty for individuals who are trying to set up Linux containers and we're going to talk about the use cases we're gonna look at the default Linux networking setup for containers which is a based off DHCP DNS mask and it uses a 1003 subnet we're gonna take a deep dive into that we're gonna look at Mac VLANs we're gonna look at all of the different interface types including none empty physical the ethernet the VLAN interface type and then the Mac VLAN and we're gonna look at both private and the virtual Ethernet port aggregator setup for Mac VLAN so this first video is literally gonna walk you through all of the steps required to download a boon - I'm gonna use a boon - because canonical has done an amazing job basically putting everything you need right in the palm of your hands to create not only in a boon to release but Linux containers and so we're gonna go ahead and do that in this video we're gonna go all the way up to the point where we install Linux containers and then that point I'm gonna go ahead and stop that video and the second video in this series is going to pick up with the installation how you go about configuring Linux containers how you can customize the Linux containers when you're when you're building them we're gonna look at the default networking type which is just the v ethan of the virtual Ethernet interfaces and we're gonna spin up a series of containers there alright so I'm here at a boon to comm and I'm just simply gonna grab the abou to desktop release and so I would come down here at download desktop and it's gonna take me over to a page where we're gonna be prompted I'm not sure if this is a donation page or not here okay so you can download 1404 dot 2 which is gonna be the long-term support release and that's what that LTS means now this is Ubuntu 1504 and so this is sort of the latest and greatest release and so all of my videos we're gonna be leveraging 1504 the only time I use 1404 is when I'm talking about the the the D bootstrap where the images are being cached after you create the image the first time and then we make our way down the file system down to user share LXE and we look at the different versions that are there that have been cached for us and we'll see why we can after we build our first container we can turn containers out extremely quick because a lot of the template informations already cached for us so I'll go ahead and on this one let's just do 1404 dot 2 and here's a screen where you can certainly make a donation we're just using these for demonstration purposes here so I'm gonna zero these out all right and we're gonna say download i've already pre-staged i've already downloaded things and i already have some VMS fired up so we're not actually gonna have to sit through the vm creation process so that's it it says thank you for downloading you can see the little image swung off the screen for Safari there and right here it is now downloading my 1404 dot to desktop alright so let me go ahead and let's get rid of that so I'm gonna go ahead and drop the browser down because at this point we're done with the browser we're gonna assume we've already completed our download let me go ahead and I'm gonna pull up vmware so i'm on an iMac here and i'm you could do this with VMware Workstation you can do with ESXi ESX I'm just using VMware fusion and so I've actually got what I believe is the latest and greatest version which is fusion 7.1.2 right and so how do you build a boot to virtual machine I'm simply gonna come up here and say file new and I'm gonna be doing this as install from disk or image well we just downloaded the 1404 image and you can see I've cranked out some virtual machines here with 1504 so I'm just gonna say use another disk or a disk image and this should bring up a screen with my finder and I've actually got a number of virtual machines running in the background here so it could be that's why it's taking some time so let's see we're gonna go to the date modified and actually on our documents is where we put it and see let's go under size will list it so there it is right there so there's the abouttwo 1404 - desktop image so I'm just gonna say continue and now this is one of the we'll talk about a lot of the differences this is where you would put in your the username you would want I'm gonna say my passwords just ABC 1 2 3 and let's go ahead and make that home folder accessible on my Mac to the virtual machine now this is one of the significant differences here between Linux containers and VMware and it's a key differentiator so when I'm creating this virtual machine in VMware I'm actually emulating all of the hardware required to run the software so as you can see here hard disk memory networking devices so in VMware you're emulating all of these hardware components with Linux containers you're not so the container uses the same kernel that's running on your boon to build in our case I'll just continue to refer to it as a boot - because that's what we're using so again so it's very lightweight right and you'll see when we start spending up Linux containers how quickly we can create a Linux container how lightweight the container is because it's actually just running on the same platform that we're running a boom - now I'm not gonna customize any settings here we'll just take the defaults and I'll click finish it's gonna ask me where you want to put it so we'll just put it there in the vault area and again we're not gonna have to watch this build I'll let this kick off and then I'm gonna icon I Conniff I it so let's go ahead and drop this down and so this is what you would see is VMware is then going to go ahead and start to build you're a boon to 14.04 dot - desktop image so I'm gonna go ahead and I Conniff I that and I'm gonna pull up the boon to zero zero two so at this point right this is the screen that you're gonna see when everything is done here's that display name that you saw earlier and as you can see this is 1504 here so I'm gonna go ahead and get logged in will just say abc123 now one of the changes that I make on my virtual machines is under the settings area and the network adapter again you can see here this is very telling look at all of the hardware components that this is emulating keyboard mouse processor display sound cards all of these hardware components are being emulated by VMware and every VM that I spin up has to do this exact same thing and again very different from Linux containers so I'm gonna come into network adapters here and again this is on the VMware side I believe it defaults out to share with my Mac and I always change it to auto detect and the reason I do this is because I want this VM this virtual machine that I've created in VMware this a boon to desktop image to be seen on my local area network as its own mutually exclusive server right or in this case a desktop but I want it to be a mutually exclusive device on my network so that it's going to receive its own IP address right so that is the only change that I'm gonna be making here in VMware on this setup and if I were to say if config - a you'll see that the Ethernet interface that's assigned to my abouttwo virtual machine is eth0 and when we start to create Linux containers this is going to become important we're gonna see this a lot right the eth0 you can see here that I simply have a one ninety two dot one sixty eight dot one address it's a slash twenty four and this is in my DHCP scope range here 115 and so it's simply pulling the address via DHCP and one of the ways that you can can see that is if we take a look at the Etsy network interfaces file now this file is the main interface configuration file for a boon to and what do we have in here right now I only have the definition here for the loopback interface which means that a boon to is going to go out onto the network and via DHCP it's going to receive an address right so as soon as I made it a standalone node it's going to query it's gonna look for a DHCP address and this is the DHCP address that it was assigned from my DHCP server which in this case is just simply the firewall that I have on my network in a quick note so how did I get this window up the terminal window so if you click here it'll allow you to search through if I just type in terminal or ter right I'm just simply using a terminal window and so I click on that you can see it's gonna open up a new window here so I will go ahead and I Conniff I that alright so this is it's kind of interesting here so for Christopher Nolan fans out there right inception so I've got a iMac on which I'm running VMware fusion and I've created you know the iMac is the host and the Ubuntu desktop release here is the guest and so what I'm gonna do now is we're gonna sort of talk about it and we're gonna take one more layer down right so it's kind of like a dream within a dream within a dream and so the abouttwo desktop guest is actually going to be sort of the aboon to desktop it's gonna become the host for all of my Linux containers right so the next question is how do I install Linux containers right or the software that I need for Linux containers if I were to type app ho and LX c and the apropos command is a command that will search the manual pages for the string I give it which is LXC in this case and any man page that contains anything about Ella has the string l XC would be returned so for example if I were to say apropos up a lot of commands as you can see a ton of commands that have up in the name and again it doesn't have to be at the start of the name if you look down here you can see the hang up at the end right and again and it can be in the description as well okay as long as it's part of the man pages you can see here supplicant so up so if there were any LXE commands or if lxc were installed on to this desktop i would have seen a list of all of the man page and basically the help files for lxc so let's clear our screen here and at this point we're gonna go ahead and we're gonna install I'm gonna say apt-get and the first thing I'm going to do is I usually run update right because I want to make sure I've got the latest and greatest version whoops with the password in here abc123 and so what it would do now is it would go out and it's going to connect to the abouttwo archive to perform this update so I'm gonna pull back up this other a boon to window that we have is other terminal window and let's see when I type netstat and we'll pipe it two more let's see what connections we have at this point so you can see here that they list this address up here this one sorry this ipv6 address 2001 67 charlie and that's where we're going right and we've got some HTTP requests going on to economy two dot canonical right economy dot canonical about HTTP or HTTPS re and then we've got this connection here says connecting to security a boon to comm right so we can see we've got connections going out right and they're connecting out to canonical who is really the company behind a boon - and what this would do is this is going to update my apt-get to make sure that my database is refreshed and up to date all right so I'm gonna let that do its thing in the background and now we're gonna run the command to go ahead and install Linux containers and this is one of the huge advantages one of the really nice things about the aboon 2 releases is that once I install the LXE package I've got everything I need in order to create Linux containers so I'm just simply gonna say sudo and apt-get install lxc and that's the only command that you need to run in order to install Linux containers and so it goes out and it looks at the distro for me right at queries one of the mirrors and it's gonna say you got twenty two point three megabytes of information I must say yes I obviously want it and now this is gonna go out and connect to the archive as well so again I'm not gonna make you sit in wait what will happen is this is gonna finish up it's gonna get everything installed that it needs and it's gonna go ahead and finish up and then we would have Alexi installed and the same thing with our update so I'm gonna i canta phi Ubu zero zero two let's pull up boo-boo zero zero one right so let's get logged in here ABC one two three and as you can see right I'm reached retrieving some packages here and actually we'll let that one sit this guy in the background here because he's still pulling some packages down so we want to step two we'll go to zero zero three here we'll say ABC one two three Brian and C R so here is a virtual machine and the only reason I'm switching is because I don't want you to have to wait or I don't have to pause the video waiting for things to be downloaded so booboo zero zero three the state of this virtual machine is that it has just had the LXE package installed so let's take a look at that apropos command again right and this is a very helpful command so if I say apropos LX see here is a listing of all of the Linux container commands that are on the system and these are all of the commands that we're actually gonna be using here to create the containers and again that sudo apt-get install lxc that's the only command that you need to run in order to install all of the software that you need to create Linux containers alright so to wrap up this first video it's gonna be a great stopping point and what we're gonna do right now is I'm simply going to go ahead and issue a command and we're gonna create just a default with no options really a default Linux container and so the command to do that would be sudo lxc create and I'm gonna say - and dash n is going to be the name of my container right now one of the other great things about the Linux containers is that I can actually pick from different different Linux distributions so if I wanted to do CentOS if I wanted to do Debian I can choose to spin up Linux containers with those Linux OSS and that's another significant differentiator when we're talking about Linux containers is that if what I'm trying to emulate if I wanted to do a Windows virtual machine or any non Linux distribution you can't do it with Linux containers so that's one of the limitations of Linux containers is that it has to be a Linux release right and so if you're gonna do you know if you wanted to do Windows 2012 or Windows XP or you know whatever the case may be that would be one of the use cases to go with sort of another mu another virtualization technology you know VMware something along those lines because with Linux containers you can only emulate other Linux releases and in fact if we were to take a look here and I believe actually before we run this command to see a list of the different Linux releases that we have I want to say it's user share alexei and is it templates yes so here we go so these are the different UNIX releases that I can create Linux containers for if I wanted to do alpine linux all linux art arch linux busybox cent OS c rose debian again gen to fedora oracle play mo SS sshd a boon to a boo to cloud openSUSE right so you've got a ton of choices here and as we move through on the networking component I'm actually gonna be using CentOS I'm going to be using fedora I'm going to be using a boon to debian and creating containers with with those releases so let's step back here so I'll say sudo and lxc create because that's the command that we would use to create our Linux container I'm gonna say - in so I'm gonna give it a name so let's create an Ubuntu container and this is gonna be just a virtual Ethernet right because when we come back in the second video we're gonna be taking a deep dive into how the DHCP works how you can look at the different DHCP settings that are being configured and provided to you by the Linux container bridge interface right you know what your default gateway is how your resolving your dns how you could set a static IP if you wanted to right so and we simply just give it a name and that's gonna be the name of my container and then that's where I say - T is gonna be the template and you'll notice that these are all proceeded with lxc - you don't actually have to put the LXE - I could just simply say a boon - and I'm gonna hit enter off with my password in alright now this is interesting here you see how it says checking cache download in var cache LXE vivid route FS amd64 so what it's checking for here is it's checking to see have I created any previous Linux containers from the abouttwo template and that's you can tell that from this word right here vivid because this is release 1504 and the code name and abouttwo has a very funny way of doing their code names the code name is vivid verb vervet I hope I'm pronouncing it for vet or vervet right and I yes I did actually have to look that up and that is just simply it's a monkey that I guess is native to South the African continent so this is vivid vervet if you were to drop back a release - 14 dot 10 it was called Utah utopic unicorn and then prior to that the vert the release that we created our virtual machine with and downloaded which was the 1404 that was trusty tar ta HR and I have not looked that up but I do not know what a tar is I'm assuming it's some kind of an animal and you heard the release right there actually a little drumbeat letting us know that our 1404 right so our trusty tar build that we were working on is done right and so this is where I kind of moved into the the first virtual machine window but again you can see how quickly that's spun up and I've got maybe six or seven virtual machines running here so it happens rather quick right so now I've got another VMware machine that's running 1404 which is the long term support release so we'll go ahead and Icona phi that and so here we are and i've actually now just spun up my first Linux container and so let's go ahead and take a look at one last command and it's gonna be sudo LX c - LS and I'm just gonna hit enter here and that's gonna list out the Linux container which I've created on this Linux desktop virtual machine now you can also tack on at the end here fancy and I actually prefer that output cuz it gives you a little more information and when we start when we start to spin these virtual machines up you're gonna see why the fancy the fancy option is such a popular option and if you wanted to see other options you could use you could look at the man pages right so if I were to say man LX c - LS here's the man page and it's gonna list out for me all of the options that are available and give me some examples of which options I can use typically further toward the bottom so here you go so here's the - F or the - - fancy now one of the questions I get asked a lot is what's the difference why do they have - F and then - - fancy format how come there are two different ways right to signify the options that you would like and this is a little historical trivia and basically it started out with the single characters right so - f - capital F - G however you've only got 26 - you know whatever it is that you want to use right the alphabet A through Z and so those run out rather quickly especially when you're dealing with utilities like LS or tar where you've just got tons and tons of options that you could use and so the ganoub project sort of actually began using the the - - and then a word to actually describe what it is you're trying to use so this is sort of the old-school non canoe format and that is the canoe format right so here's a list and so you can see here we've got some examples so list active containers and display the list in one column so you could say L XC - LS - - active - one and then here's the command that we ran and this is the one that I really like and again you'll see why once we start firing those virtual machines up and a quick note Stephanie and I hope I'm saying this I think it's graver Stephanie Graber is really she is the the tip of the spear in terms of Linux container development so she is really sort of one of the main individuals working and driving the Linux container project and if you were to and you can see here her email address is here so she works at canonical or out of boone - and she actually has a blog if you were to google her name and look for her blog she's got a blog up with it just an amazing amount of phenomenal information on Linux containers okay so we know the command to create sort of a basic Linux container we know how to list out the containers that we've created we've looked at building you know basically going from scratch right hitting the abouttwo homepage downloading one of the abouttwo Desktop releases firing up a VMware virtual machine with a boon to installing the Linux container software and really again just a single command to do that if you want to do the apt-get update you certainly can and just make sure that all your all your databases are up to date before you download the software so then you download the software and then we've created our first virtual machine so I'm gonna stop my video here and video number two in this series is going to pick up and pick up right from here and in fact on this very same screen and I'm gonna spin up a series of virtual machines that are simply going to use the default configuration and we're gonna take a look and again very deep dive into how the IP addresses are handed out how it's doing the DNS resolution can the containers talk to each other can the containers talk to hosts on my land segment and so we're gonna get into all of that alright I appreciate you watching and hopefully I'll see you for video number two
Info
Channel: Travis Bonfigli
Views: 28,788
Rating: undefined out of 5
Keywords: Linux Containers, LXC, lxc-ls, lxc-create, lxc-ls --fancy, Docker, Rocket, Ubuntu, Vivid Vervet, Utopic Unicorn, Tursty Tahr, macvlan, virtual Ethernet Port Aggregator, vepa, veth, lxcbr0, sudo apt-get install lxc
Id: 2EwFkOrZ7I8
Channel Id: undefined
Length: 28min 20sec (1700 seconds)
Published: Fri Jul 10 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.