14 janv. 2012

RFC1483 - DHCP Server & Relay

LAB#1:
BrAS
!
hostname BrAS
!
ip dhcp excluded-address 192.168.1.1
!
ip dhcp pool Pool-DHCP1
   network 192.168.1.0 255.255.255.0
   default-router 192.168.1.1
!
interface Loopback0
 ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 no keepalive
!
interface FastEthernet1/0.203
 encapsulation dot1Q 203
 ip address 192.168.23.2 255.255.255.0

!
interface ATM2/0
 no ip address
 no atm ilmi-keepalive
!         
interface ATM2/0.1 point-to-point
 ip unnumbered Loopback4000
 atm route-bridged ip
 pvc 1/35 
  no broadcast
  encapsulation aal5snap
!
ip route 0.0.0.0 0.0.0.0 192.168.23.3 name GW1
!


CPE:
!
hostname CPE
!

interface FastEthernet1/0
 no shutdown
 no ip address
 duplex auto
 speed auto
 no keepalive
!

interface ATM2/0
 no ip address
 no atm ilmi-keepalive
!
interface ATM2/0.1 point-to-point
 ip address dhcp client-id FastEthernet1/0
 atm route-bridged ip
 pvc 1/35 
  broadcast
  encapsulation aal5snap
!        


GW1:

!
hostname GW1
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 no keepalive
!
interface FastEthernet1/0.203
 encapsulation dot1Q 203
 ip address 192.168.23.3 255.255.255.0
!
ip route 192.168.1.0 255.255.255.0 192.168.23.2 name GW1
!





LAB#2:


CPE1:


hostname CPE1
!
interface FastEthernet0/0
 mac-address aaaa.aaaa.aaaa
 no ip address
 duplex half
!
interface ATM1/0
 no ip address
 no atm ilmi-keepalive
!
interface ATM1/0.1 point-to-point
 ip address dhcp client-id FastEthernet0/0
 atm route-bridged ip
 pvc 1/41
  encapsulation aal5snap
 !
!


CPE2:


hostname CPE2
!
interface FastEthernet0/0
 mac-address aaaa.aaaa.aaab
 no ip address
 duplex half
!
interface ATM1/0
 no ip address
 no atm ilmi-keepalive
!
interface ATM1/0.1 point-to-point
 ip address dhcp client-id FastEthernet0/0
 atm route-bridged ip
 pvc 1/42 
  encapsulation aal5snap
 !
!

CPE3:
hostname CPE3
!
interface FastEthernet0/0
 mac-address aaaa.aaaa.aaac
 no ip address
 duplex half
!
interface ATM1/0
 no ip address
 no atm ilmi-keepalive
!
interface ATM1/0.1 point-to-point
 ip address dhcp client-id FastEthernet0/0
 atm route-bridged ip
 pvc 1/43
  encapsulation aal5snap
 !
!

BrAS:
hostname BrAS
!
interface Loopback0
 ip address 150.0.0.1 255.255.255.255
!
interface Loopback4000
 ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.45.4 255.255.255.0
 duplex full
!
interface ATM1/0
 no ip address
 no atm ilmi-keepalive
!
interface ATM1/0.1 point-to-point
 ip unnumbered Loopback4000
 ip helper-address 150.0.0.50
 atm route-bridged ip
 range pvc 1/32 1/52
  encapsulation aal5snap
 !
!
ip route 0.0.0.0 0.0.0.0 192.168.45.5 name DHCPSrv-GW

DHCPSrv-GW:
hostname DHCPSrv-GW
!
ip dhcp pool DHCP1
   network 192.168.1.0 255.255.255.0
   default-router 192.168.1.1 
!
interface Loopback0
 ip address 150.0.0.50 255.255.255.255
!
interface Loopback9000
 ip address 91.151.112.9 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.45.5 255.255.255.0
 duplex full
