Time
2 hours 51 minutes
Difficulty
Beginner
CEU/CPE
3

Video Transcription

00:00
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.
00:19
So let's start with our demo.
00:21
Okay?
00:22
We have our vagrant file open.
00:26
And remember, the vagrant foul is the most important foul in vagrant as it specifies the configuration for your vagrant machine.
00:35
So, as you can see, most of the text is green, which means it is commented out.
00:42
We're going to go to Lines 33 through 35 which specifies a private network.
00:49
We're going to uncommon lying 35
00:53
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
01:11
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
01:26
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
01:41
comma
01:44
type
01:45
Colon
01:47
de HCP.
01:51
Now, remember, in our last demo, we created a public network
01:56
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
02:07
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
02:23
explicitly state were using d HCP which we did here
02:30
unless save our foul. And now we're going to go back to commander
02:34
and type vagrant
02:37
if I could type vagrant up.
02:52
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,
03:10
we're gonna wait for our vagrant machine to finish booting,
03:20
okay,
03:21
And now we're going to create a secure show and we're going to do that by typing vagrant. Ssh!
03:36
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.
03:54
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
04:08
private I pee because I pee that start with 1 72 28 are private eye peas.
04:15
So we're going to copy
04:18
this I p o k. Factor in. So let it.
04:28
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
04:39
Colon four slash four slash and our private i p. And we're going to press answer
04:47
and our private network worked. And the reason how I know it worked is because we're currently seeing that Mobutu
04:59
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
05:15
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
05:33
getting the boot to default page The page has rendered.
05:38
And remember,
05:40
we installed
05:43
Apache and lecture for where we talked about secure show in a stalling software. And so once we installed Apache
05:54
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
06:12
it lets you know that your installation was successful.
06:15
So we know that our private network works because I used the private I p that was generated
06:28
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
06:41
our favorite machine had an I p that was generated on America regenerated, and we were able to prove that
06:50
after once we did the vagrant up, we saw ah host Onley network interface that let us know that our private network was created.
07:04
Finally,
07:06
when our machine
07:10
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
07:25
and from there
07:27
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
07:46
our private eye peas.
07:47
Next
07:48
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.
08:07
So in summary in this video
08:11
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.
08:28
Or we could create external scripts where
08:33
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.

Up Next

Introduction to Vagrant

In this introductory Vagrant training, students will learn Vagrant’s core concepts, how to configure the virtualization tool, and how it will benefit their organizations. Upon completion of the course, students will have a foundational understanding of Vagrant.

Instructed By

Instructor Profile Image
Jasmine Jackson
Application Security Engineer
Instructor