Showing posts with label DHCP. Show all posts
Showing posts with label DHCP. Show all posts

Wednesday, March 11, 2015

DHCP Proxy

DHCP Proxy is an address allocation solution for PPP. When a client requests an IP address via IPCP, the server may issue a DHCP request (act as a proxy) using its own IP address on the PPP interface as the “giaddr” field.




R1
ip dhcp pool DHCP
   network 10.1.23.0 255.255.255.0

R2
interface Serial1/0
 ip address 10.1.23.2 255.255.255.0
 encapsulation ppp
 peer default ip address dhcp
 serial restart-delay 0
!
ip dhcp-server 10.1.12.1
ip address-pool dhcp-proxy-client

R3
interface Serial1/0
 ip address negotiated
 encapsulation ppp
 no peer neighbor-route
 serial restart-delay 0
 !

DHCP on-deman pool

ODAP allows importing DHCP settings using various methods, one of them being IPCP (Internet Protocol Control Protocol for PPP). IPCP allows importing an IP address along with the subnet mask (while PPP ignores the mask, DHCP can use it) as well as DNS/WINS servers. This is useful in PPPoE deployments,
such as with DSL, where the DSL CPE router gets an address assignmentthrough DHCP from the provider, and forwards options such as DNS to the clients behind the CPE.To verify this check the DHCP pool settings and verify the imported parameters


R2 - R3 encapsulation PPP. Config f0/0 R3 nhan dia chi ipaddress tu R2.

R2:
interface Serial1/0
 ip address 10.1.23.2 255.255.255.0
 encapsulation ppp
 no peer neighbor-route
 peer default ip address 10.1.23.3
 ppp ipcp mask 255.255.255.0
R3:
interface Serial1/0
 ip address negotiated
 encapsulation ppp
 no peer neighbor-route
 ppp ipcp mask request

When R3 receives RIP updates from R2 they are discarded because they are on different networks. This is due to the fact that R3 uses the host route 10.1.23.3/32, and R2 is outside this range. To resolve this R3 must disable the update source validation feature. Additionally the peer-neighbor-route feature is disabled so that R3 does not inject R2’s IP address as a host route into the routing domain.

Hoac

R3#show run | se router rip
router rip
 version 2
 no validate-update-source
 network 0.0.0.0

 no auto-summary

DHCP Host Pool



Cau hinh DHCP server R1:
ip dhcp pool DHCP
   network 10.1.12.0 255.255.255.0
!

De gan dia chi interface 0/0 R2 la 10.1.12.5 thuc hien nhu sau.
R2#show int f0/0
FastEthernet0/0 is up, line protocol is up
  Hardware is i82543 (Livengood), address is ca01.1018.0008 (bia ca01.1018.0008)

ca01.1018.0008 chuyen dia chi mac dinh dang cisco. Them bit 01 vao phia truoc 01ca.0110.1800.08

Tren R1 cau hinh pool DHCP_R2


R1:
ip dhcp pool DHCP_R2
   host 10.1.12.5 255.255.255.0                      //cap host dia chi nay qua DHCP voi clent-id co mac 01ca.0110.1800.08
   client-identifier 01ca.0110.1800.08
!

R2:
interface FastEthernet0/0
 ip address dhcp client-id FastEthernet0/0
 !
End


Debug dhcp detail
Sep  4 14:43:39.303: DHCP: Received a BOOTREP pkt
*Sep  4 14:43:39.303: DHCP: offer received from 10.1.12.1
*Sep  4 14:43:39.303: DHCP: SRequest attempt # 1 for entry:
*Sep  4 14:43:39.303: DHCP: SRequest- Server ID option: 10.1.12.1
*Sep  4 14:43:39.303: DHCP: SRequest- Requested IP addr option: 10.1.12.5
*Sep  4 14:43:39.307: DHCP: SRequest: 283 bytes
*Sep  4 14:43:39.307: DHCP: SRequest: 283 bytes
*Sep  4 14:43:39.307:             B'cast on FastEthernet0/0 interface from 0.0.0.0
*Sep  4 14:43:39.439: DHCP: Received a BOOTREP pkt
R2#
*Sep  4 14:43:41.187: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Sep  4 14:43:42.187: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
*Sep  4 14:43:42.471: DHCP: Sending notification of ASSIGNMENT:
*Sep  4 14:43:42.471:   Address 10.1.12.5 mask 255.255.255.0
*Sep  4 14:43:42.475: DHCP Client Pooling: ***Allocated IP address: 10.1.12.5
*Sep  4 14:43:42.491: Allocated IP address = 10.1.12.5  255.255.255.0

R2#

*Sep  4 14:43:42.491: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 10.1.12.5, mask 255.255.255.0, hostname R2

DHCP configure

Config DHCP server:
#ip dhcp excluded-address 155.1.146.100 155.1.146.254
#ip dhcp pool DHCP
   #network 155.1.146.0 255.255.255.0
   #default-router 155.1.146.4 155.1.146.6                                     //config 2 default-gateway for redurancy
   #dns-server 155.1.146.4 155.1.146.6
   #lease 0 12


Note: khi cau hinh DHCP, nen cau hinh dhcp exclude truoc dhcp pool, neu khong dai ip trong exclude van se duoc su dung, neu co client nao do request som hon khi exclude apply.

Khi su dung access-list: chu y permit UPD host 0.0.0.0 {ip server} nhăm tranh filter các gói tin discover
And ack

Config DHCP client:
#interface Ethernet0/0
  #ip address dhcp client-id Ethernet0/0



