|
1 | | -# 14 |
| 1 | +# 14 – DHCP Server Configuration in Cisco Packet Tracer |
| 2 | + |
| 3 | +This tutorial is the fourteenth in our Cisco Packet Tracer series and introduces the configuration of a **DHCP (Dynamic Host Configuration Protocol) server**. DHCP automates IP address assignment, simplifying host configuration in networks of all sizes. |
| 4 | + |
| 5 | +We’ll build a basic network with **one router, two switches, six PCs**, and **one DHCP server**. The DHCP server will dynamically assign IP addresses to all PCs in the network. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Part 1 – Network Topology Overview |
| 10 | + |
| 11 | +This network includes: |
| 12 | + |
| 13 | +* **One router** (R0) |
| 14 | +* **Two switches** (S0, S1) |
| 15 | +* **Six PCs** (PC0–PC5) |
| 16 | +* **One server** (Server0) acting as the DHCP server, connected to Switch 0 |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Part 2 – Device Placement and Cabling |
| 23 | + |
| 24 | +### Step 2.1 – Add Devices to the Workspace |
| 25 | + |
| 26 | +From **Network Devices** and **End Devices**, place: |
| 27 | + |
| 28 | +* **1 Router** (2911) |
| 29 | +* **2 Switches** (2960) |
| 30 | +* **6 PCs** (PC0–PC5) |
| 31 | +* **1 Server** (Server0) |
| 32 | + |
| 33 | +Label as follows: |
| 34 | + |
| 35 | +* Router: **R0** |
| 36 | +* Switches: **S0**, **S1** |
| 37 | +* Server: **Server0** (DHCP) |
| 38 | +* PCs: **PC0–PC5** |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +### Step 2.2 – Cabling |
| 43 | + |
| 44 | +Use **Copper Straight-Through** connections: |
| 45 | + |
| 46 | +| From | To | Port | |
| 47 | +| ------- | -- | -------------- | |
| 48 | +| PC0–PC2 | S0 | fa0/1–fa0/3 | |
| 49 | +| Server0 | S0 | fa0/23 | |
| 50 | +| PC3–PC5 | S1 | fa0/1–fa0/3 | |
| 51 | +| S0 | R0 | fa0/24 → gig0/0 | |
| 52 | +| S1 | R0 | fa0/24 → gig0/1 | |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## Part 3 – IP Addressing Plan |
| 57 | + |
| 58 | +We’ll configure **two subnets**, one per switch: |
| 59 | + |
| 60 | +| Subnet | Range | Subnet Mask | |
| 61 | +| -------------- | ----------------- | ------------- | |
| 62 | +| 192.168.1.0/24 | Switch S0 (VLAN1) | 255.255.255.0 | |
| 63 | +| 192.168.2.0/24 | Switch S1 (VLAN2) | 255.255.255.0 | |
| 64 | + |
| 65 | +Router interfaces: |
| 66 | + |
| 67 | +| Device | Interface | IP Address | |
| 68 | +| ------ | --------- | ----------- | |
| 69 | +| R0 | gig0/0 | 192.168.1.1 | |
| 70 | +| R0 | gig0/1 | 192.168.2.1 | |
| 71 | + |
| 72 | +The DHCP server will provide addresses within: |
| 73 | + |
| 74 | +* 192.168.1.10–192.168.1.100 for VLAN 1 (Switch 0) |
| 75 | +* 192.168.2.10–192.168.2.100 for VLAN 2 (Switch 1) |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## Part 4 – Configuration |
| 80 | + |
| 81 | +Now we will configure the DHCP server and router interfaces to enable automatic IP address assignment. It's important to ensure the DHCP server is reachable from both VLANs and therefore we will set it up first. |
| 82 | + |
| 83 | +### Step 4.1 – Configure the DHCP Server |
| 84 | + |
| 85 | +1. Click on **Server0** |
| 86 | +2. Go to the **Desktop** tab → Select **IP Configuration** |
| 87 | +3. Set the following values: |
| 88 | + * **IPv4 Address:** `192.168.1.2` |
| 89 | + * **Subnet Mask:** `255.255.255.0` |
| 90 | + * **Default Gateway:** `192.168.1.1` |
| 91 | + |
| 92 | +  |
| 93 | + |
| 94 | + > This ensures the DHCP server has a fixed IP address on the correct subnet and can communicate with the router. |
| 95 | +4. Now go to the **Services** tab |
| 96 | +5. From the left menu, select **DHCP** |
| 97 | +6. Make sure **Service** is turned **On** at the top |
| 98 | + |
| 99 | +```{admonition} Warning |
| 100 | +:class: warning |
| 101 | +Ensure to turn on the `ServerPool` service in the DHCP settings, but don't change any of its default settings. |
| 102 | +``` |
| 103 | + |
| 104 | +#### Configure the first pool (for Switch 0 / VLAN 1)- |
| 105 | + |
| 106 | +* **Pool Name:** `LAN1` |
| 107 | +* **Default Gateway:** `192.168.1.1` |
| 108 | +* **DNS Server:** `0.0.0.0` |
| 109 | +* **Start IP Address:** `192.168.1.10` |
| 110 | +* **Subnet Mask:** `255.255.255.0` |
| 111 | +* **Maximum Number of Users:** `90` |
| 112 | +* Click **Add** |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +#### Configure the second pool (for Switch 1 / VLAN 2)- |
| 117 | + |
| 118 | +* **Pool Name:** `LAN2` |
| 119 | +* **Default Gateway:** `192.168.2.1` |
| 120 | +* **DNS Server:** `0.0.0.0` |
| 121 | +* **Start IP Address:** `192.168.2.10` |
| 122 | +* **Subnet Mask:** `255.255.255.0` |
| 123 | +* **Maximum Number of Users:** `90` |
| 124 | +* Click **Add** |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +> You should now see both pools listed in the table at the bottom, showing their assigned configurations. |
| 129 | +> |
| 130 | +>  |
| 131 | +
|
| 132 | +### Step 4.2 – Configure Router Interfaces |
| 133 | + |
| 134 | +```{admonition} Note |
| 135 | +:class: note |
| 136 | +We will be configuring the DHCP server to have the IP address `192.168.1.2` and we will use the `ip helper-address` command to forward DHCP requests from VLAN 2 to the DHCP server. |
| 137 | +``` |
| 138 | + |
| 139 | +```bash |
| 140 | +enable |
| 141 | +configure terminal |
| 142 | +hostname R0 |
| 143 | + |
| 144 | +interface g0/0 |
| 145 | +ip address 192.168.1.1 255.255.255.0 |
| 146 | +no shutdown |
| 147 | +exit |
| 148 | + |
| 149 | +interface g0/1 |
| 150 | +ip address 192.168.2.1 255.255.255.0 |
| 151 | +ip helper-address 192.168.1.2 |
| 152 | +no shutdown |
| 153 | +exit |
| 154 | + |
| 155 | +ip dhcp relay information trust-all |
| 156 | +exit |
| 157 | +write memory |
| 158 | +``` |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## Part 5 – PC Configuration and Testing |
| 165 | + |
| 166 | +Your network is now set up with a DHCP server and router. The next step is to configure the PCs to use DHCP for automatic IP address assignment. |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | +### Step 5.1 – Set PCs to Use DHCP |
| 171 | + |
| 172 | +1. Click on each PC (PC0–PC5) |
| 173 | +2. Go to **Desktop** > **IP Configuration** |
| 174 | +3. Select **DHCP** (not static) |
| 175 | + |
| 176 | +Each PC should automatically receive an IP address, subnet mask, default gateway, and DNS server. |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | +### Step 5.2 – Verify Connectivity |
| 183 | + |
| 184 | +From **PC0**, ping **PC3**: |
| 185 | + |
| 186 | +```{admonition} Note |
| 187 | +:class: note |
| 188 | +Make sure to check the IP address of PC3 before pinging as it may vary based on the DHCP assignment. |
| 189 | +
|
| 190 | +```bash |
| 191 | +ping 192.168.2.32 |
| 192 | +``` |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | +From **PC5**, ping the DHCP server: |
| 197 | + |
| 198 | +```bash |
| 199 | +ping 192.168.1.2 |
| 200 | +``` |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | +You can also run: |
| 205 | + |
| 206 | +```bash |
| 207 | +ipconfig /all |
| 208 | +``` |
| 209 | + |
| 210 | +> This displays the IP address, gateway, and DNS settings assigned by DHCP. |
| 211 | +> |
| 212 | +>  |
| 213 | +
|
| 214 | +--- |
| 215 | + |
| 216 | +## Summary |
| 217 | + |
| 218 | +In this tutorial, you: |
| 219 | + |
| 220 | +* Built a two-switch, single-router network |
| 221 | +* Connected a DHCP server to automatically manage IP addresses |
| 222 | +* Configured two IP subnets for different LAN segments |
| 223 | +* Verified automatic address assignment using DHCP |
| 224 | + |
| 225 | +DHCP simplifies network management by removing the need to manually assign IP addresses to each device—especially valuable in larger or frequently changing networks. |
0 commit comments