|
At the link layer of the OSI stack, IEEE standard 802.3 specifies communication over Ethernet links. Each device on the network has a unique Media Access Control (MAC) address, which is used to direct Ethernet packets. An Ethernet packet consists of a 1 byte preamble followed by the Ethernet header, encapsulated data, and checksum. The last three items are collectively referred to as an Ethernet frame. Popular types are as follows: 0x0800 Internet Protocol version 4 (IPv4) 0x0806 Address Resolution Protocol (ARP) |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |[ Destination MAC Address (6 bytes) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ]|[ | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source MAC Address (6 bytes) ]| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type/Length of Data |[ | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Client Data + padding (46-1500 bytes) | | .... ]| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CRC Checksum (4 bytes) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
ARP is used to resolve the physical address of the host with a known Internet
address (RFC 826). The ARP
packet format allows for its use over any type of hardware (e.g. Ethernet or
Token Ring) and any protocol (e.g. IP or BGP).
|
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hardware Type | Protocol Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HW Add Length | Prtcl Add Len | Opcode | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |[ Sender Hardware Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ]|[ Sender Protocol Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sender Protocol Address ]|[ | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |[ Target Hardware Address ]| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |[ Target Protocol Address ]| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
IPv4 implements Internet addressing and fragmentation (RFC 791). The IP header contains
important data such as source and destination addresses, protocol type, and time
to live.
|
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |R D M| Fragment Offset | | |S F F| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
A network consists of two or more computing devices and a certain form of electronic media (e.g. copper wire, radio frequency) through which the computers are able to communicate.
Each device on the network is uniquely identifiable by a 32-bit number, called an IP address. IP addresses are commonly represented in a dotted-quad format, where each byte of the address is converted to decimal and separated by a dot. Example:
00000001 00000010 00000011 000001002 = 1.2.3.4 in dotted-quad format
The IP addresses of each device on the same network are related to the specific network they share. If one were to compare the binary representation of all IP addresses on one network, one would see that several sequential bits in each address are identical. Those common bits define the unique identitier for the network , or network address.
111...11000..00
ifconfig for Linux or ipconfig for
Windows.
Try it out below to see your host's network address by entering your IP address and subnet mask.
1's in the subnet
mask.
For example, the CIDR IP address 131.122.88.0/22 refers to the network address 131.122.88.0 with a subnet mask 255.255.252.0.
The bits not common to any of the IP addresses
on a network are what makes each IP address unique. To calculate
the total number of unique addresses for a given network, take the
number 0's in the subnet mask and raise 2 to that
power. The result gives the total possible number of IP addresses
for a network, but not all of those IP addresses may be used by
hosts.
1's.
|
ICMP provides error messaging for the Internet
protocol. It is a necessary protocol for IP to function
because it provides feedback of communication problems (RFC 792 /
RFC 2463).
Some of the different types of ICMP messages are as follows:
|
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Message Body + | | |
|
UDP provides connectionless communication, making no guarantee of data delivery (RFC 768).
|
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
TCP is a transport-layer protocol on the OSI stack.
|
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Acknowledgment Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Data | |U|A|P|R|S|F| | | Offset| Reserved |R|C|S|S|Y|I| Window | | | |G|K|H|T|N|N| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | Urgent Pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
00| 52 54 00 12 35 00 08 00 08| 27 f3 5c ca 08 00 45 00 16| 00 22 0d 0d 40 00 40 11 24| d5 65 c0 a8 ac 06 c0 a8 32| 2b 01 94 a4 09 29 00 0e 40| 58 78 68 61 70 70 79 0a - Use the hex notation for MAC adddress. - Use the decimal (base 10) notation for all the other numbers. |
dst MAC addr = src MAC addr = type = IPv4 version = 4 ihl = IP packet length = (in total) protocol = (choose from TCP/UDP/ICMP) src IP = ___ . ___ . ___ . ___ dst IP = ___ . ___ . ___ . ___ src port = dst port = msg = b" " (in English) |
wireshark &

ping -c 1 localhost
nslookup www.google.com 127.0.0.1
nc -lnv 8000Now, in a separate terminal execute the following:
nc localhost 8000Once executed, you may now type stuff and hit enter to send that data to the netcat listener. Type something and hit enter (you should see it pop up on the other terminal).
