Cont'd from Part 1

Now let’s test other VLANs to see if computers can obtain an IP address from the server or not. This time I add another scope for Accounting VLAN (VLAN10) to the DHCP scopes and set PC1’s IP configuration to automatic in Accounting VLAN. The result is shown below in Figure. 6.


Test Other VLANs

Figure. 6


DHCP Request Failed

Figure. 7


As you can see in Figure.7, the DHCP request has failed because PC1 cannot access any DHCP server (in our case, Server0).

What should we do to give PC1 access to the Server0’s DHCP service?

The solution is very easy. You just need to add ip helper-address command to R1’s configuration. With this command we tell the router (R1) to relay the IP request to the server in another VLAN [VLAN 100 (Server VLAN)].


R1#config t

R1(config)#interface fastEthernet 0/0.10

R1(config-subif)#ip helper-address




The result of the configuration is shown below in Figure. 8.  

IP Configuration Result

Figure. 8


We must add the ip helper-address command to the other VLAN’s virtual interfaces on the R1 router. Performing this step, relays the DHCP requests to other PCs in the corresponding VLAN in segment A.

Add other VLANs DHCP scopes to the Server0 as depicted in the following picture.

Add Other VLANs DHCP Scopes

Figure. 9


Now you can configure the Segment B switch yourself. Just add 2 other VLANs to the switch and name them VLAN 30 (HSE) and VLAN 40 (Logistics). Configure ROAS on R2 and test the configuration to make sure that it is working correctly.

Implementing OSPF for connecting 2 segments:

First we must assign the serial 0/0’s IP addresses to both R1 and R2 routers. Issue the below commands to assign the IP addresses.

R1 Configuration:


R1#config t

R1#interface serial 0/0

R1(config-if)#ip address

R1(config-if)#no shutdown

R2 Configuration:


R2#config t

R2(config)#interface serial 0/0

R2(config-if)#ip address

R2(config-if)#no shutdown

R2(config-if)#clock rate 4000000


 (Set Clock Rate on DCE interface. In this demonstration R2’s Serial 0/0 is DCE.)


R1’s OSPF configuration:


R1#config t

R1(config)#router ospf 1


R1(config-router)#network area 0


00:51:07: %OSPF-5-ADJCHG: Process 1, Nbr on Serial0/0 from LOADING to FULL, Loading Done




R2’s OSPF configuration:


R2#config t

R2(config)#router ospf 1


R2(config-router)#network area 0




Now both segments are set up and functional. To test the connection between the computers you need to issue the ping command. You can see the result of pinging the server in Figure.10.

Test Connection Ping Command

Figure. 10


To enable the clients in segment B to obtain an IP address automatically, we need to add ip helper-address command to the R2 configuration on both virtual interfaces. Enter in the following commands:

R2’s OSPF configuration:


R2#config t

R2(config)#interface fastEthernet 0/0.30

R2(config-subif)#ip helper-address


R2(config)#interface fastEthernet 0/0.40

R2(config-subif)#ip helper-address




Now all computers on segment B should be able to obtain an IP address from the DHCP server automatically.

In this article I showed you how to configure routers to implement ROAS, OSPF and DHCP relay agent in one scenario. Hope you found it useful and informative. If you have any questions, please leave them in the comments below.

Author’s Bio: Soheil has over 13 years’ experience in the IT industry and is a huge fan of building websites in his spare time. He works as a Senior Technical Consultant for a company that specializes in IT Support and cloud IT solutions in Australia.

Tweet this

Share on Google+

Share →

One Response to Pt. 2-How to implement DHCP (Relay Agent), ROAS & OSPF (Open Shortest Path First)