2 hours 51 minutes
Hello. My name is Jasmine Jackson and our courses intro to vagrant. And in this video I will show you a demo on how to create port fording in our vacant machine. So let's get started.
The learning objectives for this video are we will learn how to create a network in vagrant using Port 40.
So let's start our demo.
Okay? We are in the vagrant foul. Remember, The vagrant file is the most important file A vagrant because it instructs vagrant the configuration of our machine are vagrant machine.
So as you can see, most of the text is in green, which means it is common it out.
So looking at lines 22 to 26 we see
information about port fording as well as on lines 28 through 31.
We also Seymour information about poor fording. So you may be wondering what's the difference between the two? Well, lives 20 to 26 is port forwarding for any I p.
we're specifying port fording our guests which is our vagrant machine in our host which is our host machine and on lines 28 through 31.
It's the same thing except where limiting r i p to local host.
And essentially, what this will do is it would disable public access. So remember, and our lecture where I discussed port fording, I mentioned that when you create port, fording that all of the interfaces are bound
to your port forwarding, meaning any device that is connected to your network
has access to report fording. So if you want to be more strict or more of restrictive, you will probably probably want to use lines 28 to 31 where you're specifying the port, Ford and toe only happen on your local host and make it more restrictive.
And honestly, that's what we're going to use for this example.
So I'm going to comment out this uncommon out this line, and I am going to keep guests as 80. But I'm going to change the host from 80 82 1234 So that way we can make sure and see that
you know, it's ah, host that we have to find,
and I'm going to say the vagrant file and I'm going to go back to Commander. We're going to enter the command vagrant up,
and as you can see we have a new four port of 80 to 1234 And that's what we modified inside the vagrant file.
Our vagrant machine is ready. So now we're going to answer http 1 27.0 dot 0.11234
And our forward port worked. And the reason how we know our Ford Port work is because the website has rendered our boom boom to Apache. Http. Default page.
So remember, in less than four where I discussed secure show and
we also installed our Apache. Http server and I show that once you installed this server, there's a default page to let you know that the installation was successful. So this is the page.
So I know that our port fording is successful because, as I mentioned,
my host machine is a window 64 machine and I do not have Apache installed on my machine. Apache is only installed on my vagrant machine, which is unbuttoning machine on boot to trustee 64. So I know my port forging works
poured 80 on my vagrant machine. The traffic is being rerouted to pour 1234 on my host machine on the local host. So I know that my port fording works.
So to recap first we opened the vaguer foul it remember The vacant file is the most important violin vagrant because it specifies the configuration of your vagrant machine. There are two types two blocks of port forwarding and vagrant. The first, the first block
specifies port fording
that allows public access. We did not want to do this because we didn't want our Port Ford and to be open to the world. That's essentially what this block would do.
Instead, we use Block
28 to 31 here where we were more restrictive and we only wanted our public. We excuse me, we only wanted our port foraging for the local host 1 27.0 dot 0.1. And that
disables public access and allows us to b'more restrictive
with our port 40. So we ian commented outlines 31 we changed the host I p from 80 82 1234
port that we picked that we would know that Okay, the vagrant foul picked up our configuration because we specified the port for our host.
Next we went to commander and we started our vagrant machine.
Then we went to our host machine and we typed in the I p address of 1 27.0 dot 0.1 port 1234 which we specified in the vagrant foul and
our port forwarding work. Because our own boo to Apache. Http Server
Defar page rendered. And as I said before, I do not have first I'm not using on Abou to machine on my host machine. I'm using windows. Second of all, I don't have Apache installed on my host machine. Apache is only installed on my vagrant machine,
which isn't a boon to machine Mobutu Trustee 64. So I know that our port forwarding
worked. So now let's go back to our lesson So and summary in this video we learned how to create a network in vagrant using port fording. In our next video, we will have a demo on how to create a public network and vagrant
So I can't wait to see you in that video. Have a good day