-: When it comes to networking, 2 2
you've probably heard of the term MAC address a lot. 3 3
So in this lecture, 4 4
I'm gonna cover what do we mean by MAC address, 5 5
what it's used for, and how to change it. 6 6
(dramatic music) 7 7
(loud banging) 8 8
MAC address stands for Media Access Control, 9 9
it's a permanent, physical, and unique address 10 10
assigned to network interfaces 11 11
by the device manufacturer. 12 12
So whether you have a wireless card, 13 13
or a wired, or Ethernet card, 14 14
each one of these network cards 15 15
come with a specific address that is unique to this card. 16 16
So there is no two devices in the world 17 17
that would have the same MAC address. 18 18
And this address will always be the same 19 19
to this specific device, 20 20
even if you unplug it from your computer, 21 21
connect it to another computer, 22 22
then this network device will always have the same address. 23 23
So you might already know that the IP address 24 24
is used in the internet to identify computers, 25 25
and communicate between devices on the internet. 26 26
The MAC address is used within the network 27 27
to identify devices and transfer data between devices. 28 28
So each piece of data or packet 29 29
that is sent within the network 30 30
contains a source MAC and a destination MAC. 31 31
Therefore, this packet would flow 32 32
from the source MAC to the destination MAC. 33 33
So because this is a physical unique address 34 34
to each interface, to each network device, 35 35
and because it is used to identify devices, 36 36
then changing it will make you anonymous on the network. 37 37
Not only that, but the MAC address is often used 38 38
by filters to prevent or allow devices 39 39
to connect to networks, 40 40
and do specific tasks on the network. 41 41
So being able to change your MAC address 42 42
to another device's MAC address 43 43
will allow you to impersonate this device 44 44
and allow you to do things 45 45
that you might not be able to do. 46 46
So you'd be able to bypass filters, 47 47
or connect to networks that only specific devices 48 48
with specific MAC addresses can connect to, 49 49
and you will also be able to hide your identity. 50 50
Now changing the MAC address is very, very simple, 51 51
so let me show you how to do that. 52 52
First of all, I'm going to use the ifconfig command 53 53
to list all the network interfaces 54 54
available on my Kali machine. 55 55
What I mean by network interface is any device 56 56
that allow us to connect to a network. 57 57
So an example is a Wi-Fi card, 58 58
or an Ethernet card, and so on. 59 59
So you can see first of all we have eth0, 60 60
and this is a virtual interface created by virtual box 61 61
when we set Kali to use iNet network. 62 62
So you can see the interface name is eth0, 63 63
you can see it has an IP address because like I said, 64 64
it's connected to a network. 65 65
So if we go here, we can see it saying Wired Connected. 66 66
So this is the interface that represents the wired network 67 67
that Kali is connected to, 68 68
which is actually a virtual NAT network. 69 69
You can also see the netmask, the broadcast, 70 70
and a really important piece of information, 71 71
which is the ether. 72 72
This is the MAC address of this virtual interface. 73 73
Now, you can see similar information 74 74
for my other two interfaces, the lo and the lan0. 75 75
The only thing is you can see for both of these interfaces, 76 76
we do not have an IP address. 77 77
And the main reason for that 78 78
is because none of these interfaces 79 79
is connected to a network. 80 80
Now lo is the default interface created by Linux, 81 81
and lan0 is my real wireless adapter, 82 82
so I can use it to connect to Wi-Fi networks. 83 83
But if I go on the network in here, 84 84
you'll see Wi-Fi is not connected, 85 85
because I actually didn't connect to any network, 86 86
and that's why it does not have an IP address. 87 87
Now, this doesn't matter because what we want to do 88 88
is to just change the MAC address, 89 89
which again, is shown here under the ether part, 90 90
so similar to what you're seeing here for eth0. 91 91
Now, in order to change any of the values 92 92
that you see in here, 93 93
you have to first disable the interface. 94 94
So in this example, we want to change the MAC address, 95 95
so that is represented by the ether 96 96
and the value is right here. 97 97
So in order to disable an interface, 98 98
we're gonna do ifconfig followed by the interface name, 99 99
which is lan0 in my example, followed by down to disable it. 100 100
Now, if I hit Enter, you'll see 101 101
the command runs with no errors, 102 102
so it means that it got executed properly. 103 103
And the next thing that we need to do, 104 104
is to change the option that we want to change. 105 105
And in this example, we want to change the ether, 106 106
which is the MAC address. 107 107
So first, we're gonna type ifconfig, 108 108
we're gonna type the interface that we want to change, 109 109
one of its options, then we're gonna type 110 110
the option that we want to change. 111 111
And what we want to change is the hardware address, 112 112
so we're gonna do hw ether. 113 113
Then we're gonna give it the address 114 114
that we want to change the MAC address to. 115 115
So for example, I'm gonna use 00:11:22:33:44:55. 116 116
Very, very simple command, 117 117
we're doing ifconfig lan0 to select the interface 118 118
that we want to change its option, 119 119
we wanna set the hardware address, 120 120
and we wanna set this address to this specific address. 121 121
So you can use any address that you want, 122 122
following the same format shown here. 123 123
Just make sure your address starts with 00. 124 124
So I'm gonna hit Enter and again, 125 125
we don't see any error messages, 126 126
so it means the command got executed properly. 127 127
And finally, we just need to enable the interface 128 128
because we disabled it, by doing, ifconfig lan0 down, 129 129
so we just need to do, ifconfig lan0 up, to enable it. 130 130
Now the interface is enabled, 131 131
and if we do ifconfig again, 132 132
and look at the ether part in here, 133 133
you can see that it is changed 134 134
to the MAC address that we specified. 135 135
Now, this is done, and your MAC address has changed. 136 136
Now, you can go ahead and start using the interface 137 137
and it'll appear to have this MAC address 138 138
instead of its original MAC address. 139 139
And like I said, this can be useful in so many scenarios. 140 140
Now, keep in mind, the MAC address will revert back 141 141
to the original one once you restart the computer, 142 142
because we're only changing the MAC address in memory, 143 143
we're not really changing the physical MAC address. 144 144
But if your MAC address is resetting 145 145
to the original one without restarting, 146 146
then something is going wrong. 147 147
And it's probably happening because your network manager 148 148
is resetting the MAC address. 149 149
Not everybody will face this issue, 150 150
so I'm not gonna cover it in this lecture, 151 151
but if you face this issue, 152 152
if your MAC address goes back to the original one 153 153
without restarting the computer, 154 154
then check out the YouTube video 155 155
in the resources of this lecture, 156 156
it'll show you how to fix this issue.