DHCP Server & Relay

CCNA 200-301 v2.0 · Live Feb 3, 2027 (v1.1 valid through Feb 2, 2027) Cisco Packet Tracer

مقصدObjectiveObjective

اس لیب میں آپ DHCP سرور بنانا اور DHCP relay (ip helper-address) کانفیگر کرنا سیکھیں گے۔Is lab mein aap DHCP server banana aur DHCP relay (ip helper-address) configure karna seekhenge.In this lab you'll learn to build a DHCP server and configure DHCP relay (ip helper-address).

آسان مثالSimple AnalogySimple Analogy

نیا شہر بس رہا ہے اور ہر گھر والے کو ایڈریس چاہیے۔ آپ ہر گھر جا کر ایڈریس نہیں لکھیں گے — ایک دفتر (DHCP server) بنا دیں گے جو آنے والے کو خود ایڈریس دے دے گا۔ لیکن اگر دفتر دوسرے محلے میں ہے تو درمیان میں ایک ایجنٹ (DHCP relay / ip helper-address) چاہیے جو درخواست آگے بھیج دے۔Naya sheher bas raha hai aur har ghar wale ko address chahiye. Aap har ghar ja kar address nahi likhenge — ek daftar (DHCP server) bana denge jo aane wale ko khud address de dega. Lekin agar daftar doosre mohalle mein hai to darmiyan mein ek agent (DHCP relay / ip helper-address) chahiye jo darkhwast aagay bhej de.A new town is being built and every household needs an address. You won't visit each house to write it — you'll open one office (DHCP server) that hands an address to whoever comes. But if the office is in another neighborhood, you need an agent in between (DHCP relay / ip helper-address) to forward the request.

سیٹ اپLab SetupLab Setup

R1 (DHCP server) 192.168.10.0/24 میں۔ R2 relay ہے، اس کے پیچھے 192.168.20.0/24 میں PC2 ہے۔ Devices: 2x Router 2911 (R1 DHCP server, R2 relay), 1x Switch, 2x PC۔ دونوں PCs پر IP settings 'DHCP' (automatic) پر رکھو۔ کوئی manual IP نہیں۔R1 (DHCP server) 192.168.10.0/24 mein. R2 relay hai, uske peeche 192.168.20.0/24 mein PC2 hai. Devices: 2x Router 2911 (R1 DHCP server, R2 relay), 1x Switch, 2x PC Dono PCs par IP settings 'DHCP' (automatic) par rakho. Koi manual IP nahi.R1 (DHCP server) is in 192.168.10.0/24. R2 is the relay, with PC2 behind it in 192.168.20.0/24. Devices: 2x Router 2911 (R1 DHCP server, R2 relay), 1x Switch, 2x PC. Set both PCs' IP settings to 'DHCP' (automatic). No manual IPs.

اقداماتStepsSteps

Step 1

R1 پر DHCP server۔ DHCP pool بناؤ: کونسی network بانٹنی ہے، گیٹ وے کیا ہے، DNS کیا ہے۔R1 par DHCP server. DHCP pool banao: kaunsi network baantni hai, gateway kya hai, DNS kya hai.DHCP server on R1. Create the DHCP pool: which network to hand out, the gateway, the DNS.

enable
configure terminal
ip dhcp pool OFFICE
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 8.8.8.8
lease 7
exit

Step 2

Excluded addresses وہ ہیں جو کبھی مت دینا (راؤٹر، سرورز کے IPs)۔Excluded addresses woh hain jo kabhi mat dena (router, servers ke IPs)Excluded addresses are the ones you must never give out (router and server IPs).

ip dhcp excluded-address 192.168.10.1 192.168.10.10

Step 3

R2 پر DHCP relay۔ R2 کے پیچھے والے PCs کا DHCP سرور R1 پر ہے (دوسری network میں)۔R2 par DHCP relay. R2 ke peeche wale PCs ka DHCP server R1 par hai (doosri network mein).DHCP relay on R2. The DHCP server for PCs behind R2 sits on R1 (a different network).

enable
configure terminal
interface g0/1

Step 4

ip helper-address broadcast کو unicast بنا کر سرور تک پہنچاتا ہے۔ip helper-address broadcast ko unicast bana kar server tak pahunchata haiip helper-address turns the broadcast into unicast and delivers it to the server.

ip helper-address 192.168.10.1
exit

Step 5

Testing: PC پر ipconfig کرو — IP 192.168.10.x ملنا چاہیے (پہلے 10 چھوڑ کر)۔Testing: PC par ipconfig karo — IP 192.168.10.x milna chahiye (pehle 10 chhor kar).Testing: run ipconfig on the PC — it should get a 192.168.10.x address (skipping the first 10).

Step 6

R2 کے پیچھے والے PC کو بھی relay کے ذریعے IP ملنا چاہیے۔R2 ke peeche wale PC ko bhi relay ke through IP milna chahiye.The PC behind R2 should also get an IP via the relay.

تصدیقVerifyVerify

show ip dhcp binding سے leases دیکھو۔ show ip dhcp pool سے pool status دیکھو۔show ip dhcp binding se leases dekho. show ip dhcp pool se pool status dekho.Check leases with show ip dhcp binding. Check pool status with show ip dhcp pool.

show ip dhcp binding
show ip dhcp pool

خرابی دور کرناTroubleshootingTroubleshooting

⚠️ PC کو IP نہیں مل رہا۔PC ko IP nahi mil raha.The PC isn't getting an IP.

✅ Excluded range چیک کرو — کہیں پوری pool ہی exclude تو نہیں کر دی۔ show ip dhcp pool سے دیکھو۔Excluded range check karo — kahin poori pool hi exclude to nahi kar di. show ip dhcp pool se dekho.Check the excluded range — make sure you didn't exclude the whole pool. Look with show ip dhcp pool.

⚠️ Relay کے ذریعے IP نہیں مل رہا۔Relay ke through IP nahi mil raha.No IP through the relay.

✅ ip helper-address client والے interface پر لگتا ہے، سرور والے پر نہیں۔ Interface چیک کرو۔ip helper-address client wale interface par lagta hai, server wale par nahi. Interface check karo.ip helper-address goes on the client-side interface, not the server side. Check the interface.

انٹرویو سوالاتInterview Q&AInterview Q&A

❓ DHCP DORA process کیا ہے؟DHCP DORA process kya hai?What is the DHCP DORA process?

DORA: Discover, Offer, Request, Acknowledge۔ Client ڈھونڈتا ہے، سرور offer کرتا ہے، client مانگتا ہے، سرور کنفرم کرتا ہے۔DORA: Discover, Offer, Request, Acknowledge. Client dhoondta hai, server offer karta hai, client maangta hai, server confirm karta hai.DORA: Discover, Offer, Request, Acknowledge. The client searches, the server offers, the client requests, the server confirms.