Skip to content
Learnearn.uk » IB Computer Science » IP & MAC Addresses

IP & MAC Addresses

Public IP

Public IP Addresses

Each LAN connected to the internet usually has a single public IP Address*. This is the address seen by other computers and networks on the Internet and is the address attached to packets sent across the Internet.

There are 2 main types of Public IP Addresses: Static and Dynamic

* For larger organizations they might have a whole IP range issued to them instead, depending on what kind of network address translation (NAT) they are using.

Publics addresses are usually assigned by your ISP.

Private IP

Private IP Addresses

Computers within a LAN have their own private IP Address, that is different to their Public IP Address. This private IP Adddress is either:

  • Issued by the Server / Router using Dynamic Host Configuration Protocol (DHCP)
  • Set manually by the computer user themselves.

Private IP addresses are usually in the 192.168.x.x range though can also be in the 10.x.x.x and 172.x.x.x

 

NAT

Network Address Translation(NAT)

When a user sends a packet from a computer to a server over the internet, the NAT server swaps the private IP address for a public IP Address and attaches a PORT ID to the packet. The NAT server keeps track of which computers are assigned to which private IP address, so that when a packet returned to the port, it can swap that public IP address on the packet back to the private ip address and send it through the LAN to the correct computer.

 

Static vs Dynamic IP

Static vs Dynamic IP Addresses

Static Public IP Addresses

These are mainly used by:

  • Businesses with LANs that need to be accessed externally from the internet
  • Website Hosts
  • Gamers who want the fastest, most reliable internet service

Static IP addresses stay the same, which mean that data is always sent in the most efficient manner. However a static IP address opens your network up to attackers.

Dynamic Public IP addresses

Most home internet users are issued with a dynamic public IP address when their router connects to the internet and the IP address lease is renewed every month or so. Each time it is renewed a new IP Address is drawn from the pool.

This sharing of IP addresses allows the internet to continue to function even when there are more devices in the world than their are available IP addresses (4 billion different ip addresses are available in total for IPV4 addresses). It is also potentially harder to hack as a network’s IP address is constantly changing.

The limited number of addresses available on the internet using IPV4 led to the development of IPV6, though this technology is still in the process of being rolled out…

Dynamic Private IP Addresses

When your computer connects to your home router is it usually issued with a dynamic private IP address in either the  192.x.x.x range(most common) or the 10.x.x.x range. The IP address is issued by your home router using Dynamic Host Configuration Protocol (DHCP). The lease is normally renewed every 24 hours.

Static Private IP Addresses

You can also set a static private IP address for device when you connect to the network. You do this when you set up your network connect. This is useful if you are setting a up a web server or other server and you need the device to have the same IP address at all times for routing and NAT purposes (more about this in future lessons)..

In practice you very rarely if ever set up a static private IP address for a device.

 

DHCP

Dynamic Host Configuration Protocol

 

IPv4

IPv4

IPv4 is a 32 bit address split into 4 sections

e.g. 255.255.255.255

Range 0 – 255 (256 Possibilities in each)

Total addresses = 256 x 256 x 256 x 256 = 4.3 Billion.

4.2 Billion Addresses is not enough for the modern world as the world has 7 Billion plus inhabitants and many people have more than one internet connected device.

IPv6

IPv6

IPv6 is 128 Bit Address,

340,282,366,920,938,463,463,374,607,431,768,211,456 Addresses.

Probably enough for the foreseeable future.

Advantages

  • Future proof – plenty of unique addresses for each device.
  • Security built in to the profile
  • Allows for QOS packet prioritising.

Disadvantages

  • A bit more overhead in packet size
  • Many legacy devices and systems still don’t fully support IPv6 so we still need IPv4 backup.

Compressing IPv6 Addresses

IP Version 6 addresses are incredibly long, which makes them difficult humans to read/write, even when represented using hexadecimal. Fortunately IP Version 6 Addresses can be Shortened (Compressed). Take a look at the video to see how this can be done.

YouTube Blocked? Click here for the Google Drive Version

 

Mapping IPv4 addresses to IPv6 Addresses

In order to transition from IPv4 to IPv6 old addresses will need to be mapped into IPv6 addresses so that the two can coexist in the new system.

In order to achieve this the first 80 bits are set to 0, followed by 16 bits set to 1. In hexadecimal this would look like:

0:0:0:0:0:ffff  (or 0::ffff if it has been compressed)

The remaining 32 bits of an IPv4 address can then be incorporated into the remaining bits.

In hexadecimal each component of the remaining address then fits into 2 Hexdecimal digits each

 

 

 

 

Resources