Manual:IPv6/DHCP Server: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
Line 73: Line 73:
}}
}}


 
{{Mr-arg-table
|arg=binding-script
|type=string
|default=
|desc=Script that will be executed after binding is assigned or de-assigned. Internal "global" variables that can be used in the script:
* <var>bindingBound</var> - set to "1" if bound, otherwise set to "0"
* <var>bindingServerName</var> -  dhcp server name
* <var>bindingDUID</var> -  DUID
* <var>bindingAddress</var> -  active address
* <var>bindingPrefix</var> -  active prefix
}}


{{Mr-arg-table
{{Mr-arg-table

Revision as of 12:37, 15 April 2014

Applies to RouterOS: v5.9+


Summary

Standards: RFC 3315, RFC 3633
Package: dhcp,ipv6

Starting from v5.9 DHCPv6 server is moved to /ipv6 sub menu

Single DUID is used for client and server identification, only IAID will vary between cients corresponding to their assigned interface.

Client binding creates dynamic pool with timeout set to binding's expiration time (note that now dynamic pools can have a timeout), which will be updated every time binding gets renewed.

When client is bound to prefix, DHCP server adds routing information to know how to reach assigned prefix.

Client bindings in server does not show MAC address anymore (as it was in v5.8), DUID (hex) and IAID are used instead. After upgrade MAC addresses will be converted to DUIDs automatically, but due to unknown DUID type and unknown IAID, they should be further updated by user;

General

Sub-menu: /ipv6 dhcp-server

This sub menu lists and allows to configure DHCPv6 servers.

Properties

Property Description
authoritative (after-10sec-delay | after-2sec-delay | yes | no; Default: after-2sec-delay) Whether the DHCP server is the only one DHCP server for the network:
  • after-10sec-delay - to clients request for an address, dhcp server will wait 10 seconds and if there is another request from the client after this period of time, then dhcp server will offer the address to the client or will send DHCPNAK, if the requested address is not available from this server
  • after-2sec-delay - to clients request for an address, dhcp server will wait 2 seconds and if there is another request from the client after this period of time, then dhcp server will offer the address to the client or will send DHCPNAK, if the requested address is not available from this server
  • yes - to clients request for an address that is not available from this server, dhcp server will send negative acknowledgment (DHCPNAK)
  • no - dhcp server ignores clients requests for addresses that are not available from this server
delay-threshold (time | none; Default: none) If secs field in DHCP packet is smaller than delay-threshold, then this packet is ignored. If set to none - there is no threshold (all DHCP packets are processed)
disabled (yes | no; Default: no) Whether DHCPv6 server participate in prefix assignment process.
lease-time (time; Default: 3d) The time that a client may use the assigned address. The client will try to renew this address after a half of this time and will request a new address after time limit expires.
address-pool (string | static-only; Default: static-only) IPv6 pool, from which to take IPv6 prefix for the clients. If set to static-only, then only the clients that have a static binding (added in bindings submenu) will be allowed.
binding-script (string; Default: ) Script that will be executed after binding is assigned or de-assigned. Internal "global" variables that can be used in the script:
  • bindingBound - set to "1" if bound, otherwise set to "0"
  • bindingServerName - dhcp server name
  • bindingDUID - DUID
  • bindingAddress - active address
  • bindingPrefix - active prefix
interface (string; Default: ) Interface on which server will be running.
name (string; Default: ) Reference name


Read-only Properties

Property Description
dynamic (yes | no)
invalid (yes | no)

Bindings

Sub-menu: /ipv6 dhcp-server binding


DUID is used only for dynamic bindings, so if it changes then client will receive different prefix than previously.


Property Description
address (IPv6 prefix; Default: ) IPv6 prefix that will be assigned to the client
comment (string; Default: ) Short description of an item.
disabled (yes | no; Default: no) Whether item is disabled
life-time (time; Default: 3d) Time period after which binding expires/
duid (string; Default: ) DUID value. Should be specified only in hexadecimal format.
iaid (integer [0..4294967295]; Default: )
server (string | all; Default: all) Name of the server. If set to all, then binding applies to all created DHCPv6 servers.


Read-only properties

Property Description
dynamic (yes | no) Whether item is dynamically created.
expires-after (time) Time period after which binding expires.
last-seen (time) Time period since client was last seen.
status (waiting | offered | bound) Three status vales are possible:
  • waiting - Shown for static bindings if it is not used. For dynamic bindings this status is shown if it was used previously, server will wait 10 minutes to allow old client to get this binding, otherwise binding will be cleared and prefix willbe offered to other clients.
  • offered - if solicit message was received, and server responded with advertise message, but request was not received. During this state client have 2 minutes to get this binding, otherwise it is freed or changed status to waiting for static bindings.
  • bound - currently bound.


For example, dynamically assigned /62 prefix

[admin@RB493G] /ipv6 dhcp-server binding> print detail 
Flags: X - disabled, D - dynamic 
 0 D address=2a02:610:7501:ff00::/62 duid="1605fcb400241d1781f7" iaid=0 
     server=local-dhcp life-time=3d status=bound expires-after=2d23h40m10s 
     last-seen=19m50s 

 1 D address=2a02:610:7501:ff04::/62 duid="0019d1393535" iaid=2 
     server=local-dhcp life-time=3d status=bound expires-after=2d23h43m47s 
     last-seen=16m13s 


Menu specific commands

Property Description
make-static () Set dynamic binding as static.

Configuration Examples

Enabling IPv6 Prefix delegation

Lets consider that we already have running DHCP server.

To enable IPv6 prefix delegation, first we need to create address pool

/ipv6 pool add name=myPool prefix=2001:db8:7501::/60  prefix-length=62

Notice that prefix-length is 62 bits, it means that clients will receive /62 prefixes from the /60 pool.

Next step is to enable DHCPv6.

/ipv6 dhcp-server add name=myServer address-pool=myPool interface=local


To test our server we will set up wide-dhcpv6 on ubuntu machine:

  • install wide-dhcpv6-client
  • edit "/etc/wide-dhcpv6/dhcp6c.conf" as above

Note: You can use also RouterOS as DHCPv6-PD client. Read more >>



interface eth2{
  send ia-pd 0;
};

id-assoc pd {
   prefix-interface eth3{
   sla-id 1;
   sla-len 2;
   };
};

  • Run DHCPv6 client
sudo dhcp6c -d -D -f eth2
  • Verify that prefix was added to eth3
mrz@bumba:/media/aaa$ ip -6 addr
..
2: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 2001:db8:7501:1:200:ff:fe00:0/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::224:1dff:fe17:81f7/64 scope link 
       valid_lft forever preferred_lft forever
  • You can make binding to specific client static, so that it always receives the same prefix
[admin@RB493G] /ipv6 dhcp-server binding> print 
Flags: X - disabled, D - dynamic 
 #   ADDRESS                                        DU       IAID SER.. STATUS 
 0 D 2001:db8:7501:1::/62                      16          0 loc.. bound 
[admin@RB493G] /ipv6 dhcp-server binding> make-static 0

  • DHCPv6 also installs route to assigned prefix into IPv6 routing table
[admin@RB493G] /ipv6 route> print 
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, o - ospf, b - bgp, U - unreachable 
 #      DST-ADDRESS              GATEWAY                  DISTANCE
...
 2 ADS  2001:db8:7501:1::/62     fe80::224:1dff:fe17:8...        1


[ Top | Back to Content ]