Monday 2 July 2012

DHCP Relay Forward the Packet to Server on which Ports ( DHCP Relay uses which ports number to communicate with server and client

DHCP Relay is defined in  RFC 3046 : http://tools.ietf.org/html/rfc3046
DHCP is defined in RFC 2131 : http://tools.ietf.org/html/rfc2131
What ports DHCP relay uses to communicates with Server ?
As such in RFC 3046 there is no mention of ports, but there is another draft
Which says :
======================================================
4.7.2 Relay Agent Port Usage
    
        Relay agents should use port 67 as the source port number.  Relay
        agents always listen on port 67, but port 68 has sometimes been used
        as the source port number probably because it was copied from the
        source port of the incoming packet.
    
        Cable modem vendors would like to install filters blocking outgoing
        packets with source port 67.
    
        RECOMMENDATIONS:
    
        O  Relay agents MUST use 67 as their source port number.
    
        O  Relay agents MUST NOT forward packets with non-zero giaddr
           unless the source port number on the packet is 67.
==============================================
So DHCP relay set source port as 67, what about destination port ?
and RFC 2131 says :
==============================================
DHCP uses UDP as its transport protocol.  DHCP messages from a client
   to a server are sent to the 'DHCP server' port (67), and DHCP
   messages from a server to a client are sent to the 'DHCP client' port
   (68). A server with multiple network address (e.g., a multi-homed
   host) MAY use any of its network addresses in outgoing DHCP messages
===============================================
So to send the DHCPDISCOVER packet to the server the relay has to send on port "67" only so that server will receive it.
So for both source and destination ports for DHCP RELAY the ports used are "67"
But ok see this :
this has a option to set the port which says that:
====================================================
-p port :
The UDP receiving port that dhcprelay will listen to. By default, dhcprelay listens for datagrams on port 67 or as specified in /etc/services. The port dhcprelay transmits on is the one with the next highest number (e.g. if dhcprelay receives on port 67, it transmits on port 68). This option is mostly used for debugging purposes.
===================================================
I am not sure how the server will listen on port 68.
Another one :
In this product we can modify and give the port for DHCP relay to send and listen to by default it is mentioned as port 67 only.
Our own Linux as DHCP relay (ISC- IPV4)  uses port 67 as both source and destination.
Let me know your device as DHCP relay uses which port numbers?