!         
ip route 150.0.0.1 255.255.255.255 192.168.45.4 name BrAS
ip route 192.168.1.0 255.255.255.0 192.168.45.4 name CPE
!

Debugs/Outputs:

CPE1#debug dhcp detail 
DHCP client activity debugging is on (detailed)
CPE1#release dhcp ATM1/0.1


*Jan 14 21:18:13.511: DHCP: Release IPL called for interface ATM1/0.1 in state 5
*Jan 14 21:18:13.511: DHCP: SRelease attempt # 1 for entry:
*Jan 14 21:18:13.511: Temp IP addr: 192.168.1.5  for peer on Interface: ATM1/0.1
*Jan 14 21:18:13.511: Temp  sub net mask: 255.255.255.0
*Jan 14 21:18:13.515:    DHCP Lease server: 192.168.1.1, state: 10 Releasing
*Jan 14 21:18:13.515:    DHCP transaction id: 2185
*Jan 14 21:18:13.515:    Lease: 86400 secs,  Renewal: 43200 secs,  Rebind: 75600 secs
*Jan 14 21:18:13.515: Temp default-gateway addr: 192.168.1.1
*Jan 14 21:18:13.519:    Next timer fires after: 00:00:02
*Jan 14 21:18:13.519:    Retry count: 1   Client-ID: aaaa.aaaa.aaaa
*Jan 14 21:18:13.519:    Client-ID hex dump: AAAAAAAAAAAA
*Jan 14 21:18:13.519:    Hostname: CPE1
*Jan 14 21:18:13.519: DHCP: SRelease placed Server ID option: 192.168.1.1
*Jan 14 21:18:13.519: DHCP: SRelease: 259 bytes
*Jan 14 21:18:14.707: DHCP: SRelease attempt # 2 for entry:
*Jan 14 21:18:14.707: Temp IP addr: 192.168.1.5  for peer on Interface: ATM1/0.1
*Jan 14 21:18:14.707: Temp  sub net mask: 255.255.255.0
*Jan 14 21:18:14.707:    DHCP Lease server: 192.168.1.1, state: 10 Releasing
*Jan 14 21:18:14.711:    DHCP transaction id: 2185
*Jan 14 21:18:14.711:    Lease: 86400 secs,  Renewal: 43200 secs,  Rebind: 75600 secs
*Jan 14 21:18:14.711: Temp default-gateway addr: 192.168.1.1
*Jan 14 21:18:14.711:    Next timer fires after: 00:00:02
*Jan 14 21:18:14.711:    Retry count: 2   Client-ID: aaaa.aaaa.aaaa
*Jan 14 21:18:14.711:    Client-ID hex dump: AAAAAAAAAAAA
*Jan 14 21:18:14.711:    Hostname: CPE1
*Jan 14 21:18:14.711: DHCP: SRelease placed Server ID option: 192.168.1.1
*Jan 14 21:18:14.711: DHCP: SRelease: 259 bytes
*Jan 14 21:18:16.707: DHCP: SRelease attempt # 3 for entry:
*Jan 14 21:18:16.707: Temp IP addr: 192.168.1.5  for peer on Interface: ATM1/0.1
*Jan 14 21:18:16.707: Temp  sub net mask: 255.255.255.0
*Jan 14 21:18:16.707:    DHCP Lease server: 192.168.1.1, state: 10 Releasing
*Jan 14 21:18:16.711:    DHCP transaction id: 2185
*Jan 14 21:18:16.711:    Lease: 86400 secs,  Renewal: 43200 secs,  Rebind: 75600 secs
*Jan 14 21:18:16.711: Temp default-gateway addr: 192.168.1.1
*Jan 14 21:18:16.711:    Next timer fires after: 00:00:02
*Jan 14 21:18:16.711:    Retry count: 3   Client-ID: aaaa.aaaa.aaaa
*Jan 14 21:18:16.715:    Client-ID hex dump: AAAAAAAAAAAA
*Jan 14 21:18:16.715:    Hostname: CPE1
*Jan 14 21:18:16.715: DHCP: SRelease placed Server ID option: 192.168.1.1
*Jan 14 21:18:16.719: DHCP: SRelease: 259 bytes
*Jan 14 21:18:18.707: DHCP: Releasing ipl options:
*Jan 14 21:18:18.707:   Clearing default gateway and route to 192.168.1.1
*Jan 14 21:18:18.707:   Removing old default route 192.168.1.1
*Jan 14 21:18:19.095: RAC: DHCP stopped on interface ATM1/0.1
*Jan 14 21:18:49.707: DHCP: QScan: Purging entry
*Jan 14 21:18:49.707: DHCP: deleting entry 67484D00 192.168.1.5 from list
*Jan 14 21:18:49.707: Temp IP addr: 192.168.1.5  for peer on Interface: ATM1/0.1
*Jan 14 21:18:49.707: Temp  sub net mask: 255.255.255.0
*Jan 14 21:18:49.711:    DHCP Lease server: 192.168.1.1, state: 11 Purging
*Jan 14 21:18:49.711:    DHCP transaction id: 2185
*Jan 14 21:18:49.711:    Lease: 86400 secs,  Renewal: 43200 secs,  Rebind: 75600 secs
*Jan 14 21:18:49.711:    No timer running
*Jan 14 21:18:49.711:    Retry count: 0   Client-ID: aaaa.aaaa.aaaa
*Jan 14 21:18:49.711:    Client-ID hex dump: AAAAAAAAAAAA
*Jan 14 21:18:49.715:    Hostname: CPE1



BrAS#debug ip dhcp server packet detail 
DHCP server packet detail debugging is on.
BrAS#
*Jan 14 21:18:14.743: DHCPD: setting giaddr to 192.168.1.1.
*Jan 14 21:18:14.743: DHCPD: adding relay information option.
*Jan 14 21:18:14.747: DHCPD: relay information option content (add/replace):
*Jan 14 21:18:14.747:  DHCPD: 520e020c010100000000000010010029
*Jan 14 21:18:14.747: DHCPD: BOOTREQUEST from 01aa.aaaa.aaaa.aa forwarded to 150.0.0.50.
*Jan 14 21:18:16.755: DHCPD: setting giaddr to 192.168.1.1.
*Jan 14 21:18:16.755: DHCPD: adding relay information option.
*Jan 14 21:18:16.755: DHCPD: relay information option content (add/replace):
*Jan 14 21:18:16.755:  DHCPD: 520e020c010100000000000010010029
*Jan 14 21:18:16.759: DHCPD: BOOTREQUEST from 01aa.aaaa.aaaa.aa forwarded to 150.0.0.50.
BrAS#


DHCPSrv-GW#debug ip dhcp server packet detail
DHCPSrv-GW#
*Jan 14 21:18:14.735: DHCPD: DHCPRELEASE message received from client 01aa.aaaa.aaaa.aa (192.168.1.5).
*Jan 14 21:18:16.743: DHCPD: DHCPRELEASE message received from client 01aa.aaaa.aaaa.aa (192.168.1.5).
*Jan 14 21:18:16.743: DHCPD: Finding a relay for client 01aa.aaaa.aaaa.aa through relay 192.168.1.1.
DHCP server packet detail debugging is on.
DHCPSrv-GW#

CPE1#
CPE1#renew dhcp ATM1/0.1
*Jan 14 21:20:01.251: DHCP: DHCP client process started: 10
*Jan 14 21:20:01.263: RAC: Starting DHCP discover on ATM1/0.1
*Jan 14 21:20:01.263: DHCP: Try 1 to acquire address for ATM1/0.1
*Jan 14 21:20:01.283: DHCP: allocate request
*Jan 14 21:20:01.283: DHCP: new entry. add to queue, interface ATM1/0.1
*Jan 14 21:20:01.283: DHCP: SDiscover attempt # 1 for entry:
*Jan 14 21:20:01.283: Temp IP addr: 0.0.0.0  for peer on Interface: ATM1/0.1
*Jan 14 21:20:01.287: Temp  sub net mask: 0.0.0.0
*Jan 14 21:20:01.287:    DHCP Lease server: 0.0.0.0, state: 3 Selecting
*Jan 14 21:20:01.287:    DHCP transaction id: 100C
*Jan 14 21:20:01.287:    Lease: 0 secs,  Renewal: 0 secs,  Rebind: 0 secs
*Jan 14 21:20:01.287:    Next timer fires after: 00:00:04
*Jan 14 21:20:01.291:    Retry count: 1   Client-ID: aaaa.aaaa.aaaa
*Jan 14 21:20:01.291:    Client-ID hex dump: AAAAAAAAAAAA
*Jan 14 21:20:01.291:    Hostname: CPE1
*Jan 14 21:20:01.295: DHCP: SDiscover: sending 273 byte length DHCP packet
*Jan 14 21:20:01.295: DHCP: SDiscover 273 bytes 
*Jan 14 21:20:01.295:             B'cast on ATM1/0.1 interface from 0.0.0.0
*Jan 14 21:20:03.471: DHCP: Received a BOOTREP pkt
*Jan 14 21:20:03.471: DHCP: Scan: Message type: DHCP Offer
*Jan 14 21:20:03.471: DHCP: Scan: Server ID Option: 192.168.1.1 = C0A80101
*Jan 14 21:20:03.471: DHCP: Scan: Lease Time: 86400
*Jan 14 21:20:03.475: DHCP: Scan: Renewal time: 43200
*Jan 14 21:20:03.475: DHCP: Scan: Rebind time: 75600
*Jan 14 21:20:03.475: DHCP: Scan: Subnet Address Option: 255.255.255.0
*Jan 14 21:20:03.475: DHCP: Scan: Router Option: 192.168.1.1
*Jan 14 21:20:03.475: DHCP: rcvd pkt source: 192.168.1.1,  destination:  255.255.255.255
*Jan 14 21:20:03.479:    UDP  sport: 43,  dport: 44,  length: 308
*Jan 14 21:20:03.479:    DHCP op: 2, htype: 1, hlen: 6, hops: 0
*Jan 14 21:20:03.479:    DHCP server identifier: 192.168.1.1
*Jan 14 21:20:03.479:         xid: 100C, secs: 0, flags: 8000
*Jan 14 21:20:03.479:         client: 0.0.0.0, your: 192.168.1.6
*Jan 14 21:20:03.479:         srvr:   0.0.0.0, gw: 192.168.1.1
*Jan 14 21:20:03.483:         options block length: 60
*Jan 14 21:20:03.483: DHCP Offer Message   Offered Address: 192.168.1.6
*Jan 14 21:20:03.483: DHCP: Lease Seconds: 86400    Renewal secs:  43200    Rebind secs:   75600
*Jan 14 21:20:03.487: DHCP: Server ID Option: 192.168.1.1
*Jan 14 21:20:03.487: DHCP: offer received from 192.168.1.1
*Jan 14 21:20:03.487: DHCP: SRequest attempt # 1 for entry:
*Jan 14 21:20:03.487: Temp IP addr: 192.168.1.6  for peer on Interface: ATM1/0.1
*Jan 14 21:20:03.487: Temp  sub net mask: 255.255.255.0
*Jan 14 21:20:03.491:    DHCP Lease server: 192.168.1.1, state: 4 Requesting
*Jan 14 21:20:03.491:    DHCP transaction id: 100C
*Jan 14 21:20:03.491:    Lease: 86400 secs,  Renewal: 0 secs,  Rebind: 0 secs
*Jan 14 21:20:03.491:    Next timer fires after: 00:00:03
*Jan 14 21:20:03.491:    Retry count: 1   Client-ID: aaaa.aaaa.aaaa
*Jan 14 21:20:03.495:    Client-ID hex dump: AAAAAAAAAAAA
*Jan 14 21:20:03.495:    Hostname: CPE1
*Jan 14 21:20:03.495: DHCP: SRequest- Server ID option: 192.168.1.1
*Jan 14 21:20:03.499: DHCP: SRequest- Requested IP addr option: 192.168.1.6
*Jan 14 21:20:03.499: DHCP: SRequest placed lease len option: 86400
*Jan 14 21:20:03.499: DHCP: SRequest: 291 bytes
*Jan 14 21:20:03.499: DHCP: SRequest: 291 bytes
*Jan 14 21:20:03.499:             B'cast on ATM1/0.1 interface from 0.0.0.0
*Jan 14 21:20:03.623: DHCP: Received a BOOTREP pkt
*Jan 14 21:20:03.627: DHCP: Scan: Message type: DHCP Ack
*Jan 14 21:20:03.627: DHCP: Scan: Server ID Option: 192.168.1.1 = C0A80101
*Jan 14 21:20:03.627: DHCP: Scan: Lease Time: 86400
*Jan 14 21:20:03.627: DHCP: Scan: Renewal time: 43200
*Jan 14 21:20:03.627: DHCP: Scan: Rebind time: 75600
*Jan 14 21:20:03.627: DHCP: Scan: Subnet Address Option: 255.255.255.0
*Jan 14 21:20:03.631: DHCP: Scan: Router Option: 192.168.1.1
*Jan 14 21:20:03.631: DHCP: rcvd pkt source: 192.168.1.1,  destination:  255.255.255.255
*Jan 14 21:20:03.631:    UDP  sport: 43,  dport: 44,  length: 308
*Jan 14 21:20:03.631:    DHCP op: 2, htype: 1, hlen: 6, hops: 0
*Jan 14 21:20:03.631:    DHCP server identifier: 192.168.1.1
*Jan 14 21:20:03.635:         xid: 100C, secs: 0, flags: 8000
*Jan 14 21:20:03.635:         client: 0.0.0.0, your: 192.168.1.6
*Jan 14 21:20:03.635:         srvr:   0.0.0.0, gw: 192.168.1.1
*Jan 14 21:20:03.635:         options block length: 60
*Jan 14 21:20:03.635: DHCP Ack Message
*Jan 14 21:20:03.639: DHCP: Lease Seconds: 86400    Renewal secs:  43200    Rebind secs:   75600
*Jan 14 21:20:03.639: DHCP: Server ID Option: 192.168.1.1
*Jan 14 21:20:06.659: DHCP: Releasing ipl options:
*Jan 14 21:20:06.659: DHCP: Applying DHCP options:
*Jan 14 21:20:06.659:   Setting default_gateway to 192.168.1.1
*Jan 14 21:20:06.663:   Adding default route 192.168.1.1
*Jan 14 21:20:06.719: Allocated IP address = 192.168.1.6  255.255.255.0
*Jan 14 21:20:06.719: %DHCP-6-ADDRESS_ASSIGN: Interface ATM1/0.1 assigned DHCP address 192.168.1.6, mask 255.255.255.0, hostname CPE1
*Jan 14 21:20:07.663: DHCP Client Pooling: ***Allocated IP address: 192.168.1.6

BrAS#
*Jan 14 21:20:01.447: DHCPD: relay binding created for client 01aa.aaaa.aaaa.aa.
*Jan 14 21:20:01.447: DHCPD: setting giaddr to 192.168.1.1.
*Jan 14 21:20:01.447: DHCPD: adding relay information option.
*Jan 14 21:20:01.447: DHCPD: relay information option content (add/replace):
*Jan 14 21:20:01.451:  DHCPD: 520e020c010100000000000010010029
*Jan 14 21:20:01.451: DHCPD: BOOTREQUEST from 01aa.aaaa.aaaa.aa forwarded to 150.0.0.50.
*Jan 14 21:20:03.479: DHCPD: forwarding BOOTREPLY to client aaaa.aaaa.aaaa.
*Jan 14 21:20:03.483: DHCPD: Setting giaddr to 192.168.1.1
*Jan 14 21:20:03.483: DHCPD: validating relay information option.
*Jan 14 21:20:03.483: DHCPD: relay information option removed
*Jan 14 21:20:03.483:  outbound IF index  = 4
*Jan 14 21:20:03.487:  outbound IF sub-index = 10
*Jan 14 21:20:03.487: DHCPD: Keeping state: Forwarding BOOTREPLY to client aaaa.aaaa.aaaa, on UNNUM-IF
*Jan 14 21:20:03.559: DHCPD: Finding a relay for client 01aa.aaaa.aaaa.aa on interface ATM1/0.10.
*Jan 14 21:20:03.559: DHCPD: setting giaddr to 192.168.1.1.
*Jan 14 21:20:03.559: DHCPD: adding relay information option.
*Jan 14 21:20:03.559: DHCPD: relay information option content (add/replace):
*Jan 14 21:20:03.559:  DHCPD: 520e020c010100000000000010010029
*Jan 14 21:20:03.563: DHCPD: BOOTREQUEST from 01aa.aaaa.aaaa.aa forwarded to 150.0.0.50.
*Jan 14 21:20:03.619: DHCPD: forwarding BOOTREPLY to client aaaa.aaaa.aaaa.
*Jan 14 21:20:03.619: DHCPD: Setting giaddr to 192.168.1.1
*Jan 14 21:20:03.623: DHCPD: validating relay information option.
*Jan 14 21:20:03.627: DHCPD: relay information option removed
*Jan 14 21:20:03.627:  outbound IF index  = 4
*Jan 14 21:20:03.627:  outbound IF sub-index = 10
*Jan 14 21:20:03.627: DHCPD: Keeping state: Forwarding BOOTREPLY to client aaaa.aaaa.aaaa, on UNNUM-IF

