tcp/ip layers
- Physical Layer
- Data Link Layer (MAC) = ppp framing ,ethernet IEEE 802.2 framing
- Network/Internet Layer(IP) = ip,icmp,arp
- Transport Layer(TCP/UDP)
- Application Layer = http/s, ntp, ssh
OSI layers
- physical layer
- Data link layer : media access control (MAC) and logical link control (LLC).
- Network layer
- Transport layer
- Session layer
- Presentation layer
- Application layer
https://learn.microsoft.com/en-us/windows-hardware/drivers/network/windows-network-architecture-and-the-osi-model
ipv4 address length = 32 bit
ipv6 length = 128 bit
mac address length = 48 bit
example
c:> ipconfig /all
Physical Address(mac). . . . . . . . . : B6-97-B1-6E-AB-B1
DHCP Server(ipv4) . . . . . . . . . . . : 192.168.1.254
IPv6 Address. . . . . . . . . . . : 2400:1a00:bd20:7939::3(Preferred)
IPv6 Address. . . . . . . . . . . : 2400:1a00:bd20:7939:3436:ce31:2aa:1607(Preferred)
port length = 16-bit integer,
Well known Ports 0 – 1023
Registered Ports 1024 – 49151
Ephemeral Ports 49152 – 65535
assined by iana , On Unix-like operating systems, a process must execute with superuser privileges to be able to bind a network socket to an IP address using one of the well-known ports. On most systems, registered ports can be used without superuser privileges.
c:> netstat -a
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
browse using ipv6
[2001:4860:0:2001::68]/
dns
nslookup google.coom
Server: vip6-safenet-kmd01.wlink.com.np
Address:
2400:1a00:0:32::165
Non-authoritative answer:
Name: google.com
Addresses:
2404:6800:4002:82f::200e
142.250.193.46
ARP stands for Address Resolution Protocol.
It is used to convert an IP address to its corresponding physical address(i.e., MAC Address).
ARP is used by the Data Link Layer to identify the MAC address of the Receiver’s machine.
RARP stands for Reverse Address Resolution Protocol.
As
the name suggests, it provides the IP address of the device given a
physical address as input. But RARP has become obsolete since the time
DHCP has come into the picture.
classful addressing
- Class A
- Class B
- Class C
- Class D
- Class E
Classes D and E are reserved for multicast and experimental purposes respectively.
IPv4 address is divided into two parts:
- Network ID (NID)
- Host ID (HID)
IP addresses are globally managed by Internet Assigned Numbers Authority(IANA) and regional Internet registries(RIR).
Class A
IP address belonging to class A are assigned to the networks that contain a large number of hosts.
NID=8bit HID=24
The higher order bit of the first octet in class A is always set to 0
The default subnet mask for class A is 255.x.x.x
2^7-2= 126 network ID(Here 2 address is subtracted because 0.0.0.0 and 127.x.y.z are special address. )
2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x
Class B
IP address belonging to class B are assigned to the networks that ranges from medium-sized to large-sized networks.
NID=16bit HID=16
The higher order bits of the first octet of IP addresses of class B are always set to 10
The default sub-net mask for class B is 255.255.x.x.
2^14 = 16384 network address
2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.
Class C
IP address belonging to class C are assigned to small-sized networks.
NID=24bit HID=8
The higher order bits of the first octet of IP addresses of class C are always set to 110.
The default sub-net mask for class C is 255.255.255.x.
2^21 = 2097152 network address
2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.
class D
The higher order bits of the first octet of IP addresses belonging to class D are always set to 1110
The remaining bits are for the address that interested hosts recognize
IP addresses belonging to class D ranges from 224.0.0.0 – 239.255.255.255
class E
The higher order bits of first octet of class E are always set to 1111
IP addresses of class E ranges from 240.0.0.0 – 255.255.255.254
special ip range
169.254.0.0 – 169.254.0.16 : Link local addresses
127.0.0.0 – 127.0.0.8 : Loop-back addresses
0.0.0.0 – 0.0.0.8 : used to communicate within the current network.
host id rules
all 0 host ID is used to represent the network ID of the IP address
all 1 host ID is reserved as a broadcast address to send packets to all the hosts present on that particular network.
the host ID must be unique to the network
network id rules
The network ID cannot start with 127 because 127 belongs to class A address and is reserved for internal loop-back functions.
all 1 is reserved for IP broadcast address
all 0 denote a specific host on the local network and are not routed
summary
src:
https://en.wikipedia.org/wiki/Classful_network
ipv4 header
VERSION: Version of the IP protocol (4 bits), which is 4 for IPv4
HLEN: IP header length (4 bits), which is the number of 32 bit words in the header. The minimum value for this field is 5 and the maximum is 15.
Type of service: Low Delay, High Throughput, Reliability (8 bits)
Total Length: Length of header + Data (16 bits), which has a minimum value 20 bytes and the maximum is 65,535 bytes.
Identification: Unique Packet Id for identifying the group of fragments of a single IP datagram (16 bits)
Flags: 3 flags of 1 bit each : reserved bit (must be zero), do not fragment flag, more fragments flag (same order)
Fragment Offset: Represents the number of Data Bytes ahead of the particular fragment in the particular Datagram. Specified in terms of number of 8 bytes, which has the maximum value of 65,528 bytes.
Time to live: Datagram’s lifetime (8 bits), It prevents the datagram to loop through the network by restricting the number of Hops taken by a Packet before delivering to the Destination.
Protocol: Name of the protocol to which the data is to be passed (8 bits)
Header Checksum: 16 bits header checksum for checking errors in the datagram header
Source IP address: 32 bits IP address of the sender
Destination IP address: 32 bits IP address of the receiver
Option: Optional information such as source route, record route. Used by the Network administrator to check whether a path is working or not.
Comments
Post a Comment