IP Addresses Flashcards
What is an IP address
A 32 bit long binary number globally unique to each device
How was an IP address made to be user friendly
It was split into 4 8 bit chunks with each octet being converted into denary
The 4 values are then written with a dot between them; referred to as dotted decimal notation
What are the initial bits of the IP address referred to as
The network id
The initial bits are the same for all devices (hosts) on a particular network.
What are the remaining bits in the IP address referred to as
The host id
Used to identify a particular host in that network
What does a router do when it sees an IP packet
Examines the network part of address to identify best path forward for the packet
What happens to an IP packet when it arrived at its destination network
Host bits are examined to ensure its sent to correct device on the network
What must be true on any network or subnet
Network id must be identical for all hosts
Host id must be different
Number of bits allocated to network id is specified by subnet mask
How is a subnet mask written
Contains 1s in the position of network id and 0s in position of host id
Examples of how subnet masks are written
11111111 11111111 00000000 00000000 OR 255.255.0.0
This means the first 16 bits are the network id
255.192.0.0 means the first 10 bits are network id
What is a newer notation of writing a subnet mask
Used a slash and number of bits appended to actual address
E.g. 172.16.200.12/12 means the first 12 bits are the network id
What addresses are reserved on any given network
An address with host bits of all 0’s and of all 1’s
What does it mean if the host bits are set to all 0s
The address refers to the network itself
Routers use network address to direct packets to a given network
What does it mean for the host bits are all 1s
Means its the broadcast address
Needed to send messages to all the devices in a given network
How can you calculate the maximum number of hosts on any network
2^n - 2 where n is the number of host bits
Relationship between length of network id and length of host id
The greater the length of the network id, the shorter the length of the host id, so a lower number of max hosts can be on a network
E.g.
network id = 24 bits host id = 8 bits
2^8 - 2 = 254
Network id = 12 bits host id = 20 bits
2^20 - 2 = 1,048,574
What is IPv4
The IP version which uses 32-bit address structure and has been used for over 4 decades
What is IPv6
A newer IP version that allows for a greater amount of addresses
There are 3.4x10^38 possible addresses compared to 4.3x10^9 possible addresses with IPv4
Why was IPv6 developed
We were running out of unique addresses so more needed to be made
How are IPv6 addresses written
Written as 32 hex digits in blocks of 4
E.g.
2001:0db8:0000:0042:0000:8a2e:0370:7334
Structure of IPv6
Similar to IPv4, initial bits specify network and following specify the host
What do IPv6 and IPv4 offer together
As both systems can be ran parallel, offers a number of improvements with security
What needs to happen for networks to operate efficiently
Devices need to be able to determine quickly whether data is to be transmitted to another device on same network or device on a different network
What is a subnet mask used for
‘Masks out’ host bits of IP address and reveals network to which the device belongs
How is ‘ masking out’ performed
Carried out by AND operation on IP address and subnet mask
Example of bitwise AND result of IP address and subnet mask
IP address: 198.35.16.11
Subnet mask 255.255.255.0
10000110 00100011 00010000 00001011
11111111 11111111 11111111 00000000
10000110 00100011 00010000 00000000
198.35.16.0
How is the result of a bitwise AND used
Used to determine if the destination address is on the same or different network
Use the senders subnet mask on both IP addresses, if results are identical then they’re on the same network if not then they’re on different networks
How to identify the network id and host id using subnet mask
Subnet mask 255.255.255.0
IP address 198.35.16.11
11111111 11111111 11111111 00000000
<———NETWORK BITS———><—HOST->
10000110 00100011 00010000 00001011
1s correspond to network part of address
0s correspond to host part of address
What happens to a message when address is not on same network
Message is sent to network’s default gateway. Typically a router that connects local network to internet
Why was subnetting created
- Network collisions occurred, resulting in messages being resent
- bandwidth became congested
- security issue as shared bandwidth means all network traffic passes every device
What is a subnet
Subdivisions of a network that are treated logically as separate networks
What are subnets connected by
Routers
What is subnetting
Further subdividing the number of available host IDs that they have between individual networks
What does subnetting accomplish
- reduces broadcast domain, improving security
- reduces data collisions
What IP address ranges are considered private(non-routable)
- 10.0.0.1 - 10.255.255.255
- 172.16.0.1 - 172.31.255.255
- 192.168.0.1 - 192.168.255.255
Where are non-routable IP’s reserved for use
Within LANs or private WANs
Reduces need for every computer to have its own unique public address
Purpose of NAT
To allow devices with private IP addresses to communicate outside network via sharing a public IP address provided by NAT
Process of NAT
Any packet with a private IP address as source address has swapped it for a public address which is routable over the internet.
What does DHCP do
Dynamically assigns private IP addresses and other config options to devices in a network
1st stage of the DHCP procedure
Discover - on start up, broadcasts a discover message for DHCP servers
2nd stage of DHCP procedure
Offer - when DHCP receives request, reserves an IP address for client and sends offer message to client.
Message contains IP address offered, subnet mask, lease duration, IP address of DHCP making offer
3rd stage of DHCP procedure
Request - in response to DHCP offer, client broadcasts a request message with details of server from which it had accepted the offer.
If network is configured with multiple DHCP servers, only one offer accepted
Other servers will withdraw any offers, returning IP address to available pool
What is the 4th stage of the DHCP procedure
Acknowledgement:
when targeted DHCP server receives request message from client, config process enters final phase.
Packet is sent to client that includes any other config info that client requested
What does port forwarding do
Allows remote computers to connect to a specific computer or service within private LAN
Operation of port forwarding
Servers accessible to the public can be given a private IP address within private network
Public request reaches external router of private network using a given port
Data packets are forwarded internally to correct device