DHCPSrv-GW#
*Jan 14 21:20:01.439: DHCPD: DHCPDISCOVER received from client 01aa.aaaa.aaaa.aa through relay 192.168.1.1.
*Jan 14 21:20:01.443: DHCPD: Allocate an address without class information (192.168.1.0)
*Jan 14 21:20:03.443: DHCPD: Sending DHCPOFFER to client 01aa.aaaa.aaaa.aa (192.168.1.6).
*Jan 14 21:20:03.443: DHCPD: unicasting BOOTREPLY for client aaaa.aaaa.aaaa to relay 192.168.1.1.
*Jan 14 21:20:03.579: DHCPD: DHCPREQUEST received from client 01aa.aaaa.aaaa.aa.
*Jan 14 21:20:03.583: DHCPD: No default domain to append - abort update
*Jan 14 21:20:03.583: DHCPD: Sending DHCPACK to client 01aa.aaaa.aaaa.aa (192.168.1.6).
*Jan 14 21:20:03.583: DHCPD: unicasting BOOTREPLY for client aaaa.aaaa.aaaa to relay 192.168.1.1.
DHCPSrv-GW#

More:
http://blog.ine.com/2009/07/22/understanding-dhcp-option-82/
http://www.cisco.com/en/US/docs/ios/12_4t/ip_addr/configuration/guide/htdhcpre.html
http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gdhcpopt.html
http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gtdhcprr.html
http://www.cisco.com/en/US/docs/ios/12_4t/ip_addr/configuration/guide/htdhcpre.html

NTP - ACL

NTP - Network Time Protocol Packet types: -  Control messages : don't bother with this. -  NTP request/update messages: used for time sy...