DHCP settings EcoRouter Documentation / DHCP settings
Dynamic Host Configuration Protocol (DHCP) is a protocol which allows devices to get IP-address and other parameters needed to operate in TCP-IP network dynamically. The client-computer during network device configuring connects to the DHCP-server and gets the needed parameters from it.
The IP address is allocated to the client for a certain period of time (i.e. lease time). The parameters of lease time are determined by the settings of the DHCP server.
DHCP-server is a server which supplies the TCP/IP configuration parameters.
DHCP-client is a device which requests the TCP/IP configuration parameters.
DHCP-relay agent is an intermediator between client and server. DHCP-relay agent is used in case the client can not access to server directly, in particular if server and client do not reside on the same IP network.
The EcoRouter supports 2 relay modes: DHCP-relay and DHCP-relay-proxy. See the features of these modes in the table below.
Action or event | Action of EcoRouter in DHCP-relay mode | Action of EcoRouter in DHCP-relay-proxy mode |
---|---|---|
Client sent the DISCOVER broadcast message | EcoRouter redirects the DISCOVER multicast message | EcoRouter intercepts the DISCOVER broadcast message, adds client's mac-address and VLAN into DHCP-table, and redirects the DISCOVER message in the unicast form |
DHCP-servers sent the OFFER messages | EcoRouter redirects the OFFER messages from all DHCP-servers responded to client | In the OFFER message EcoRouter replaces the first answered server's address by its own, adds the assigned IP-address and lease start time into the table, and ignores all the rest OFFER messages |
Client sent the REQUEST message | EcoRouter redirects the broadcast REQUEST message | EcoRouter replaces client's IP-addres by its own and redirects the REQUEST message to the DHCP-server selected by client |
DHCP-server sent the ACK message to mac-address specified in the REQUEST message | EcoRouter redirects the ACK message to the client | EcoRouter redirects the ACK message to the client |
The time has come to send the request for refrershing leased address (RENEWING) (depends on DHCP-server settings) | EcoRouter redirects the REQUEST message from client to DHCP-server with a request to prolongate the lease period | EcoRouter on its own sends the REQUEST message to DHCP-server with a request to prolongate the lease period. EcoRouter keeps the information of the time of last getting request for refrershing leased address from client and the time of last getting packet acknoledgement from server |
The time has come to send the request for refreshing configuration (REBINDING) (depends on DHCP-server settings) | EcoRouter redirects the REQUEST broadcast message with a current client's IP-address | EcoRouter on its own sends the REQUEST broadcast message with its own IP-address |
In case the 82 option is enabled in DHCP-relay mode it will be added to the request (the 82 option is descripted below).
The 82 option is the DHCP protocol option. It is used to send various information to DHCP-server and to protect the DHCP-server from attacks via the DHCP-protocol. The 82 option is not mandatory for use.
Command summary
Command | Description |
---|---|
ecorouter(config)#dhcp-profile VALUE | Create DHCP-profile, where VALUE is arbitrary expression |
ecorouter(config-dhcp)#description LINE | Edit DHCP-profile description, where LINE is arbitrary expression. Optional command |
ecorouter(config-dhcp)#mode proxy | Enable DHCP-proxy mode of EcoRouter. Mode specifying is mandatory |
ecorouter(config-dhcp)#mode relay | Enable DHCP-relay mode of EcoRouter. Mode specifying is mandatory |
ecorouter(config-dhcp)#server IP-address | Specify DHCP-server's IP. Specifying this IP is mandatory |
ecorouter(config-dhcp)#server IP-address lease VALUE | Specify DHCP-server's IP, where VALUE is client IP-address lease period in seconds. Default value is 3600. Valid onliy in DHCP-proxy mode |
ecorouter(config-dhcp)#information-option circuit-id LINE | Send additional information to DHCP-server option. See more in Section 3. Optional command |
ecorouter(config-dhcp)#information-option install | Forced information option set up. Optional command |
ecorouter(config-dhcp)#information-option remote-id LINE | Send client's mac-address to DHCP-server option. Optional command |
ecorouter(config-dhcp)#information-option rewrite | Information option rewrite. If the circuit-id and remote-id are not specified on the router, the option will be removed from the packet. Optional command |
ecorouter(config-if)#dhcp-profile VALUE | Bind created profile to interface, where VALUE is profile number |
Basic configuration
Step 1: Create interface for binding DHCP-relay agent profile and IP-address assigning.
ecorouter(config)#interface dhcp1ecorouter(config-if)#ip add 10.10.10.10/30
Step 2. Create DHCP-profile.
ecorouter(config)#dhcp-profile 0
The DHCP-profile is necessary for flexible address assigning in different network segments. One interface can be binded only to one profile, but one profile can be binded to several interfaces. The total number of profiles is unlimited.
Step 3. Specify DGCP-server address.
ecorouter(config-dhcp)#server 170.200.10.10
One profile can contain up to 8 servers.
Step 4. Specify EcoRouter mode.
ecorouter(config-dhcp)#mode relay
There's no difference in DHCP-relay and DHCP-relay-proxy configuring. The mode should be selected in accordance to equipment performance and tasks to be performed.
Step 5. Enabling the 82 option.
ecorouter(config-dhcp)#information-option circuit-id Router: %{port}/ client: %{cmac}/%{svlan}.%{cvlan}
ecorouter(config-dhcp)#information-option remote-id Router: %{hname}/%{vr}
Parameter | Description |
---|---|
cmac | Client mac-address |
cvlan | Client VLAN |
hname | Router hostname which sends packet to DHCP-server |
port | Port number where the request came from |
svlan | Service VLAN'a |
vr | Virtual router identifier |
Based on the data listed in the table, the DHCP-server decides whether to issue settings or not and can determine from which address pool address will be issued.
Instead of this the arbitrary string can be used, for example:
ecorouter(config-dhcp)#information-option circuit-id randomstring
It should be specified on the server. If the strings are successfully compared, the server will make a positive decision about issuing the address.
Both arbitrary string and parameters can be specified in the same time, for example:
ecorouter(config-dhcp)#information-option circuit-id Router: %{port}/ client: %{cmac}/%{svlan}
ecorouter(config-dhcp)#information-option remote-id randomstring
The remote-id can be specified only with the circuit-id setting.
Step 6. Binding created profile to interface.
ecorouter(config)# interface dhcp1
ecorouter(config-if)#dhcp-profile 0
DHCP Status View Commands
The show dhcp-profile command displays list of all existing DHCP-profiles and their parameters:
ecorouter#show
dhcp-profile
DHCP profile 0 is in relay mode
Relay information option (82) is on
Circuit-ID: randomstring
DHCP profile 2 is in proxy mode
Relay information option (82) is on
Circuit-ID: 78
Server 1.1.1.1
Server 4.4.4.4
Server 4.4.4.5
Server 4.4.4.6
Server 4.4.4.7
DHCP profile 3 is in relay mode
Relay information option (82) is on
Circuit-ID: Router: %{hname}, client: %{cmac}/%{svlan}.%{cvlan}
To display certain profile its number should be specified in the command.
show dhcp-profile 0
DHCP profile 0 is in relay mode
Relay information option (82) is off
The show interface dhcp clients <NAME> command is valid only in DHCP-relay-proxy mode, where <NAME> is interface name which is DHCP-profile binded to.
This command displays table containing all DHCP-clients list. The table contains clients IP-addresses, mac-addresses, DHCP-server address, ackreditation time, lease time.
ecorouter#sh interface dhcp clients demux.0
IP Address MAC Address DHCP Server ACK Time Lease Time
---------------------------------------------------------------------
192.168.1.3 c403.130f.0000 20.0.0.1 296 86400