Hello. My name is Jasmine Jackson In our courses intro to Vagrant. And in this lesson, I will show you a demo on how to create a private network in vagrant. So let's go. The learning objectives for this video are we will learn how to create a private network in vagrant.
So let's start with our demo.
We have our vagrant file open.
And remember, the vagrant foul is the most important foul in vagrant as it specifies the configuration for your vagrant machine.
So, as you can see, most of the text is green, which means it is commented out.
We're going to go to Lines 33 through 35 which specifies a private network.
We're going to uncommon lying 35
and remember, for a private network, we can configure it in two ways. The first way is using D HCP dynamic host configuration Protocol where when you start your vagrant machine, the I P address is automatically assigned
and the second way is we can use aesthetic i P where if we have ah one i p and we know that's not going to change, we can use aesthetic I p and specify that
and we can use that I p to access our private network and our demo We're going to go with option one of using d HCP and the way we do that is we specify the following we type
Now, remember, in our last demo, we created a public network
which is online 40. And remember when we uncommon it out that line? We didn't add the type d HCP to that line because
by specifying the network as public network and not adding aesthetic i p it implicitly tales vagrant that we're going to use d HCP. But with private networks, we don't have that option. And we have to
explicitly state were using d HCP which we did here
unless save our foul. And now we're going to go back to commander
if I could type vagrant up.
And as you can see here for our network interface, we have host Onley, which specifies that where we have a private network. So, so far, so good,
we're gonna wait for our vagrant machine to finish booting,
And now we're going to create a secure show and we're going to do that by typing vagrant. Ssh!
And we're going a type I f config. Now, this is a Linux command because our vagrant machine is, um is on own boom to trustee 64 machine. If we were using a Windows machine that the command will be i p config, we're gonna press enter.
And as you can see, here we have a each one. We have an I p. Address of more 72. 28 That 1 28.3 And I know this is our
private I pee because I pee that start with 1 72 28 are private eye peas.
So we're going to copy
this I p o k. Factor in. So let it.
Now, we're gonna go to the internet and see if we can access our private network. Okay, Now we're gonna answer, http, followed by
Colon four slash four slash and our private i p. And we're going to press answer
and our private network worked. And the reason how I know it worked is because we're currently seeing that Mobutu
Apache. Http, default page once again, as I specified in my port forwarding and my public network demos I am using a Window 64 machine on my host machine, and I don't have a patchy
installed on my host machine. Apache is only installed on my vagrant machine, which is unbuttoning machine boo to Trustee 64. So I know that our private network works because I put in our private I P. And I'm
getting the boot to default page The page has rendered.
Apache and lecture for where we talked about secure show in a stalling software. And so once we installed Apache
and we went to the Apache folder and there was an index that HTML file. And this page that's currently rendering is that index dot html file. When you install Apache, that foul is automatically created because
it lets you know that your installation was successful.
So we know that our private network works because I used the private I p that was generated
Hear from our vagrant foul because we specify de HDP again. D HCP is dynamic host configuration protocol, and how that works is when we did vagrant up
our favorite machine had an I p that was generated on America regenerated, and we were able to prove that
after once we did the vagrant up, we saw ah host Onley network interface that let us know that our private network was created.
successfully started, we entered the vagrant s s H command to create a secure show. Then we entered the I F Convict Command again. This is on a on a boon to machine
we had an easy one for Ethernet one and we had I p address of 1 72 died 28 That 1 28 died three and again I know that this is a private I p. Because I p's that start with 1 72 died 28
our private eye peas.
we entered the I P into a Web browser and our bamboo to Apache default page render successfully so that let us know again that our private network was configured properly. So let's return to the lecture.
So in summary in this video
we learned how to create a private network in vagrant. And in our next video, I will talk about provisioning and that's where we can create in line scripts which basically prints text to the consul.
Or we could create external scripts where
we can have vagrants, execute commands and provisioning is good because it is automated, it repeatable. So I can't wait to discuss that in our next lecture and have a good day. Bye.