From the previous lectures we learned the basics of how networks work.
We learned that devices on the same network communicate with each other using packets.
So regardless of what you do on the network, whether you're watching a video,
whether you're logging into a website, sending chat messages, sending emails.
Regardless of what you're doing, all the data is sent as packets.
Now in the network, devices ensure that these packets go in the right direction using the MAC address.
So each packet has a source MAC and a destination MAC and it flows from the source to the destination.
So in this example, we have the client, it has this MAC, we have the access point,
which has this MAC and as an example if this client wanted to send a packet to the router,
it will set the destination MAC to the routers MAC address.
Therefore, by default each device only receives data
that has the destination MAC as its own MAC address.
But if you remember, I said in wireless networks,
if you are within range, then you'll be able to capture all of this communication
because these packets are literally sent in the air.
So we can just capture them, even if they do not have our MAC address as the destination MAC.
To do this, we need to change the mode of operation of our wireless interface,
so that it operates in monitor mode.
So let me show you what I mean.
If I go to 'my computer' here and run 'iwconfig' this time.
So we see 'ifconfig', which lists all the interfaces.
We can use 'iwconfig' to see the wireless interfaces only.
And you can see we have LAN 0 right here, which is my external wireless adapter.
And you can see the mode of this adapter is set to managed.
What this means is basically this is the default mode of all wireless devices
and what it means is, this device will only capture packets that has the destination MAC
as the MAC address of this device.
So basically it will only capture devices that are directed to my Kali machine.
But this is not what we want.
What we want is to be able to capture all the packets that are within our range.
Even if they are sent to the router and even if they are set to another device.
So to do this we need to set the mode to 'monitor mode' instead of 'managed mode'.
So, as usual before you can change the options of your interface, you have to disable it
and previously we've seen that we can do that by doing 'ifconfig',
the device name, which is LAN 0 in my case, down.
Then we can enable monitor mode, but before we do that, I'm actually going to run a command
to kill any process that could interfere with using my interface in monitor mode.
So the command that I'm going to run right now is not mandatory
but running it will actually give you better results when you come to running the attacks
that you will learn as we go in the course.
So this command is going to be 'airmon-ng check kill'.
Now you'll notice when you're on this command,
it will actually kill the network manager that usually runs in here.
So you'll completely lose your internet connection.
But this is no problem because we will only need to be in 'monitor mode'
when we are running preconnection attacks.
So attacks that do not require us to connect to any network.
So we actually do not need internet connection to run any of the attacks that require monitor mode.
Now we're going to enable monitor mode, so we're going to do 'iwconfig'
followed by the interface name that we want to enable monitor mode on, which is LAN 0.
We're going to say that I want to change the mode and I want to change that to monitor.
So very very simple command, we're using 'iwconfig' to change the mode.
We're given the name of the interface that we want to change its mode.
We're saying I want to change the mode and I want to set it to monitor mode.
Now if I had enter, you'll see the command will run with no errors
which means the command got executed properly and finally we'll need to enable the interface again.
Similar to what we did when we change the MAC address.
So we just have to do 'ifconfig LAN 0 up'.
That's done.
Now if I run 'iwconfig' again,
you will see that the mode is set to monitor now.
So basically this interface now can be used to capture any packet that is within our range.
Not only the packets that are directed to this computer.
That's why in the future you'll see how we can use it to sniff packets, to analyze them
and even break into networks.
So, in the future if I say use your interface in monitor mode, this is what I mean.
You'll basically have to enable monitor mode as shown in here.
Now I've also included a YouTube video in the resources of this lecture,
to show an alternative method to enable monitor mode.
Just in case you got errors with this method
or you try to follow something that I do in the next lectures and it didn't work.
Then you can come back and try the alternative method.
But if this worked and if monitor mode is enabled successfully, then you don't need to watch that video,
you can just continue with the course.
One more thing to keep in mind, not all wireless adapters support monitor mode.
So for this to work, you need to make sure that your actual adapter supports monitor mode.
There are a number of adapters that support that
and I've included another video again in the resources of me talking about wireless adapters.
How to pick the best one
and which ones that I recommend and use when I'm testing the security of networks.