Lab DHCP

Ce qui est intéressant là dedans est comment sont configuré R1 et R2.
R1 :

!
version 12.3
!
hostname R1
!
ip dhcp smart-relay
ip dhcp relay information option
!
interface FastEthernet0/0
 ip address 172.16.0.1 255.255.255.0
 ip helper-address 192.168.1.1
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto

Et maintenant R2 :

!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
ip dhcp excluded-address 172.16.0.1
!
ip dhcp pool 2
   network 172.16.0.0 255.255.255.0
   default-router 172.16.0.1
   dns-server 192.168.1.1
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
ip classless
ip route 172.16.0.0 255.255.255.0 192.168.1.2

Sur R1, on peut voir en débuggant lorsqu’on demande à R0 de faire une requête DHCP :

*Mar  1 00:03:42.595: DHCPD: Found previous binding with giaddr 172.16.0.1
*Mar  1 00:03:42.599: DHCPD: setting giaddr to 172.16.0.1.
*Mar  1 00:03:42.599: DHCPD: adding relay information option.
*Mar  1 00:03:42.603: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30 forwarded to 192.168.1.1.
*Mar  1 00:03:44.599: DHCPD: forwarding BOOTREPLY to client c000.6f80.0000.
*Mar  1 00:03:44.603: DHCPD: Forwarding reply on numbered intf
*Mar  1 00:03:44.603: DHCPD: broadcasting BOOTREPLY to client c000.6f80.0000.
*Mar  1 00:03:44.623: DHCPD: Found previous binding with giaddr 172.16.0.1
*Mar  1 00:03:44.623: DHCPD: excessive retransmissions from client 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30.
*Mar  1 00:03:44.623: DHCPD: switching to relay address 172.16.0.1.
*Mar  1 00:03:44.623: DHCPD: setting giaddr to 172.16.0.1.
*Mar  1 00:03:44.627: DHCPD: adding relay information option.
*Mar  1 00:03:44.627: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30 forwarded to 192.168.1.1.
*Mar  1 00:03:44.639: DHCPD: forwarding BOOTREPLY to client c000.6f80.0000.
*Mar  1 00:03:44.643: DHCPD: Forwarding reply on numbered intf
*Mar  1 00:03:44.643: DHCPD: broadcasting BOOTREPLY to client c000.6f80.0000.
*Mar  1 00:04:09.795: DHCPD: checking for expired leases.

Et sur R2 :

*Mar  1 00:03:50.063: DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30 through relay 172.16.0.1.
*Mar  1 00:03:52.067: DHCPD: assigned IP address 172.16.0.3 to client 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30.
*Mar  1 00:03:52.067: DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30 (172.16.0.3).
*Mar  1 00:03:52.071: DHCPD: unicasting BOOTREPLY for client c000.6f80.0000 to relay 172.16.0.1.
*Mar  1 00:03:52.091: DHCPD: DHCPREQUEST received from client 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30.
*Mar  1 00:03:52.095: DHCPD: Sending DHCPACK to client 0063.6973.636f.2d63.3030.302e.3666.3830.2e30.3030.302d.4661.302f.30 (172.16.0.3).
*Mar  1 00:03:52.099: DHCPD: unicasting BOOTREPLY for client c000.6f80.0000 to relay 172.16.0.1.
*Mar  1 00:04:05.859: DHCPD: checking for expired leases.

Et finalement, on se retrouve sur R0 avec :

R0#sh ip route
*Mar  1 00:04:05.571: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 172.16.0.1 to network 0.0.0.0

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, FastEthernet0/0
     192.168.1.0/32 is subnetted, 1 subnets
S       192.168.1.1 [254/0] via 172.16.0.1, FastEthernet0/0
S*   0.0.0.0/0 [254/0] via 172.16.0.1

Je joins ici une capture du trafic sur le lien R0 – R1 et R1 et R2, ainsi que le lab.

6 comments on “Lab DHCP

  • Salut à ceux qui lisent cette feuille de choux 😉

    Une bonne remarque de la part de @MCL_Nicolas concernant la directive 'ip dhcp smart-relay'.

    Celle-ci sert au cas, où vous auriez des adresses secondaires sur l'interface qui doit forwardé les broadcast, afin de forwarder à différents serveurs DHCP séquentiellement.

    Merci Nicolas pour ta remarque fort intéressante. La directive étant resté d'autres labs effectués.

    Amicalement,
    Christophe

    PS: Si tu as d'autres informations ou complément je suis preneur…

  • MCL.Nicolas says:

    Super chef !

    D'ailleurs question . qu'elle est l'AD de la Route par default envoyee par R3 ? 😀

    facileeeeeeeeeeee

  • MDr ! La réponse est dans la question enfin dans le post :
    S* 0.0.0.0/0 [254/0] via 172.16.0.1

    => AD = 254 ; Metric : 0

    A+

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.