Routing Flashcards
IPv4 Addressing
An IPv4 address is made up of two parts: a network/subnet portion and a host portion. It is imperative that all devices in the same network/subnet share exactly the same network/subnet portion. If they are not the same, the PC could end up addressing the Layer 2 frame incorrectly and sending the packet in the wrong direction.
IPv4 sample subnet
same network
When PC1 needs to communicate with PC2, it does a DNS lookup for the IP address of PC2. The IP address 10.1.1.20 is returned. Now PC1 needs to determine whether PC2 is located in the same subnet because this determines whether the frame has the MAC address of PC2 or the MAC address of the default gateway (DG). PC1 determines its network/subnet portion by comparing its IP address to its subnet mask in binary.
PC1 IP address in binary | PC1 subnet mask in binary = Result PC1 network/subnet ID
Now PC1 compares exactly the same binary bits to those binary bits in PC2’s address.
PC1 network/subnet ID | PC2 IP in binary
Because the binary bits are the same, PC1 concludes that PC2 is in the same network/subnet; therefore, it communicates directly with it and does not need to send the data to its default gateway. PC1 creates a frame with its own source MAC address and the MAC address of PC2 as the destination.
IPv4 sample subnet
different network
Consider what occurs when PC1 needs to communicate with the web server at 192.0.2.1. It does a DNS lookup for the IP address of the web server. The IP address 192.0.2.1 is returned. Now PC1 needs to determine whether the web server is located in the same network/subnet. This determines whether the frame has the MAC address of the web server or the MAC address of the DG. PC1 determines its network/subnet portion by comparing its IP address to its subnet mask in binary.
Now PC1 compares exactly the same binary bits to those binary bits in the web server address. PC1’s network/subnet ID with the web server’s IP.
PC1 concludes that the web server is in a different network/subnet because the bits are not the same; therefore, to communicate with the web server, it needs to send the data to its default gateway. PC1 creates a frame with its own source MAC address and the MAC address of R1 as the destination.
Connectivity Issues
Not only does an improper subnet mask cause issues, but an inappropriate IP address combined with the correct subnet mask also causes issues. In addition, if the default gateway is not configured correctly on the PCs, packets are not forwarded to the correct device when packets need to be sent to a different subnet.
DHCP for IPv4
DHCP allows a DHCP client to obtain an IP address, subnet mask, default gateway IP address, DNS server IP address, and other types of IP addressing information from a DHCP server. The DHCP server can be local within the subnet, in a remote subnet, or the same device that is also the default gateway.
If you have a cable modem, Digital Subscriber Line (DSL), or fiber connection in your home, your router more than likely obtains its IP address from your service provider through DHCP. The router is also acting as a DHCP server for the devices in your home. In corporate networks, when a PC boots, that PC receives its IP address configuration information from a corporate DHCP server.
DHCP Operation
Step 1
When a DHCP client initially boots, it has no IP address, default gateway, or other such configuration information. Therefore, the way a DHCP client initially communicates is by sending a broadcast message (that is, a DHCPDISCOVER message) to destination IP address 255.255.255.255 and destination MAC address FFFF:FFFF:FFFF in an attempt to discover a DHCP server. The source IP address is 0.0.0.0, and the source MAC address is the MAC address of the sending device.
DHCP Operation
Step 2
When a DHCP server receives a DHCPDISCOVER message, it can respond with a DHCPOFFER message with an unleased IP address, subnet mask, and default gateway information. Because the DHCPDISCOVER message is sent as a broadcast, more than one DHCP server might respond to this Discover message with a DHCPOFFER. However, the client typically selects the server that sent the first DHCPOFFER response it received.
DHCP Operation
Step 3
The DHCP client communicates with the selected server by sending a broadcasted DHCPREQUEST message indicating that it will be using the address provided in the DHCPOFFER and, as a result, wants the associated address leased to itself.
DHCP Operation
Step 4
Finally, the DHCP server responds to the client with a DHCPACK message indicating that the IP address is leased to the client and includes any additional DHCP options that might be needed at this point, such as the lease duration.
DHCP Relay Agent
Notice that in step 1, the DHCPDISCOVER message is sent as a broadcast. The broadcast cannot cross a router boundary. Therefore, if a client resides on a different network from the DHCP server, you need to configure the default gateway of the client as a DHCP relay agent to forward the broadcast packets as unicast packets to the server. You use the ip helper-address ip_address interface configuration mode command to configure a router to relay DHCP messages to a DHCP server in the organization.
The ip helper-address 10.1.1.2 command specifies the IP address of the DHCP server. If the wrong IP address is specified, the DHCP messages are relayed to the wrong device. In addition, the ip helper-address command must be configured on the interface that is receiving the DHCPDISCOVER messages from the clients. If it isn’t, the router cannot relay the DHCP messages.
DHCP Relay Agent
When you configure a router to act as a DHCP relay agent, realize that it relays a few other broadcast types in addition to a DHCP message. Other protocols that are forwarded by a DHCP relay agent include the following:
- TFTP
- DNS
- ITS
- NetBIOS name server
- BootP
- TACACS
DHCP Messages
- DHCPDISCOVER: A client sends this message in an attempt to locate a DHCP server. This message is sent to broadcast IP address 255.255.255.255, using UDP port 67.
- DHCPOFFER: A DHCP server sends this message in response to a DHCPDISCOVER message, using UDP port 68.
- DHCPREQUEST: This broadcast message is a request from the client to the DHCP server for the IP addressing information and options that were received in the DHCPOFFER message.
- DHCPACK: A DHCP server sends this message to a client and includes IP configuration parameters.
- DHCPRELEASE: A client sends this message to a DHCP server and informs the DHCP server that the client has released its DHCP lease, thus allowing the DHCP server to reassign the client IP address to another client.
- DHCPNAK: A DHCP server sends this message to a client and informs the client that the DHCP server declines to provide the client with the requested IP configuration information.
Router as a DHCP Client/Server
In addition to acting as a DHCP relay agent, a router might act as a DHCP client. Specifically, the interface of a router might obtain its IP address from a DHCP server. The dhcp option is used in the ip address command, instead of the usual IP address and subnet mask information.
A router and multilayer switch may also act as a DHCP server. The ip dhcp excluded-address 10.8.8.1 10.8.8.10 command prevents DHCP from assigning those IP addresses to a client. Note that you do not have to include the IP address of the router interface in this exclusion because the router never hands out its own interface IP address. The ip dhcp pool POOL-A command creates a DHCP pool named POOL-A. This pool hands out IP addresses from the 10.8.8.0/24 network, with a default gateway of 10.8.8.1, a DNS server of 192.168.1.1, and a WINS server of 192.168.1.2.
DHCP Tshoot Issues
A router not forwarding broadcasts: By default, a router does not forward broadcasts, including DHCPDISCOVER broadcast messages. Therefore, a router needs to be explicitly configured to act as a DHCP relay agent if the DHCP client and DHCP server are on different subnets.
DHCP pool out of IP addresses: A DHCP pool contains a finite number of addresses. Once a pool becomes depleted, new DHCP requests are rejected.
Misconfiguration: The configuration of a DHCP server might be incorrect.
Duplicate IP addresses: A DHCP server might hand out an IP address to a client that is already statically assigned to another host on the network. These duplicate IP addresses can cause connectivity issues for both the DHCP client and the host that was statically configured for the IP address.
DHCP Tshoot Issues
The “pull” nature of DHCP: When a DHCP client wants an IP address, it requests an IP address from a DHCP server. However, the DHCP server has no ability to initiate a change in the client IP address after the client obtains an IP address. In other words, the DHCP client pulls information from the DHCP server, the DHCP server cannot push information changes to the DHCP client.
Interface not configured with IP address in DHCP pool: A router or a multilayer switch that is acting as a DHCP server must have an interface with an IP address that is part of the pool/subnet that it is handing out IP addresses for. The router only hands the addresses in the pool to clients reachable out that interface. This ensures that the router interface and the clients are in the same subnet. However, note that this is not the case if a relay agent is forwarding DHCP messages between the client and the router that is the DHCP server. In that case, the DHCP server does not have to have an IP address on an interface that is part of the pool it is handing out addresses for.