Overview:
- IP is the address, has the location function (Network and network communication) (NET layer)
- MAC is ID, no positioning function (working on subnet) (link layer)
The first is how to view the IP address problem:
Window:ipconfig
Linux:ifconfig, IP addr
#contents of IP addr under Linux[Email protected]:~#IP Addr1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536Qdisc noqueue State UNKNOWN Group default link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00inet127.0.0.1/8Scope host lo valid_lft forever Preferred_lft Forever Inet6::1/128Scope host Valid_lft forever Preferred_lft forever2:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc pfifo_fast State up group default Qlen 1000 link/ether fa:16:3e:c7:79:75 brd ff:ff:ff:ff:ff:ff #MAC address inet 10.100.122.2/24 BRD 10.100.122.255 scope Global eth0 #10.100.122.2 is an IP addressValid_lft Forever Preferred_lft Forever inet6 fe80::f816:3eff:fec7:7975/64 scope link Valid_lft forever preferred_lft for Ever
When communicating using the TCP/IP protocol family, there are three key identifying information: MAC address, IP address, and port number.
- IP Address:(based on the computer or router) in the IP header of the network layer, used to identify the network interconnection of the host and router, in fact, mainly to confirm the subnet, through the subnet mask to confirm the subnet of an IP address, and then confirm the MAC address inside the subnet to find the correct user.
- MAC Address:(based on a network card or router) wrapped in the Ethernet header at the data link layer, it is used primarily to identify different computers in the same link. MAC address is the network card number, each NIC factory, there is a world-wide unique MAC address, the length is 48 bits, usually in 12 hexadecimal digits.
- Port number: is included in the TCP/UDP header in the transport layer to identify the application. If you can run multiple programs on a single host, which program is the received message? You need a port number to confirm it.
- There are two types of port numbers:
-
- Fixed port number, which is a fixed port number used by applications that are widely used in form such as Http,telnet,ftp
- Dynamically assigned port number, this time the server to determine the listening port number, the client receiving service does not need to determine the port number
The port number is determined by the Transport layer protocol, so the non-transport protocol can use the same port number, so TCP and UDP can use the same port number
Problem: Now many tools can change the MAC address of the machine, that is, there are many MAC addresses on the network are changed to the same, but there is no communication anomaly or confusion why?
Answer: Mac in a LAN conflict will affect network communication, LAN is located outside the IP location, so different LAN network equipment MAC is no communication problems.
Study Notes Reference:
The essential difference between IP address and MAC address
MAC address, IP address, and port number
Understanding IP addresses and MAC addresses