Configuring a Private/Public Network and Forwarding Ports in Vagrant
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
Hello. My name is Jasmine Jackson in our courses intro to Vagrant and in this lesson, we will learn about networking in vagrant Less Begin
00:11
The learning objectives for this video are we will learn how to create networks, a vagrant using the following
00:19
port forwarding public networks and private networks.
00:25
So before we start with port fording, we need to learn the history of port 40.
00:32
According to tech OPD, a poor fording is a networking technique which transmits all incoming communications or traffic of a specific port to a port on an internal network. So you may be thinking, OK, jasmine, that sounds great. It's a lot of words.
00:51
Can you break you down? I can.
00:54
So Port fording is where you can specify traffic
01:00
going from one port to another
01:03
example. So let's say I have a virtual machine and I want all of my traffic on Port 80 to be rerouted or re transmitted to port
01:19
2222 on my host machine. That is an example of Port 40 so a common feature of poor fording is connecting the Internet to an eternal land
01:34
port. Fording is used for segregating network traffic and optimizing networks speed and other names for port fording our port mapping tunnelling or punched through.
01:47
So how does Port Ford
01:49
Port fording Excuse me? Work and vagrant.
01:53
So port forwarding
01:56
allows sharing from the vagrant machine using a specific port to our host machine using another port. So going back to our example
02:08
on my vagrant machine, I can have poured 80
02:13
Go to poor to 2 to 4 on my host machine That is an example of port 40
02:23
to enable your newly created network using port fording we use the command vagrant Reload
02:31
So a caveat were using port fording Most providers by default have the four report bound to all interfaces. So what that means is that any device on that network will have access to your forward ports.
02:51
I will show you in the demo for port fording how we can
02:57
be more restrictive
02:59
with this caveat. But be mindful of this caveat when you're using port 40
03:06
so by default the protocol used is TCP
03:12
transmission
03:13
control protocol. But you can change the protocol to UDP or Universal Data Grand Protocol.
03:23
So TCP and UDP are outside of this course that's outside the scope of this course,
03:30
and for that you would need to take an intro to networking course to figure out what those two
03:38
protocols are. I can't say that for TCP. You can think of it as a telephone where the sender and receiver has a dedicated line, and the reason you would need a dedicated line is because the information that's transported back and forth
03:55
means to go in a specific sequence.
03:59
When you're on the phone and the conversation is out of sequence, it was sound like garbage or gibberish You won't be able to understand.
04:09
You can think of UDP as text messaging, so we're text messages. There's no guarantee that the messages will come in order. There's no guarantee you don't have a dedicated line with text messaging. Text messages can come.
04:29
An order of text messages could come out of order. If the service is down,
04:35
then the text messages won't go through. So there's no
04:41
confirmation of delivery with UDP.
04:45
But again, TCP and UDP are outside of this scores. But I just wanted to give you a small, very small primer on TCP and UDP, but if you want to learn more, you have to take a networking course.
05:00
Public networks in Vagrant.
05:02
So this is where it gets tricky. So according to Hash Corp and remember from Lecture one, the history of Vagrant Hash Corp is the company that does full time development with vagrant.
05:15
The definition of a public network is that
05:18
it's less private than a private network. So you might be thinking, Okay, well, that's obvious.
05:27
And you may be thinking, Well, why is it defined this way? And it's defined this way because different providers have different definitions for what a public network is. So again, according to hash court private Excuse me, a public network
05:45
is the network that's less private than a private network,
05:48
and it's not unlike, well,
05:49
okay, that's intuitively that makes sense.
05:55
So
05:56
the best way to configure a public network is to use D HCP dynamic host configuration protocol. And again, this is just like what TCP A UDP would d HCP if you want to know the inner workings again. This is
06:14
networking cores. You need to take a networking course, but to just give you a small primer de HCP. How it works is when you start your machine, the machine will automatically assign I p address to your machine. So this is done dynamically.
06:32
Hence dynamic and deviates
06:35
CP.
06:36
So when you start
06:39
the machine, the machine will give you an I p address. And when you shut down that machine and you restart the machine that you would get a new i p address. So it's dynamic
06:53
and a way to figure out how to find your I P address is using the vagrant Ssh. So creating a secure show
07:03
into your vagrant machine and then entering the command i f config in Lennox or I p config and windows
07:14
also no. With public networks, you can configure your i p using aesthetic I meaning that the I p would not change.
07:24
Be careful, because if your I p changes suddenly the your public network would not be accessible.
07:32
Next we have private networks.
07:35
So again, just like with public networks were private networks. You could use d HCP dynamic host configuration protocol where, uh, I P address is dynamically assigned and again you will use the same steps as with the public
07:54
network. Once you have your I p,
07:57
then you will create a secure shell using the vagrant ssh Command and then using the I f config command if its limits or I peek i p config command. Scuse me if his windows
08:11
to figure out your i p address Now again, with private networks, you can assign a static I fi.
08:20
But caveat
08:22
What? Whether you use d HCP or you use a static I p. You need to make sure your I p is not publicly route herbal.
08:33
If it is rideable, then anyone can access this network and it will not be private.
08:41
Also for static are peas for both public and private.
08:46
You can use I p Internet Protocol version for or Internet protocol version six and again, just like with TCP UDP d h c p I P I P version for an i p version six.
09:03
Again, If you want to learn the nuts and bolts, you will need to take networking quarters.
09:09
But to give you a quick primer.
09:11
The Internet currently is using I P version for
09:16
for I P addresses, but we're moving toe I p version six because we're running out of I P addresses in the version for
09:28
standard. So we need to move to version six to give us mawr I p addresses Quick quiz.
09:37
What are the different ways you could configure a network? A publicly be privately see using port fording d all of the above.
09:48
I would give you a couple of seconds and I will come back with my answer. Let's start now. And the answer is that the, uh
10:00
d all of the above
10:01
we can configure a network using public networks, private networks or with Port 40.
10:13
So it's summary. In this video we discuss port 40
10:18
public networks and private networks.
10:20
Now we have an end of lecture quiz
10:24
question.
10:26
What are the different ways you could configure a public network A. D a C P B static eyepiece, sea shell scripts or D A. M B.
10:37
I will give you a couple of seconds and I will come back with my answer. Let's start now.
10:45
And the answer is that, uh,
10:50
d a m b
10:52
remember, we can use d HCP dynamic host configuration protocol where r. I P s are dynamically assigned when we start our machine, or we can use static I P's where r I P is fixed and it will not change a caveat of that is
11:11
make sure that the I P doesn't change, because if it does, then your network would not be accessible. Sea Shell scripts don't relate to networking. It actually relates to our next lecture on provisioning. So that's out
11:30
and the answer is D A and B.
11:33
So I hope that you have learned a lot in this lecture with port forging public private Networks
11:41
and our next three videos. I will show you DIMOs on the topics we discussed port fording public networks and private networks. And then our next lecture, I give you a quick introduction with this question. We will talk about provisioning
12:01
and
12:01
how it relates to vagrant, how we can create in line scripts, which are basically scripts that print to the consul and external scripts, where we can install software and with provisioning. It's
12:18
automated and repeatable, which means we can create the script once and executed as many times as we want, which is powerful, and you will see that in the demos for that lecture. So, as I said, I hope you learned a lot
12:35
in this lecture, and I can't wait to see you in the demos for
12:39
Port fording public networks, it private networks in in our next lecture that talks about provisioning in vagrant
12:48
Thank you. Have a good day. Bye.
Up Next
Similar Content