TCP/IP Addressing

Before you start connecting and configuring your network it can be a good idea to make a note of the IP Addresses and hostnames that you are going to use for your network devices. It is important to choose a sensible IP network and allocate the host addresses appropriately. The Internet standards for IP addressing allow a certain number of addresses (Officially known as RFC1918) that can be used in a private network. There are three main ranges relating to the three main classes of IP address. Most home network type folks will normally go for addresses that have the first two digits of 192.168. It is then very common to see the third digit as either 0 or 1, but this third digit can be any number up to 255 although each of your network devices will all need to have the same number set here otherwise they will not be able to communicate.

On my own network, I use 192.168.3.0 as my network number (er, three coz it's my house number;-)). This allows me to have my hosts numbered from 1 to 254, or, in other words 254 hosts. For example, the PC that this web page was written on is 192.168.3.80, whilst my gateway machine is 192.168.3.254. Note, you cannot use the numbers 0 or 255 as the last number as these are used by all the network devices to know where they are in the IP world and to respond to low-level network requests, which, TBH, do not usually come into the 'basics' category.

The address ranges designated as privately assigned are as shown in the following table. Note that it is highly unlikely that a home network will require thousands or millions of addreses, but it is still possible to use the Class A and B address ranges for your internal network without any penalty. It is very common for the 192.168 address range to be used within a home network as it is very easy to manage.

Network Class Available address Range Available number of Hosts
10.0.0.0 A 10.0.0.1 -> 10.255.255.254 Millions;-)
172.16.0.0 B 172.16.0.1 -> 172.31.255.254 Thousands;-)
192.168.0.0 C 192.168.0.1 -> 192.168.255.254 254 per network

For example, if the network number is 192.168.0.0, then this will allow us to use the numbers 192.168.0.1 through 192.168.0.254 for our hosts. If 254 is used as the gateway's address, then each of the other machines can be allocated addresses such as 192.168.0.10, 192.168.0.20, 192.168.0.30, etc.. When setting these other machines, you need to specify the address of your gateway as the Default Router, Default Gateway, depending on your networking software. This tells the PC's IP stack to use your gateway as the route for all your non-local traffic, or, to put it another way, 'I've no idea where that is, ask that geezer over there with the map'.

It is also possible to subnet your network, subnetting being a means of dividing large networks into smaller ones. An IP address consists of two halves, a network portion and a host portion. This is determined by the subnet mask of a network which is either depicted in the 'dotted' form, e.g., 255.255.255.0 or by using the CIDR 'slash' notation, e.g., /24. This figure refers to the numnber of bits of a network address that are the network portion. The CIDR (Classless Inter-Domain Routing) format is the generally accepted form used in networking as it allows networks to be subnetted without reference to IP network classes. It also saves having to keep forever typing 255;-).

The following table shows some subnets and their CIDR notation, together with the number of available hosts and networks that are available for a particular subnet. The reason that the number of hosts differs from the number of address is that two addresses are used to denote the network address and one denotes the broadcast address. For example, network 192.168.0.0/24 will have 192.168.0.0 as it's network address and 192.168.0.255 as it's broadcast. Note that an address stated with a /32 value is a host address and that a /31 subnet is next to useless;-)

Network Mask CIDR # Addresses # Hosts # Subnets
255.255.255.255 /32 1 1 0
255.255.255.254 /31 2 0 0
255.255.255.252 /30 4 2 64
255.255.255.248 /29 8 6 32
255.255.255.240 /28 16 14 16
255.255.255.224 /27 32 30 8
255.255.255.192 /26 64 62 4
255.255.255.128 /25 128 126 2
255.255.255.0 /24 256 254 1

OK. let's apply this wordy theoretical explanation to one of our physical networks outlined above. Taking probably the most common configuration, multiple PCs connected using RJ45 cabling via a hub or switch, the gateway device (be it a PC, or a Router) needs to be set to obtain an IP address by DHCP on the NTL facing connection. The internal (or LAN) connection on the gateway device will almost invariably have it's IP fixed, and this value will vary depending on the gateway device used. Clients on the network will either get their address from the gateway device or have their address set manually. Either way, the addresses used will need to be of the same network as the LAN address set on the gateway but it most be noted that if you set address manually, you will normally have to set both the Gateway and DNS servers manually as well.