Debug dhcp deital:

  • Gui goi tin DHCP discover tu client, voi source ip add 0.0.0.0 , mac interface e0/0.

DHCP: DHCP client process started: 10
RAC: Starting DHCP discover on Ethernet0/0
DHCP: Try 1 to acquire address for Ethernet0/0
DHCP: allocate request
DHCP: new entry. add to queue, interface Ethernet0/0
DHCP: Client socket is opened
DHCP: SDiscover attempt # 1 for entry:
Temp IP addr: 0.0.0.0  for peer on Interface: Ethernet0/0
Temp  sub net mask: 0.0.0.0
   DHCP Lease server: 0.0.0.0, state: 3 Selecting
   DHCP transaction id: 131F
   Lease: 0 secs,  Renewal: 0 secs,  Rebind: 0 secs
   Next timer fires after: 00:00:04
   Retry count: 1   Client-ID: aabb.cc00.0100
   Client-ID hex dump: AABBCC000100
   Hostname: Rack1R1
DHCP: SDiscover: sending 276 byte length DHCP packet
DHCP: SDiscover 276 bytes
            B'cast on Ethernet0/0 interface from 0.0.0.0


  • Server gui goi tin DHCP offer voi thong tin pool DHCP ma no co, voi soure 155.1.146.6 va dest 255.255.255.255

DHCP: Received a BOOTREP pkt
DHCP: Scan: Message type: DHCP Offer
DHCP: Scan: Server ID Option: 155.1.146.6 = 9B019206
DHCP: Scan: Lease Time: 43200
DHCP: Scan: Renewal time: 21600
DHCP: Scan: Rebind time: 37800
DHCP: Scan: Subnet Address Option: 255.255.255.0
DHCP: Scan: Router Option: 155.1.146.4, 155.1.146.6
DHCP: Scan: DNS Name Server Option: 155.1.146.4, 155.1.146.6
DHCP: rcvd pkt source: 155.1.146.6,  destination:  255.255.255.255
   UDP  sport: 43,  dport: 44,  length: 308
   DHCP op: 2, htype: 1, hlen: 6, hops: 0
   DHCP server identifier: 155.1.146.6
        xid: 131F, secs: 0, flags: 8000
        client: 0.0.0.0, your: 155.1.146.3
        srvr:   0.0.0.0, gw: 0.0.0.0
        options block length: 60

DHCP Offer Message   Offered Address: 155.1.146.3
DHCP: Lease Seconds: 43200    Renewal secs:  21600    Rebind secs:   37800
DHCP: Server ID Option: 155.1.146.6
DHCP: offer received from 155.1.146.6

  • Client gui goi tin request yeu cau cap dia chi ip toi server ma no duoc offer, voi source

DHCP: SRequest attempt # 1 for entry:
Temp IP addr: 155.1.146.3  for peer on Interface: Ethernet0/0
Temp  sub net mask: 255.255.255.0
   DHCP Lease server: 155.1.146.6, state: 4 Requesting
   DHCP transaction id: 131F
   Lease: 43200 secs,  Renewal: 0 secs,  Rebind: 0 secs
   Next timer fires after: 00:00:03
   Retry count: 1   Client-ID: aabb.cc00.0100
   Client-ID hex dump: AABBCC000100
   Hostname: Rack1R1
DHCP: SRequest- Server ID option: 155.1.146.6
DHCP: SRequest- Requested IP addr option: 155.1.146.3
DHCP: SRequest: 288 bytes
DHCP: SRequest: 288 bytes
            B'cast on Ethernet0/0 interface from 0.0.0.0
DHCP: Received a BOOTREP pkt
DHCP: Scan: Message type: DHCP Ack
DHCP: Scan: Server ID Option: 155.1.146.6 = 9B019206
DHCP: Scan: Lease Time: 43200
DHCP: Scan: Renewal time: 21600
DHCP: Scan: Rebind time: 37800
DHCP: Scan: Subnet Address Option: 255.255.255.0
DHCP: Scan: Router Option: 155.1.146.4, 155.1.146.6
DHCP: Scan: DNS Name Server Option: 155.1.146.4, 155.1.146.6
DHCP: rcvd pkt source: 155.1.146.6,  destination:  255.255.255.255
   UDP  sport: 43,  dport: 44,  length: 308
   DHCP op: 2, htype: 1, hlen: 6, hops: 0
   DHCP server identifier: 155.1.146.6
        xid: 131F, secs: 0, flags: 8000
        client: 0.0.0.0, your: 155.1.146.3
        srvr:   0.0.0.0, gw: 0.0.0.0
        options block length: 60


  • Client nhan ACK tu server, qua trinh nhan dia chi ip tu DHCP hoan thanh.

DHCP Ack Message
DHCP: Lease Seconds: 43200    Renewal secs:  21600    Rebind secs:   37800
DHCP: Server ID Option: 155.1.146.6
DHCP: Releasing ipl options:
DHCP: Applying DHCP options:
  Setting default_gateway to 155.1.146.4
  Adding default route 155.1.146.4
  Adding DNS server address 155.1.146.4
  Adding DNS server address 155.1.146.6
DHCP: Sending notification of ASSIGNMENT:
  Address 155.1.146.3 mask 255.255.255.0
DHCP Client Pooling: ***Allocated IP address: 155.1.146.3
Allocated IP address = 155.1.146.3  255.255.255.0

%DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/0 assigned DHCP address 155.1.146.3, mask 255.255.255.0, hostname Rack1R1


Neu muon e0/0 nhan dhcp voi IP 155.1.146.1
Tren R6 ta config nhu sau: