So guys next, we will going to discuss the mac addresses
So, what are actually mac addresses and what are they used for and what is the format of mac address? that's all
We will going to discuss in this slide
So within a subnet data transmission across machines or between machines is done using only
mac addresses
so note this point that whenever the communicating machines belong to the same subnet, the data delivery is
Done using only mac addresses. The ip address do not play any role in data delivery
Whenever the communicating machines belong to the same subnet
So thus, data link layer operates with mac addresses only. so remember that whenever the communicating machines
Present in the same subnet
only the data
Link layer of the tcp/ip stack is responsible for data delivery from the source machine to destination machine and
Only mac addresses are used for this data delivery
ip addresses
Hardly play any role in L2 routing
Ip addresses are not used for data delivery between communicating machines
which are present in the same subnet and
That is a reason that mac addresses are also called layer 3 addresses and mac
Addresses is used by the data link layer
Whereas ip addresses are also called layer 3 addresses and ip addresses is used by the network layer
For routing the data between machines present in different subnets
So now the question arises that, who actually has mac addresses?
Who assigns the mac addresses and how can we configure mac addresses and how, does the mac address looks like?
So let us discuss all these nuances of mac addresses
now
Every interface through which a device is connected has a mac address. so so far, we have learned that
Interfaces has ip address and mask value configured on that in addition to the ip address, and mask value the interfaces are also
Configured with the mac address
So you can see in this diagram that each interface of a device has a mac address
So interface A of device A has a mac address MA
similarly you have the mac address MB, MC and MD
So these, MA, MB, MC and MD are only the symbolic representation of mac address just for convenience
How the mac address looks like? the mac address looks like something like this. I will show You shortly the actual mac addresses
By using some linux command
So who assigns the mac address? the mac address is assigned by the device manufacturer
right so you cannot configure or change the mac addresses of a device
because the mac address is
Assigned by the device manufacturer only that is at the time when the device is being manufactured
The device manufacturer assigns the mac addresses
To the device so
You can see suppose
The device A is a printer and
This printer has an interface if A so the
company which is manufacturing this printer can assigns the mac address let's say this to the printer A and
This mac addresses is burnt
note the word this mac addresses is burnt inside the hardware and
You cannot change it during
for the entire lifetime of our device
So mac address is also
Globally unique. it is burnt in the hardware and you cannot change it. you
Don't have any control on the mac addresses.
so
Mac addresses are come on the interface so if the device has n number of interface, it
Means that the device has n number of mac addresses
So you can, check the mac address an ip address of your vm router using if config command
So you can try the if config command and this command shows
You the mac address and ip address configured on all the interfaces of your linux machine
So let me show you a simple demonstration
So let's say this is your linux virtual machine just
type out the command if config
And it will show you all the
Interfaces which are present on your linux machine and
Against each interface it shows
The mac address
So mac address is listed here and it is also called hardware address
Or the mac address is also called the physical address
Whereas ip address is also shown here, which is configured on this interface and
ip addresses is also called the logical addresses and
With every ip address, we have a mask value so you can see the mask value is configured here
right so
You can, see that each of these interface is configured with the mac address
Of Course, we can change these mac addresses
Here because at the end of the day
These interfaces are simulated by our virtualbox software, which allows you to configure the mac addresses also
But on an actual physical machine or on an actual physical router which have real
interfaces or
network interface cards
These hardware addresses are burnt inside the interface cards and you cannot change it
So let us discuss the representation of mac address. so mac address is a six byte number
So and a byte is also called as octet
So you can see that the mac address, is six octet number
It has six octets means 48 bits
right
So the representation of the mac address in the hexadecimal format is as follows
Just convert each octet
Of the mac address to the equivalent hexadecimal number and what you will get is the hexadecimal representation of the
mac address and
To convert the mac address into its equivalent
Binary format just convert each octet of the mac address
into its binary equivalent and
What you will get is the binary representation of the mac address.
So remember that the mac addresses are 48 bits addresses
Now, let's discuss next the ip addresses and the subnet mask
So every interface through, which a device is connected has an ip address and a subnet mask also that is
besides mac address every interface also has an ip address and a subnet mask value configure on it
But unlike mac addresses, ip address
And mask address configured on the interface is configurable and you can change it as per your wish
For each interface
You have to configure an ip address, and mask value so if a
Device has n interface then you can configure n ip addresses also and
Again, you can check the mac address and ip address
configured on various interface of your machine using if config command
So you can say in this example
So you can see in this example
Every interface of a device whether the devices are router or the device is a host machine
Every interface is configured with the mac address and
the ip address and
of course the interfaces has name
right
So the mac address need not follow any particular pattern, it can be any random number
As per assigned by the device manufacturer but the ip addresses that you configure
must follow certain rules
and
What are those rules? the rules are that all the machines, which are supposed to be present in the same subnet
Must be configured with the ip address such that all of those ip address
Gives you the same subnet id or same
network id.
right
So mac address could be any random number it need, not follow any particular pattern
But the ip address on the other hand has to be configured, by the administrator and they have to be configured
Systematically as per some scheme
So let us discuss the representation of ip addresses so ip addresses are 32-bit addresses
Which is also four byte addresses or
four octets
right
So let us take an example of an ip address. let's say the ip address is 60.166.56.227
So the decimal representation of the ip address is very simple
Just represent each octet separately in decimal notation
In decimal notation
So this is the decimal representation of an ip address
And if you convert each octet of an ip address into its hexadecimal equivalent
Then you will get the hexadecimal representation of ip address
So you can see that the decimal number that so you can see that the second octet that is 166 has been converted
From its decimal notation to hexadecimal notation which is A6
Right! so this is how You convert the ip address into from one form into another
Similarly, the fourth octet of this ip address that is 2 2 7 has been converted into its equivalent hexadecimal value
So as a result finally you get the hexadecimal representation of ip address
Similarly, in order to obtain the binary representation of an ip address just
Convert each octet of an ip address
Into its binary equivalent
independently and
What you will get is the
Binary representation of ip address. so remember that the length of the ip address is 32 bits