The first of the following diagrams shows how IP addresses are allocated where a LAN dhcp server is available. The only address that is fixed is that of the LAN interface of the gateway device. This is the typical set-up where Microsoft ICS, Sygate, Wingate, Netgear, SMC and Linksys routers are used as the gateway device, i.e., very common.

  • Automatic IP Settings

    Where DHCP is used to supply IP addresses, it is normal practice for DHCP to also supply both the Gateway Address and the DNS servers to be used for name resolution.

    Automatic IP Settings

  • Manual IP Address Settings

    Most internet sharing devices will offer DHCP services to the LAN but there may be instances where either DHCP does not work (this is more likely with MS ICS rather than a router), or you want to have fixed address set on your LAN. In this case you must also define the subnet mask as well, which for our example below is 255.255.255.0. Note that essentially nothing changes on the gateway device, it still has DHCP set on the Cable interface and a fixed address on the LAN interface.

    In addition, where you set a manual address, you also need to set the Gateway address and the DNS servers. In this example, the Gateway and DNS would be 192.168.0.1 but again there are instances where DNS does not work (again more likely with MS ICS!) so there may be a need to set NTL's DNS servers instead. These are 194.168.4.100 and 194.168.8.100 and it is usual to specify both in your set-up.

    When setting manual addresses it is important not to cause an IP clash, or, in other words, do not set two IP addresses the same. In addition you should avoid setting any addresses that clash with the IP address scope of any DHCP servers you are running.

    Fixed IP Settings

There is one other range of addresses that should be filed for reference and this is designated as APIPA or Automatic Private IP Addressing. APIPA addresses range from 169.254.0.1 to 169.254.255.254 (or 169.254.0.0/16 in CIDR format) and are assigned by an OS when a DHCP server is not available or cannot be reached. They are valid IP addresses but a machine that has auto assigned an address from this range will only be able to communicate with other machines that are in the same APIPA range. Because the APIPA range is a /16 subnet a machine with address 169.254.72.12 will be able to communicate with a machine with address 169.254.22.177, for example.

Finding assigned IP Addresses:

Most Operating Systems have facilities for discovering assigned IP addresses, some examples of which are ahown below.

  • Win9X

    Use the command winipcfg by selecting Run from the Start Menu. A window will be shown that looks like this:

    Output from Start/Run/winipcfg

    Note that this screen will also show the MAC or hardware address of your NIC, or, in the case of Winipcfg, the Adapter Address. This is the address that your Cable Modem learns on boot-up.

  • WinNT/2000

    In a dos command window, type ipconfig :

    C:\>ipconfig
    
    Windows 2000 IP Configuration
    
    Ethernet adapter Local Area Connection 5:
    
            Connection-specific DNS Suffix  . : nigs.net
            IP Address. . . . . . . . . . . . : 192.168.3.201
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 192.168.3.254
    

    Or, for more detail, ipconfig /all :

    
    C:\>ipconfig /all
    
    Windows 2000 IP Configuration
    
            Host Name . . . . . . . . . . . . : NIGS
            Primary DNS Suffix  . . . . . . . :
            Node Type . . . . . . . . . . . . : Hybrid
            IP Routing Enabled. . . . . . . . : No
            WINS Proxy Enabled. . . . . . . . : No
            DNS Suffix Search List. . . . . . : nigs.net
    
    Ethernet adapter Local Area Connection 5:
    
            Connection-specific DNS Suffix  . : nigs.net
            Description . . . . . . . . . . . : Linksys EtherFast 10/100 PC Card
            Physical Address. . . . . . . . . : 00-E0-98-21-25-4C
            DHCP Enabled. . . . . . . . . . . : Yes
            Autoconfiguration Enabled . . . . : Yes
            IP Address. . . . . . . . . . . . : 192.168.3.201
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 192.168.3.254
            DHCP Server . . . . . . . . . . . : 192.168.3.254
            DNS Servers . . . . . . . . . . . : 192.168.3.254
            Primary WINS Server . . . . . . . : 192.168.3.254
            Lease Obtained. . . . . . . . . . : 15 July 2001 20:06:44
            Lease Expires . . . . . . . . . . : 16 July 2001 20:06:44
    
    

  • Linux

    At your shell prompt type ifconfig, which will result in output that will look very similar to that shown in the following screen dump, which shows the output from a two NIC Linux machine where eth0 is attached to an NTL Cable Modem and eth1 is attached to the internal network. Note that there is no indication here as to eth0 having obtained it's address via DHCP.

    Output from ifconfig

    One important aspect of the above addressing information is that, for the most part, these utilities will only show the address of the machine that they are run on. When a machine is behind a NAT router or Gateway then invariably the address shown will be an internal one, as demonstrated above and not the address that the machine will be seen as on the Internet. In order to see this address, i.e., the public IP address then another method is required. This could be thru' logging onto the router or gateway and using whatever utility exists on there or by using a web page that can display the IP address that your traffic appears to generate from. This latter method however, often only shows one of NTL's transparent proxy servers so is not infallible. One tool that can help is MyWANIP which connects to it's own servers to determine your true WAN IP address:

    MyWANIP screenshot


    © Nig's Net Written using the Bluefish HTML Editor on RedHat 9.0.

    All Copyrights and Trademarks ACK'd. Not to do so would be a SYN!