Manual:IPv6/DHCP Client: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
Line 43: Line 43:
|desc=Description
|desc=Description
}}
}}
{{Mr-arg-table
|arg=add-default-route
|type=yes {{!}} no
|default=no
|desc=Whether to add default IPv6 route after client connects.
}}


{{Mr-arg-table
{{Mr-arg-table
Line 78: Line 86:
|desc=Prefix length parameter that will be set for [[M:IPv6/Pool | IPv6 pool]] in which received IPv6 prefix is added. Prefix length must be greater than the length of received prefix, otherwise prefix-length will be set to received prefix length + 8 bits.
|desc=Prefix length parameter that will be set for [[M:IPv6/Pool | IPv6 pool]] in which received IPv6 prefix is added. Prefix length must be greater than the length of received prefix, otherwise prefix-length will be set to received prefix length + 8 bits.
}}
}}


==Status==
==Status==

Revision as of 12:40, 4 October 2012

Applies to RouterOS: v5.9 +

Summary

Currently DHCPv6 client can receive only delegated prefix from DHCPv6-PD server.

Quick setup example

This simple example demonstrates how to enable dhcp client to receive IPv6 prefix and add it to the pool.

/ipv6 dhcp-client add pool-name=test-ipv6 pool-prefix-length=64 interface=ether13


Detailed print should show status of the client and we can verify if prefix is received

[admin@x86-test] /ipv6 dhcp-client> print detail 
Flags: D - dynamic, X - disabled, I - invalid 
 0    interface=bypass pool-name="test-ipv6" pool-prefix-length=64 status=bound 
      prefix=2001:db8:7501:ff04::/62  expires-after=2d23h11m53s 

Notice that server gave us prefix 2a02:610:7501:ff04::/62 . And it should be also added to ipv6 pools

[admin@MikroTik] /ipv6 pool> print 
Flags: D - dynamic 
 #   NAME                         PREFIX                                      PREFIX-LENGTH
 0 D test-ipv6                    2001:db8:7501:ff04::/62                                64

It works! Now you can use this pool, for example, for pppoe clients.

Properties

Sub-menu: /ipv6 dhcp-client


Property Description
add-default-route (yes | no; Default: no) Whether to add default IPv6 route after client connects.
comment (string; Default: ) Short description of the client
disabled (yes | no; Default: no)
interface (string; Default: ) Interface on which DHCPv6 client will be running.
pool-name (string; Default: ) Name of the IPv6 pool in which received IPv6 prefix will be added
pool-prefix-length (string; Default: ) Prefix length parameter that will be set for IPv6 pool in which received IPv6 prefix is added. Prefix length must be greater than the length of received prefix, otherwise prefix-length will be set to received prefix length + 8 bits.

Status

Command /ipv6 dhcp-client print detail will show current status of dhcp client and read-only properties listed in table below:

Property Description
dynamic (yes | no)
expires-after (time) Time when the IPv6 prefix expires (specified by the DHCPv6 server).
invalid (yes | no) Shows whether configuration is invalid.
prefix (IPv6 prefix) Shows received IPv6 prefix from DHCPv6-PD server
status (stopped | searching | requesting... | bound | renewing | rebinding | error | stopping) Shows the status of DHCPv6 Client:
  • stopped - dhcpv6 client is stopped
  • searching - sending "solicit" and trying to get "advertise"
  • requesting - sent "request" waiting for "reply"
  • bound - received "reply". Prefix assigned.
  • renewing - sent "renew", waiting for "reply"
  • rebinding - sent "rebind", waiting for "reply"
  • error - reply was not received in time or some other error ocurred.
  • stopping - sent "release"


Menu specific commands

Property Description
release (numbers) Release current binding and restart DHCPv6 client
renew (numbers) Renew current leases. If the renew operation was not successful, client tries to reinitialize lease (i.e. it starts lease request procedure (rebind) as if it had not received an IP address yet)


Application Examples

Use received prefix for local RA

Consider following setup:

  • ISP is routing prefix 2001:DB8::/62 to the router R1
  • Router R1 runs DHCPv6 server to delegate /64 prefixes to the customer routers CE1 CE2
  • DHCP client on routers CE1 and CE2 receives delegated /64 prefix from the DHCP server (R1).
  • Client routers uses received prefix to set up RA on the local interface


Configuration


R1

/ipv6 route 
add gateway=fe80::1:1%to-ISP

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

/ipv6 dhcp-server
add address-pool=myPool disabled=no interface=to-CE-routers lease-time=3m name=server1


CE1

/ipv6 dhcp-client
add interface=to-R1 pool-name=my-ipv6

/ipv6 address
add address=::1/64 from-pool=my-ipv6 interface=to-clients advertise=yes


CE2

/ipv6 dhcp-client
add interface=to-R1 pool-name=my-ipv6

/ipv6 address
add address=::1/64 from-pool=my-ipv6 interface=to-clients advertise=yes


Check the status

After configuration is complete we can verify that each CE router received its own prefix

On server:

[admin@R1] /ipv6 dhcp-server binding> print 
Flags: X - disabled, D - dynamic 
 #   ADDRESS                                     DUID               IAID SERVER         STATUS 
 1 D 2001:db8:1::/64                             0019d1393536        566 server1        bound
 2 D 2001:db8:2::/64                             0019d1393535        565 server1        bound 

On client:

[admin@CE1] /ipv6 dhcp-client> print 
Flags: D - dynamic, X - disabled, I - invalid 
 #    INTERFACE           STATUS        PREFIX                                     
 0    to-R1               bound         2001:db8:1::/64  

[admin@CE1] /ipv6 dhcp-client> /ipv6 pool print 
Flags: D - dynamic 
 #   NAME                 PREFIX                              PREFIX-LENGTH
 0 D my-ipv6              2001:db8:1::/64                                64

We can also see that IPv6 address was automatically added from the prefix pool:

[admin@CE1] /ipv6 address> print 
Flags: X - disabled, I - invalid, D - dynamic, G - global, L - link-local 
 #    ADDRESS                                     FROM-POOL INTERFACE     ADVERTISE
 0  G 2001:db8:1::1/64                                      to-clients         yes      
..

And pool usage shows that 'Address' is allocating the pool

[admin@CE1] /ipv6 pool used> print 
POOL         PREFIX                                      OWNER         INFO        
my-ipv6      2001:db8:1::/64                             Address       to-clients   

[ Top | Back to Content ]