In our network devices, IP addresses can be assigned in 2 ways, statically or via DHCP.

Static IP address assignment is added by an operator via CLI, or a script pushing automating configurations.
Dynamic Host Configuration protocol or DHCP, allows a host or interface to request am IP address from a pool.

In this demo, we will see both options used to assign IP addresses to interfaces on RTR1 and RTR2, which are Cisco IOS and XR device types. Practicing on both software flavours will show the similarities and differences in syntax.

  • RTR1 IOS
  • RTR2 XR
  • DHCP is an IOS router acting as DHCP
  • assign IP addresses

The 1st task is to assign 10.1.1.1 255.255.255.0 to RTR1 GE0/2 and 10.1.1.2 255.255.255.0 to RTR2 GE0/0/0/1 interface.
2nd task is to use DHCP to assign an IP to RTR1 GE0/1 from a pool of 10.2.1.0/24.

RTR1

  1. configure terminal, or “conf t” will bring to exec mode, which allows you to start making configuration changes.
  2. under interface, you assign the ip address, “ip address 10.1.1.1 255.255.255.0″
  3. Enable the port or interface, “no shutdown

RTR2

  1. configure or “conf ” will bring you to exec mode, which allows you to start making configuration changes.
  2. under interface, you assign the ip address, “ipv4 address 10.1.1.2/24″
  3. Enable the port or interface, “no shutdown

RTR1 DHCP assigned IP address

  1. configure terminal, or “conf t” will bring to exec mode, which allows you to start making configuration changes.
  2. under interface, you assign the ip address as DHCP , “ip address dhcp”
  3. Enable the port or interface, “no shutdown

As per below configuration and output, GE0/2 is assigned an IP address, and method shown is DHCP instead of manual. The log also shows how and when address 10.2.1.2 255.255.255.0 is assigned to GE0/1.

For more examples on router’s configuration and how to access a Cisco router or switch, take a look at this demo basic-router-configuration.