Faelin Landy
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: DHCP Addressing tags: Cisco IOS, networking, manual, reference, router, switch, technical --- <header> <h6><abbr title="Dynamic Host Configuration Protocol">DHCP</abbr> Addressing</h6> > [toc] </header> --- # DHCPv4 ## Config **Exclude IPv4 Addresses** ```pug Router(config)# ip dhcp excluded-address <low-address> [<high-address>] ``` **Define a DHCPv4 Pool Name** ```pug Router(config)# ip dhcp pool <pool-name> Router(dhcp-config)# ``` **Configure the DHCPv4 Pool** ```pug R1(dhcp-config)# network 192.168.10.0 255.255.255.0 R1(dhcp-config)# default-router 192.168.10.1 R1(dhcp-config)# dns-server 192.168.11.5 R1(dhcp-config)# domain-name example.com R1(dhcp-config)# end R1# R1# show running-config | section dhcp ! Displays the DHCPv4 commands configured on the router. R1# R1# show ip dhcp binding ! Displays a list of all IPv4 address to MAC address bindings provided by the DHCPv4 service. R1# R1# show ip dhcp server statistics ! Displays count information regarding the number of DHCPv4 messages that have been sent and received. R1# ``` ### Example ```pug R1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.9 R1(config)# ip dhcp excluded-address 192.168.10.254 R1(config)# ip dhcp pool LAN-POOL-1 R1(dhcp-config)# network 192.168.10.0 255.255.255.0 R1(dhcp-config)# default-router 192.168.10.1 R1(dhcp-config)# dns-server 192.168.11.5 R1(dhcp-config)# domain-name example.com R1(dhcp-config)# end R1# R1# show running-config | section dhcp ! ip dhcp excluded-address 192.168.10.1 192.168.10.9 ! ip dhcp excluded-address 192.168.10.254 ! ip dhcp pool LAN-POOL-1 ! network 192.168.10.0 255.255.255.0 ! default-router 192.168.10.1 ! dns-server 192.168.11.5 ! domain-name example.com R1# R1# show ip dhcp binding ! Bindings from all pools not associated with VRF: ! IP address Client-ID/ Lease expiration ! Type State Interface ! Hardware address/ ! User name ! 192.168.10.10 0100.5056.b3ed.d8 Sep 15 2019 8:42 AM ! Automatic Active GigabitEthernet0/0/0 R1# R1# show ip dhcp server statistics ! Memory usage 19465 ! Address pools 1 ! Database agents 0 ! Automatic bindings 2 ! Manual bindings 0 ! Expired bindings 0 ! ...output truncated... ! Message Received ! BOOTREQUEST 0 ! DHCPDISCOVER 4 ! DHCPREQUEST 2 ! DHCPDECLINE 0 ! DHCPRELEASE 0 ! DHCPINFORM 0 ``` ## DHCPv4 Relay **Configure a Router to relay DHCPv4 broadcasts to an external DHCPv4 server** ```pug R1(config)# interface g0/0/0 R1(config-if)# ip helper-address 192.168.11.6 R1(config-if)# end R1# ``` **By default, the `ip helper-address` command forwards the following eight UDP services** * Port 37: Time * Port 49: TACACS * Port 53: DNS * Port 67: DHCP/BOOTP server * Port 68: DHCP/BOOTP client * Port 69: TFTP * Port 137: NetBIOS name service * Port 138: NetBIOS datagram service ## DHCPv4 Client **Configure a Cisco IOS router as a DHCPv4 client** - [connect the Ethernet interface to a cable or DSL modem] ```pug R1(config)# interface G0/0/1 R1(config-if)# ip address dhcp R1(config-if)# no shutdown ! Sep 12 10:01:25.773: %DHCP-6-ADDRESS_ASSIGN: Interface GigabitEthernet0/0/1 assigned DHCP address 209.165.201.12, mask 255.255.255.224, hostname R1 R1(config-if)# end R1# R1# show ip interface g0/0/1 ! GigabitEthernet0/0/1 is up, line protocol is up ! Internet address is 209.165.201.12/27 ! Broadcast address is 255.255.255.255 ! Address determined by DHCP ``` --- # DHCPv6 Configuration ## DHCPv6 Router Advertisement ### Stateless Address Auto-configuration (SLAAC) Advertisement To enable the sending of RA messages, a router must join the IPv6 all-routers group using the ipv6 unicast-routing global config command, as show in the output. ```pug R1(config)# ipv6 unicast-routing R1(config)# exit R1# ``` ### Stateless DHCPv6 Advertisement Stateless DHCPv6 is enabled on a router interface using the **`ipv6 nd other-config-flag`** interface configuration command. This sets the **O** flag to `1`. :::success Use the command **`no ipv6 nd other-config-flag`** to reset the interface to the default SLAAC only option (i.e. set the **O** flag to `0`). ::: ```pug R1(config-if)# ipv6 nd other-config-flag R1(config-if)# end R1# R1# show ipv6 interface g0/0/1 | begin ND ! ND DAD is enabled, number of DAD attempts: 1 ! ND reachable time is 30000 milliseconds (using 30000) ! ND advertised reachable time is 0 (unspecified) ! ND advertised retransmit interval is 0 (unspecified) ! ND router advertisements are sent every 200 seconds ! ND router advertisements live for 1800 seconds ! ND advertised default router preference is Medium ! Hosts use stateless autoconfig for addresses. ! Hosts use DHCP to obtain other configuration. R1# ``` ### Stateful DHCPv6 Advertisement Stateful DHCPv6 is enabled on a router interface using the **`ipv6 nd managed-config-flag`** interface configuration command. This sets the **M** flag to `1`. The **`ipv6 nd prefix default no-autoconfig`** interface command disables SLAAC by setting the **A** flag to `0`. ```pug R1(config)# int g0/0/1 R1(config-if)# ipv6 nd managed-config-flag R1(config-if)# ipv6 nd prefix default no-autoconfig R1(config-if)# end R1# R1# show ipv6 interface g0/0/1 | begin ND ! ND DAD is enabled, number of DAD attempts: 1 ! ND reachable time is 30000 milliseconds (using 30000) ! ND advertised reachable time is 0 (unspecified) ! ND advertised retransmit interval is 0 (unspecified) ! ND router advertisements are sent every 200 seconds ! ND router advertisements live for 1800 seconds ! ND advertised default router preference is Medium ! Hosts use DHCP to obtain routable addresses. R1# ``` ## DHCPv6 Router Roles ### Stateless DHCPv6 Configuration (Router-As-Server) The stateless DHCPv6 server option requires that the router advertise the IPv6 network addressing information in RA messages. However, the client must contact a DHCPv6 server for more information. <ol class="step-list"> <li><b>Enable IPv6 routing.</b></li> ```pug R1(config)# ipv6 unicast-routing R1(config)# ``` <li><b>Define a DHCPv6 pool name.</b></li> ```pug R1(config)# ipv6 dhcp pool IPV6-STATELESS R1(config-dhcpv6)# ``` :::info Pool names do not have to be uppercase. However, using an uppercase name makes it easier to see in a configuration. ::: <li><b>Configure the DHCPv6 pool.</b></li> ```pug R1(config-dhcpv6)# dns-server 2001:db8:acad:1::254 R1(config-dhcpv6)# domain-name example.com R1(config-dhcpv6)# exit R1(config)# ``` <li><b>Bind the DHCPv6 pool to an interface.</b></li> The DHCPv6 pool has to be bound to the interface using the **`ipv6 dhcp server POOL-NAME`** interface config command as shown in the output. ```pug R1(config)# interface GigabitEthernet0/0/1 R1(config-if)# description Link to LAN R1(config-if)# ipv6 address fe80::1 link-local R1(config-if)# ipv6 address 2001:db8:acad:1::1/64 R1(config-if)# ipv6 nd other-config-flag R1(config-if)# ipv6 dhcp server IPV6-STATELESS R1(config-if)# no shut R1(config-if)# end R1# ``` :::warning The **O** flag must be manually changed from 0 to 1 using the interface command **`ipv6 nd other-config-flag`**. The A flag is 1 by default, telling clients to use SLAAC to create their own GUA. ::: </ol> ### Stateless DHCPv6 Configuration (Router-As-Client) A router can also be a DHCPv6 client and get an IPv6 configuration from a DHCPv6 server, such as a router functioning as a DHCPv6 server. <ol class="step-list"> <li><b>Enable IPv6 routing.</b></li> ```pug R1(config)# ipv6 unicast-routing R1(config)# ``` <li><b>Configure client router to create an LLA.</b></li> ```pug R3(config)# interface g0/0/1 R3(config-if)# ipv6 enable R3(config-if)# ``` <li><b>Configure client router to use SLAAC.</b></li> ```pug R3(config-if)# ipv6 address autoconfig R3(config-if)# end R3# ``` <li><b>Verify client router is assigned a GUA.</b></li> ```pug R3# show ipv6 interface brief ! GigabitEthernet0/0/0 [up/up] ! unassigned ! GigabitEthernet0/0/1 [up/up] ! FE80::2FC:BAFF:FE94:29B1 ! 2001:DB8:ACAD:1:2FC:BAFF:FE94:29B1 ! Serial0/1/0 [up/up] ! unassigned ! Serial0/1/1 [up/up] ! unassigned R3# ``` :::info It may take the interface a few seconds to complete the process. ::: <li><b>Verify client router received other DHCPv6 information.</b></li> ```pug R3# show ipv6 dhcp interface g0/0/1 ! GigabitEthernet0/0/1 is in client mode ! Prefix State is IDLE (0) ! Information refresh timer expires in 23:56:06 ! Address State is IDLE ! List of known servers: ! Reachable via address: FE80::1 ! DUID: 000300017079B3923640 ! Preference: 0 ! Configuration parameters: ! DNS server: 2001:DB8:ACAD:1::254 ! Domain name: example.com ! Information refresh time: 0 ! Prefix Rapid-Commit: disabled ! Address Rapid-Commit: disabled R3# ``` </ol> ### Stateful DHCPv6 Configuration (Router-As-Server) The stateful DHCP server option requires that the IPv6 enabled router tells the host to contact a DHCPv6 server to obtain all necessary IPv6 network addressing information. <ol class="step-list"> <li><b>Enable IPv6 routing and configure the DHCPv6 pool.</b></li> ```pug R1(config)# ipv6 unicast-routing R1(config)# ipv6 dhcp pool IPV6-STATEFUL R1(config-dhcpv6)# address prefix 2001:db8:acad:1::/64 R1(config-dhcpv6)# dns-server 2001:4860:4860::8888 R1(config-dhcpv6)# domain-name example.com R1(config-dhcpv6)# exit R1(config)# ``` <li><b>Bind the DHCPv6 pool to an interface.</b></li> * The **M** flag must be manually changed from `0` to `1` using the **`interface command ipv6 nd managed-config-flag`**. * The **A** flag is manually changed from `1` to `0` using the interface command **`ipv6 nd prefix default no-autoconfig`**. Setting the **A** flag to `0` tells the client not to use SLAAC to create a GUA. * The **`ipv6 dhcp server`** command binds the DHCPv6 pool to the interface. ```pug R1(config)# interface GigabitEthernet0/0/1 R1(config-if)# description Link to LAN R1(config-if)# ipv6 address fe80::1 link-local R1(config-if)# ipv6 address 2001:db8:acad:1::1/64 R1(config-if)# ipv6 nd managed-config-flag R1(config-if)# ipv6 nd prefix default no-autoconfig R1(config-if)# ipv6 dhcp server IPV6-STATEFUL R1(config-if)# no shut R1(config-if)# end R1# ``` :::info You can use the **`no ipv6 nd managed-config-flag`** command to set the **M** flag back to its default of `0`. Similarly, **`no ipv6 nd prefix default no-autoconfig`** command sets the **A** flag back to its default of `1`. ::: </ol> ### Stateful DHCPv6 Configuration (Router-As-Client) The client router needs to have ipv6 unicast-routing enabled and an IPv6 link-local address to send and receive IPv6 messages. ```pug R3(config)# ipv6 unicast-routing R3(config)# interface g0/0/1 R3(config-if)# ipv6 enable R3(config-if)# ipv6 address dhcp R3(config-if)# end R3# R3# show ipv6 interface brief ! GigabitEthernet0/0/0 [up/up] ! unassigned ! GigabitEthernet0/0/1 [up/up] ! FE80::2FC:BAFF:FE94:29B1 ! 2001:DB8:ACAD:1:B4CB:25FA:3C9:747C ! Serial0/1/0 [up/up] ! unassigned ! Serial0/1/1 [up/up] ! unassigned R3# ``` ### DHCPv6 Relay Agent Configuration If the DHCPv6 server is located on a different network than the client, then the IPv6 router can be configured as a DHCPv6 relay agent. The configuration of a DHCPv6 relay agent is similar to the configuration of an IPv4 router as a DHCPv4 relay. ```pug R1(config)# interface gigabitethernet 0/0/1 R1(config-if)# ipv6 dhcp relay destination 2001:db8:acad:1::2 G0/0/0 R1(config-if)# exit R1(config)# ``` :::info This command is configured on the interface facing the DHCPv6 clients and specifies the DHCPv6 server address and egress interface to reach the server, as shown above. The egress interface is only required when the next-hop address is an LLA. ::: ### DHCPv6 Relay Agent Verification Commands The DHCPv6 relay agent can be verified using the **`show ipv6 dhcp interface`** command. This will verify that the appropriate interface is in relay mode. ```pug R1# show ipv6 dhcp interface ! GigabitEthernet0/0/1 is in relay mode ! Relay destinations: ! 2001:DB8:ACAD:1::2 ! 2001:DB8:ACAD:1::2 via GigabitEthernet0/0/0 R1# ``` On the DHCPv6 server, use the **`show ipv6 dhcp binding`** command to verify if any hosts have been assigned an IPv6 configuration. ```pug R3# show ipv6 dhcp binding ! Client: FE80::5C43:EE7C:2959:DA68 ! DUID: 0001000124F5CEA2005056B3636D ! Username : unassigned ! VRF : default ! IA NA: IA ID 0x03000C29, T1 43200, T2 69120 ! Address: 2001:DB8:ACAD:2:9C3C:64DE:AADA:7857 ! preferred lifetime 86400, valid lifetime 172800 ! expires at Sep 29 2019 08:26 PM (172710 seconds) R3# ``` ### DHCPv6 Server Verification Commands The **`show ipv6 dhcp pool`** command verifies the name of the DHCPv6 pool and its parameters. The command also identifies the number of active clients. ```pug R1# show ipv6 dhcp pool ! DHCPv6 pool: IPV6-STATEFUL ! Address allocation prefix: 2001:DB8:ACAD:1::/64 valid 172800 ! preferred 86400 (2 in use, 0 conflicts) ! DNS server: 2001:4860:4860::8888 ! Domain name: example.com ! Active clients: 2 R1# ``` The **`show ipv6 dhcp binding`** command displays the IPv6 link-local address of the client and the global unicast address assigned by the server. :::info This information is maintained by a stateful DHCPv6 server. A stateless DHCPv6 server would not maintain this information. ::: ```pug R1# show ipv6 dhcp binding ! Client: FE80::192F:6FBC:9DB:B749 ! DUID: 0001000125148183005056B327D6 ! Username : unassigned ! VRF : default ! IA NA: IA ID 0x03000C29, T1 43200, T2 69120 ! Address: 2001:DB8:ACAD:1:A43C:FD28:9D79:9E42 ! preferred lifetime 86400, valid lifetime 172800 ! expires at Sep 27 2019 09:10 AM (171192 seconds) R1# ``` --- --- {%hackmd 7PGmjAHeTXak2VUM3iw5Wg %}

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully