10. IPv4 Addressing

OSI MODEL - NETWORK LAYER (Layer 3) • Provides connectivity between end hosts on DIFFERENT networks (ie: outside of the LAN) • Provides logical addressing (IP addresses) • Provides path selection between SOURCE and DESTINATION •

ROUTERS operate at LAYER 3.

SWITCHES (Layer 2 Devices) do no separate different networks. They connect and EXPAND networks within the same LAN. By adding a ROUTER, however, between two SWITCHES, you create a SPLIT in the network; each with it's own network IP address. Example: 192.168.1.0/24 (255.255.255.0) 192.168.2.0/24 (255.255.255.0)

Administratively down is the DEFAULT status of Cisco Router interfaces. Cisco Switch interfaces are NOT administratively down by DEFAULT.

HALF DUPLEX: • Device cannot send / receive data at the same time. If it is receiving a frame, it must wait before sending a frame. FULL DUPLEX: • Device CAN send / receive data at the same time. It does NOT have to wait.

—-————————————-————

ROUTERS have unique IP Addresses for EACH of their interface connections, depending on their location.

The IP Address depends on network address of the LAN it connects to.

The NETWORK portion of given IP Address will be the same for all HOSTS on a given LAN.

When a BROADCAST message hits a ROUTER, it does NOT continue onward. It stays within the LOCAL LAN (Switch/Hosts).

-         A series of 32 bits (IPv4 address)

For Example: 192.168.1.254/24 can also be written as 11000000.10101000.00000001.11111110 (where each binary value represents a decimal number )

-        /24: The first 24 bits represent the network portion of the address and the

-        254: represent the host portion of the address.

-        192.168.1 - Network portion.  While,   .254 – The host

IPv4 Address

The class of an IPv4 is determined by the FIRST OCTET (8 bits) of the address.

CLASS | FIRST OCTET | FIRST OCTET NUMBERIC RANGE

  • A | 0xxxxxxx | 0-126 + 127 'loopback' (      Class A numeric range however stops at 126 b/c 127 is reserved for loopback addresses.)

    NB: 127.0.0.0 to 127.255.255.255 are used to test the network. Used to test the 'Network stack' (OSI & TCP/IP model) on the local device. For instance a PC pinged 127.0.0.1. The ping responds back to its own range. Just sending messages to and from itself.

  • B | 10xxxxxx | 128-191

  • C | 110xxxxx | 192-223

  • D | 1110xxxx | 224-239 (multicast address)

  • E | 1111xxxx | 240-255 (reserved (experimental) address)

-        NB: the network address cannot be assigned to the host address.

-        Class A: fewer possible network addresses. However the host portion is very long, there can be many hosts on the network.

-        Class C: many possible network addresses but the host portion is smaller so fewer hosts on the network.

Rule of thumb: the larger the network portion, the fewer the hosts.

A NETMASK is written like a Dotted Decimal IP Address

Class x: prefix length (/n) = netmask

CLASS A: /8 = 255.0.0.0

CLASS B: / 16 = 255.255.0.0

CLASS C: /24 = 255.255.255.0

If the HOST PORTION of an IP ADDRESS is ALL 0's, it means it is the NETWORK ADDRESS = the Identifier of the network itself.

Example: 192.168.1.0/24 = THIS is a NETWORK ADDRESS. Because the host portion is zero or 00000000.

A NETWORK ADDRESS cannot be assigned to a HOST. A NETWORK ADDRESS is the FIRST ADDRESS.

If the HOST PORTION of an IP ADDRESS is ALL 1's, it means it is the BROADCAST ADDRESS for the network.

A BROADCAST ADDRESS cannot be assigned to a HOST.

DESTINATION IP : 192.168.1.255 (Broadcast IP address) that’s because .255 is 11111111 in binary.

DESTINATION MAC : FFFF.FFFF.FFFF (Broadcast MAC address).

Because of the two 'reserved' addresses, the range of USABLE HOST ADDRESSES is 1 to 254. (Of which one usually .254 is assigned to the router. Last address of the network)

-        The broadcast address is the layer 3 address used to send a packet to all hosts on the local network.

The formula for calculating the number of HOSTS on a network is:

2 ^ N - 2 (2 to the power of N - 2) where N = number of HOST bits. I.e

Class C

Host portion = 8 bits = 2^8 = 256

HOWEVER, since the Network Address (Network ID)

192.168.1.0 is Reserved

AND

192.168.1.255 (BROADCAST ADDRESS) is ALSO reserved.

The MAXIMUM Hosts per Network = 2^8-2 = 254 hosts

What about a Class B Network ?

172.16.0.0/16 ----> 172.16.255.255/16

Host portion = 16 bits = 2^16 = 65,536

Maximum hosts per network = 2^16-2 = 65,534 hosts

What about a Class A Network ?

10.0.0.0/8 -------------> 10.255.255.255/8

Host portion = 24 bits = 2^24 = 16,777,216

Maximum hosts per network = 2^24-2 = 16,777,214 hosts

FIRST / LAST USABLE ADDRESSES

Class C Network

192.168.1.0/24 (NETWORK ADDRESS)

Add 1 so the Host Portion = 00000001

192.168.1.1/24 = FIRST USABLE ADDRESS

192.168.1.255/24 (BROADCAST ADDRESS)

Subtract 1 from the BROADCAST ADDRESS = 11111110

192.168.1.254/24 = LAST USABLE ADDRESS

Class B Network

172.16.0.0/16 (NETWORK ADDRESS)

Add 1 to Host portion so 00000000 00000001

172.16.0.1/16 is the FIRST USABLE ADDRESS

172.16.255.255/16 (BROADCAST ADDRESS)

Subtract 1 to Broadcast Address so 11111111 11111110

172.16.255.254/16 is the LAST USABLE ADDRESS

Class A Network

10.0.0.0/8 (NETWORK ADDRESS)

Add 1 to Host portion so 00000000 00000000 00000001

10.0.0.1/8 is the FIRST USABLE ADDRESS

10.255.255.255/8 (BROADCAST ADDRESS)

Subtract 1 to Broadcast Address so 11111111 11111111 11111110

10.255.255.254/16 is the LAST USABLE ADDRESS

—-———————————————

CISCO CLI DEVICE CONFIGURATION

R1> enable (enters privileged exec mode from user exec mode)

R1# show ip interface brief (in privileged exec mode)

Lists the Interfaces, IP Addresses, Method, Status, and Protocol.

Interfaces:

• What port interfaces are available/connected

IP Addresses

• Self explanatory. What IP Address is assigned.

Method

• What method was the IP address assigned?

Status (Layer 1 Status)

• Current status of interface

• 'administratively down' = Interface has been disabled with the 'shutdown' command

Administratively down is the DEFAULT status of Cisco Router interfaces.

Cisco Switch interfaces are NOT administratively down by DEFAULT.

Protocol (Layer 2 Status)

• Cannot operate if Status (Layer 1) is downI

Administratively Down: This status indicates that an interface on a Cisco router or switch has been manually disabled using the 'shutdown' command in the device's command-line interface (CLI).

  • Default Status: On Cisco routers, interfaces start in this state until activated by the 'no shutdown' command.

  • Implications: When an interface is administratively down, it will not process or transmit any data. The status can be checked using commands like show ip interface brief, which lists all interfaces along with their operational states.

R1(config)# interface gigabitethernet 0/0 (or written in short as ‘in g0/0’): this enters configuration mode for port gigabitethernet0/0

R1(config-if)#ip address 10.255.255.254 255.0.0.0: This sets the IP ADDRESS and SUBNET MASK of the device connected to g0/0 interface. (The ip is 10.255.255.254/8)

R1(config-if) #no shutdown/no shut : cancels the default status of the Cisco router

R1(config-if)# description description.