Skip to content
MikroTik RouterOS Docs

DHCP Client Configuration

For the impatient: enable DHCP client on your WAN interface to get an IP from your ISP.

/ip dhcp-client add interface=ether1 disabled=no

Verify with:

/ip dhcp-client print

Look for status=bound and an assigned IP address.

What this does: DHCP (Dynamic Host Configuration Protocol) Client enables automatic IP address configuration on MikroTik RouterOS interfaces. The client receives an IP address, netmask, default gateway, and DNS/NTP server addresses from a DHCP server.

When to use this:

  • WAN connections to ISPs that provide dynamic IP addresses
  • Automated network configuration without manual IP setup
  • Multi-WAN failover setups with dynamic addressing
  • Any scenario where you need dynamic IP assignment from an upstream DHCP server

Prerequisites:

  • An Ethernet-like interface (Ethernet, VLAN, Bridge, Wireless)
  • No static IP address configured on the same interface
  • Access to a network with a DHCP server (typically your ISP or upstream router)

Enable DHCP client on your WAN interface. This will automatically request an IP address from the upstream DHCP server.

/ip dhcp-client add interface=ether1 disabled=no

By default, this configuration will:

  • Accept and use DNS servers from the DHCP server (use-peer-dns=yes)
  • Accept and use NTP servers from the DHCP server (use-peer-ntp=yes)
  • Install a default route via the received gateway (add-default-route=yes)

Check that the DHCP client successfully obtained an IP address.

/ip dhcp-client print detail

Expected output:

Flags: D - dynamic, X - disabled, I - invalid
0 interface=ether1 add-default-route=yes default-route-distance=1
use-peer-dns=yes use-peer-ntp=yes dhcp-options=hostname,clientid
status=bound address=192.168.1.100/24 gateway=192.168.1.1
dhcp-server=192.168.1.1 primary-dns=8.8.8.8 expires-after=23h45m

The key indicator is status=bound with a valid IP address.

Verify the default route was installed correctly.

/ip route print where dst-address=0.0.0.0/0

Expected output:

Flags: D - dynamic, A - active, c - connect, d - dhcp
# DST-ADDRESS GATEWAY DISTANCE
0 DAd 0.0.0.0/0 192.168.1.1 1

The d flag indicates the route was added dynamically by DHCP.

If you want to use custom DNS servers instead of those provided by your ISP:

/ip dhcp-client add interface=ether1 disabled=no use-peer-dns=no use-peer-ntp=no

Then configure your preferred DNS servers:

/ip dns set servers=1.1.1.1,8.8.8.8

For setups with two ISP connections where the second is a backup:

# Primary WAN - lower distance = preferred
/ip dhcp-client add interface=ether1 disabled=no default-route-distance=1 \
use-peer-dns=no use-peer-ntp=no
# Secondary WAN - higher distance = backup
/ip dhcp-client add interface=ether2 disabled=no default-route-distance=2 \
use-peer-dns=no use-peer-ntp=no

For automatic failover when primary link fails:

/ip dhcp-client set [find interface=ether1] check-gateway=ping
/ip dhcp-client set [find interface=ether2] check-gateway=ping

Some ISPs require or prefer a specific hostname:

/ip dhcp-client set [find interface=ether1] host-name="my-router"

LTE interfaces create dynamic DHCP clients that cannot be edited directly. Configure via APN profile instead:

/interface lte apn set [find name=default] default-route-distance=2 use-peer-dns=no add-default-route=yes

Scenario: DHCP Client with Script (Advanced)

Section titled “Scenario: DHCP Client with Script (Advanced)”

For advanced multi-WAN setups requiring custom route management:

/ip dhcp-client add interface=ether1 disabled=no add-default-route=no script={
:if ($bound=1) do={
/ip route add gateway=$"gateway-address" comment="WAN1-DHCP"
:log info ("DHCP bound: " . $"lease-address" . " via " . $"gateway-address")
} else={
/ip route remove [find comment="WAN1-DHCP"]
:log info "DHCP lease lost"
}
}

Script variables available:

VariableDescription
$bound1 = lease acquired, 0 = lease lost
$"lease-address"Assigned IP address
$"gateway-address"Gateway from DHCP server
$interfaceInterface name
$"server-address"DHCP server IP

Confirm your DHCP client configuration is working:

/ip dhcp-client print detail where status=bound

Expected: Status shows bound with valid address and gateway.

/ip route print where dst-address=0.0.0.0/0 gateway-status~"reachable"

Expected: Active route with reachable gateway.

/ip dns print

Expected: dynamic=yes with servers matching DHCP-provided values.

/tool ping 8.8.8.8 count=3

Expected: 3 packets transmitted, 3 received.

SymptomCauseSolution
Status stuck on “searching”No DHCP server respondingVerify physical connection; check if ISP requires specific options
Status stuck on “searching”ISP hostname bugTry changing hostname: /ip dhcp-client set 0 host-name="router"
Status stuck on “searching”RouterOS 7.3.0+ option orderingAdd Option 57 (see Community Tips below)
Default route shows “invalid”Conflicting static route existsRemove static default route or adjust distances
Multiple default routesMultiple DHCP clients with same distanceSet different default-route-distance values
DNS not updatingIPv6 also providing DNSSet use-peer-dns=no on IPv6 DHCP client too
Bridge not getting IPNo physical port in bridgeEnsure at least one active port in bridge
Can’t edit LTE DHCP clientLTE creates dynamic clientConfigure via /interface lte apn instead

Common Mistakes

  • Don’t configure static IP on the same interface - DHCP client and static IP conflict
  • Don’t forget route distances in multi-WAN - Without different distances, routes will conflict
  • Don’t expect firewall to block rogue DHCP - IP firewall does NOT apply to DHCP client traffic; use bridge filtering if needed
  • Remember Option 121 precedence - Classless static routes (Option 121) override the default gateway (Option 3) per RFC 3442
StatusDescription
boundLease acquired successfully, client has valid IP
searchingSending DHCPDISCOVER, waiting for server offers
requestingSent DHCPREQUEST, waiting for acknowledgment
rebindingLease expiring, trying to extend with any server
stoppedClient is disabled or stopped
errorError occurred during DHCP process
  • DHCP Server - configure your router as a DHCP server for downstream clients
  • DHCP Relay - forward DHCP requests across network segments
  • IP Pools - address pool management for DHCP servers
  • MikroTik DHCP Documentation
  • Version changes:
    • v7.0: Added default-route-tables for VRF, check-gateway=bgd
    • v6.43: Added special-classless for add-default-route

RouterOS DHCP client automatically requests these options from the server:

OptionNamePurpose
1Subnet MaskNetwork mask for assigned address
3Gateway ListDefault gateway addresses
6DNS Server ListDNS resolver addresses
33Static RoutesClassful static routes
42NTP Server ListTime server addresses
43Vendor SpecificVendor-specific information
121Classless Static RoutesCIDR routes (takes precedence over Option 3 per RFC 3442)
138CAPWAP AC AddressesController addresses for CAPsMAN
PropertyTypeDefaultDescription
interfacestring-Interface for DHCP client (required)
disabledyes/noyesWhether client is disabled
add-default-routeyes/no/special-classlessyesInstall default route from DHCP
use-peer-dnsyes/noyesAccept DNS servers from DHCP
use-peer-ntpyes/noyesAccept NTP servers from DHCP
default-route-distance0-2551Administrative distance for default route
host-namestringsystem identityHostname sent to DHCP server
client-idstringMAC addressCustom client identifier
check-gatewaynone/arp/ping/bgdnoneGateway reachability check method
scriptscript-Script executed on lease events