A router connection is required for each TCP/IP LAN that wishes to connect to another TCP/IP LAN. This important rule does not have any exceptions. In order to appropriately route packets, a router requires an IP address on the LANs it serves. On each LAN, the default gateway is that router interface.
Clients must be configured using the default gateway’s IP address, otherwise, their traffic will never leave their network, and traffic intended for them from other networks will be routed to them.
Two or more routers may offer backup for the default gateway IP address issued to hosts using the first hop redundancy protocol (FHRP).
Assume that the default gateway’s IP address is 192.168.1.1, and that a single router on the LAN has that IP address statically set on its interface. No host on the LAN will be able to transmit or receive traffic to or from other LANs if that router goes down. There’s just one point of failure here.
Consider two, three, or more routers, each with its unique IP address assigned to each LAN interface. 192.168.1.2, 192.168.1.3, 192.168.1.4, and 192.168.1.5 are possible addresses for router interfaces.
The default gateway address, a virtual IP address provided to hosts, would be supported by each router: 192.168.1.1.
A backup router will take over once an active router fails for a few seconds, keeping the virtual IP address 192.168.1.1 operational.
The following are some of the most frequent FHRPs: :
- Cisco’s proprietary Hot Standby Router Protocol (HSRP).
- Protocol for Virtual Router Redundancy (VRRP)
- An open standard that looks a lot like HSRP.
- GLBP (Gateway Load Balancing Protocol) is a Cisco proprietary protocol that provides load balancing by default by having many active routers, as opposed to HSRP and VRRP, which only have one active router at a time unless additional groups are set.
By default, HSRP and VRRP do not offer load balancing, but they may be modified to do so by establishing numerous (HSRP or VRRP) groups. That is, however, not an easy feat to do.
One gateway IP address will be assigned to half of the customers, while the other half will be assigned to a separate gateway IP address. There’s just no simple method to do this. GLBP, on the other hand, is built from the ground up to be “plug and play load balancing.”
There are two ways to give a host an IP address, subnet mask, and default gateway (as well as other information like DNS server IP addresses): either manually entering all of the information (known as static addressing) or having a server programme running on a system that automatically passes out all of the IP information to systems as they boot up or connect to a network (known as dynamic addressing).
Static addressing entails manually entering all of your IP addresses into each of your hosts. However, before you write anything, you must first answer the following two questions: What exactly are you typing and where are you typing it? Consider a four-node network.
Each machine must have an IP address, a subnet mask, and a default gateway in order for this network to operate. Make a decision on which network ID to utilise first.
Your ISP used to provide you a block of IP addresses to use. Assume you’ve been assigned a Class C network block for 126.96.36.199/24 and that’s still the approach.
The first rule of Internet addressing is that you may do anything you want with your own network ID. There are no regulations other than ensuring that each machine has a valid IP address and subnet mask for your network ID, as well as ensuring that each IP address is unique.
You don’t have to use the numbers in that sequence, and you don’t have to use the 188.8.131.52 IP as the default gateway—you may arrange it anyway you like. However, most networks adhere to the same set of guidelines:
- Assign the first IP address in the network ID to the default gateway.
- Attempt to utilise the IP addresses in the correct sequence.
- Separate the servers from the clients as much as possible. Servers, for example, may have IP addresses ranging from 184.108.40.206 to 220.127.116.11, while clients could have addresses ranging from 18.104.22.168 to 22.214.171.124.
- Whatever you decide to do, make a note of it so that the person who comes after you knows.
These principles have become unofficial network tech standards, and adhering to them will make you extremely popular with anybody who will be in charge of your network in the future.
You may now assign an IP address, subnet mask, and default gateway to each of the machines.
Every operating system has a means for entering static IP addresses. The Internet Protocol Version 4 (TCP/IPv4) Properties dialogue is used in Windows.
In the Windows Internet Protocol Version 4 (TCP/IPv4) Properties panel, enter static IP information.
In macOS, run the Network utility in System Preferences to enter in the IP
Entering static IP information in the macOS Network utility
The command-line ifconfig command was the first tool for inputting IP information on UNIX/Linux systems. A word of caution about using ifconfig to establish static IP addresses: any address given will not be permanent and will be lost upon reboot.
You must locate and change your network configuration files to make the new IP address permanent. Modern distributions (distros) fortunately make your life a little simpler.
Almost every flavour of UNIX/Linux has a useful graphical software, such as Network Configuration in the widely used Ubuntu Linux version.
Setting static IP addresses using the ifconfig command
On many Linux distributions, the ip utility has long since superseded ifconfig (although lots of Linux users refuse to let go of ifconfig). The following is how to use the contemporary utility to statically setup an IP address:
#ip addr dev eth1 192.168.4.10
After you’ve given IP information for at least two computers, you should always use the ping command.
If your ping fails after you’ve entered an IP address, check your IP settings first. It’s likely that you made a mistake. Otherwise, double-check your connections, driver, and other relevant details. Static addressing has been around for a long time and is still widely utilised for your network’s most essential components.
However, static addressing has one major drawback: implementing network changes is a major hassle. Most systems now utilise dynamic IP addressing to get their IP information, which is more simpler and more versatile.
Dynamic IP addressing, which is performed via the Dynamic Host Configuration Protocol (DHCP), allocates an IP address to a computer whenever it joins to the network.
DHCP is a relatively simple protocol. To begin, set up DHCP on a PC. Every operating system includes a way for instructing the machine to utilise DHCP.
Setting up for DHCP
UDP ports 67 (servers) and 68 (clients) are used by DHCP (clients).
A DHCP client is a computer that has been configured to utilise DHCP. When a DHCP client starts up, it sends a DHCP Discover UDP datagram to the 255.255.255.255 broadcast address. “Are there any DHCP servers out there?” asks this DHCP Discover message.
One machine on the LAN must be running specific DHCP server software for DHCP to operate. This server is set up to send DHCP Offers in response to DHCP Discover queries.
The DHCP server is set up to distribute IP addresses from a range (referred to as a DHCP scope or pool) as well as a subnet mask. It also sends out additional data known as scope options, which encompass a wide range of settings including default gateway, DNS server, Network Time server, and so on.
The DHCP client broadcasts a DHCP Request, similar to a DHCP Discover. This is being provided as a broadcast for two reasons. For starters, the client is unable to deliver unicast data since it lacks a legitimate IP address.
Second, if numerous offers come from various servers (which is highly likely), this informs one server that the client wants its IP address, while simultaneously informing the other server that the client does not.
That server may now return the address to the pool for a future request rather of having it stuck in the middle.
The DHCP server subsequently transmits a DHCP Ack, which stores the MAC address and IP information provided to the DHCP client in a database.
The DHCP client receives a DHCP lease at the conclusion of the four-step DHCP dance, DORA (Discover, Offer, Request, and Ack). A DHCP lease is for a certain period of time, usually one to eight days.
The DHCP client will issue another DHCP Request fifty percent into the lease. The DHCP server will then respond with a DHCP Ack, indicating that the lease has been renewed.
Reservations for IP addresses
DHCP servers may be configured to reserve addresses for certain computers, which is known as DHCP IP reservations. However, when it comes to servers, the best practise is to use static IP addresses so that they can be reached even if the DHCP server goes down.
APIPA DHCP is very convenient, and as a result, it is quite popular. It’s so common that you’ll seldom see a user’s PC utilising static addressing on any network.
You should be able to deal with any DHCP issues that occur. The single most serious problem occurs when a DHCP client attempts and fails to get a DHCP address. When this occurs, the operating system will display an error message informing you that there is an issue, and the DHCP client will display a peculiar address in the 169.254.0.0/16 network ID.
A kind of zero-configuration networking generates this unique IP address (zeroconf). Automatic Private IP Addressing is the name of Microsoft’s solution (APIPA).
If they do not get a response to numerous DHCP Discover messages, all DHCP clients are programmed to produce an APIPA address. Only the final two octets of an APIPA address are generated by the client.
Because all dynamic clients on a single network have the same network ID, this enables them to connect with one another.
APIPA is unable to establish a default gateway, hence you will never be able to connect to the Internet via APIPA. That tells you a lot about a DHCP problem: you can speak with other computers on your network that came up after the DHCP server went down, but you can’t access the Internet or machines with the DHCP-assigned address.
If you can’t connect to the Internet, verify your IP address using whatever tool your operating system gives. If it’s an APIPA address, you know you’ve had a DHCP issue right away.
Attempt to manually restore the lease first. Every operating system has a means to do this. You may enter the following command in Windows:
Go to System Preferences and utilise the Network function on macOS.
You may sometimes find yourself in a position where your computer becomes perplexed and refuses to accept an IP address, despite your best efforts.
You should first compel the machine to surrender its lease in these situations. Get to a command prompt on Windows and enter the following two commands, hitting ENTER after each one:
The ifconfig command in UNIX/Linux and macOS may be used to release and renew a DHCP address. The syntax for releasing is as follows:
ifconfig eth0 down sudo
The syntax for renewing is as follows:
ifconfig eth0 up sudo
Many Linux distributions, on the other hand, have moved on to the ip a command, which is now the recommended method. We’ve concentrated on ifconfig since it’s the sole topic covered on the CompTIA Network+ Exam.
DHCPv6 DHCPv6 is still active in the IPv6 realm, although it functions quite differently from DHCP in IPv4.
At first sight, it seems that DHCPv6 isn’t required. IPv6 clients obtain their network prefix from ads on their gateway router (so they also know the default gateway).
Although this is true, IPv6 router advertising do not provide numerous other critical pieces of information that clients need, such as DNS server information, making DHCPv6 a critical component of IPv6.
This method is known as stateless DHCPv6, since the DHCPv6 server does not provide DHCPv6 clients with an IPv6 address/subnet mask combination or a default gateway IP address, but does provide other vital information, such as DNS server IPv6 addresses.
Stateful DHCPv6 is when a DHCPv6 server acts like a DHCP server in the IPv4 world, providing an IP address/subnet mask combination, a default gateway IP address, and other information such as DNS server IP addresses.