Main index

Introducing UNIX and Linux


Maintaining your Linux OS

Overview
Basic management
      Passwords
      Checking storage space
      Checking processes
      Managing users
      Shutting down and restarting your computer
      Automating tasks
Linux file management
      File compression and archiving tools
      File managers
      File splitters
Linux networking
      Getting started
      MAC and IP addresses
      Domain names
      Adding a Linux host to an existing network
      Building a private network
      Configuring the network interface
Security
Uninstalling Linux
Summary

MAC and IP addresses

If you are planning on adding your computer to an existing UNIX network, or if you are planning on building your own local network, then you will probably already have ensured that your computer has an Ethernet card. Each Ethernet card has a unique Media Access Control (or MAC) address. Despite this being unique, these addresses are not commonly used as network identifiers and instead the MAC address is mapped to a higher level IP (Internet Protocol) address.

IP addresses are 32-bit numbers, usually represented in dotted decimal notation (i.e. xxx.xxx.xxx.xxx), which uniquely identify each interface of a host or network router. Using this notation, each decimal number can represent eight bits of binary data and therefore the numbers between 0 and 255. The first of these decimal numbers is important, as it determines the class of network to which this IP address belongs:

Class Range Netmask
A 0.0.0.0 to 127.255.255.255 255.0.0.0
B 128.0.0.0 to 191.255.255.255 255.255.0.0
C 192.0.0.0 to 223.255.255.255 255.255.255.0

Network classes are used to break networks down according to their size. Class A networks can have up to 16,777,214 hosts, class B networks 16,384 hosts and class C networks 254 hosts. This might look restrictive (and there are proposals to update this 32-bit IP version 4 to a 128-bit version 6), but sharing IP addresses across many hosts makes this less of a problem than it might first seem.

There are certain IP addresses that are reserved for special purposes. The number 0, for example, is used to refer to the current network or host, the number 127 (known as a loopback) is used for diagnostic purposes and the number 255 is used for broadcasting packets of data to the entire network. To find the IP address of your machine try the command ypmatch.

Each machine IP address in a local network will share a common 'network portion' and contain a unique 'host portion'. One of the machines that I use the most has the IP address 137.205.227.85; my neighbour in the office next door has a computer with the IP address 137.205.227.84. The host portion of this address is represented by the last (the far right) numbers - the 227.84 or 227.85; the network portion of the address is the 137.205 part of the address; the 227 part is in fact a sub-part of the main university network (a subnet). As it is conventional for the number of hosts to be contiguous, there are at least 85 hosts in subnet 227.

To retrieve the network portion of an IP address a subnet mask (or Netmask) is used. When this is 'bitwise ANDed' with the IP address, the address of the network to which the address belongs is revealed. This mask also allows the network to be further subdivided. The following table shows how an IP address can be decomposed into its associated masks, portions and addresses.

Host address 137.205.227.85
Network mask 255.255.255.0
Network portion 137.205.227.
Host portion                 .85
Network address 137.205.227.0
Broadcast address 137.205.227.255

Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck