Mikrotik не поддерживает из коробки 119 DHCP опцию, пришлось найти и написать скрипты:

Реализация на bash:

#!/bin/sh

chr() {
    [ "$1" -lt 256 ] || return 1
    printf "\\$(printf %o "$1")"
}

ord() {
    # If the leading character is a single-quote or double-quote,
    # the value shall be the numeric value in the underlying codeset
    # of the character following the single-quote or double-quote.
    LC_CTYPE=C printf '%02X' "'$1"
}

while [ $# -gt 0 ]; do
    out=''
    remain=${1/%./}.  # Remove the character . from the end of the line
    shift

    # Make sure the name is a valid DNS domain name
    [ ${#remain} -ge 255 ] && echo "ERROR: name \"$remain\" is longer than 255 characters" && exit 1

    while [ -n "$remain" ]; do
        label=${remain%%.*}
        remain=${remain#*.}
        [ ${#label} -ge 63 ] && echo "ERROR: label \"$label\" is longer than 63 characters" && exit 1
        [ -n "${remain##*.*}" ] && remain=${remain}.
        out=$out$(chr ${#label})$label
    done

    [ ${#out} -ge 255 ] && echo 'ERROR: the output string is larger than 255 bytes' && exit 1

    while [ -n "$out" ]; do
        ord ${out:0:1}  # Get the first character
        out=${out:1}  # trim the first character
    done

    printf ${out}00
done
echo

Реализация на perl:

#!/usr/bin/perl -w

###############################################################################
#
# dhcp119
# John Simpson <jms1@jms1.net> 2016-07-31
#
# Shows the raw value needed for DHCP option 119, aka "domain-search", for
# one or more domain names.
#
# Implements DNS compression as described in RFC 3397, using the scheme
# originally described in RFC 1035 section 4.1.4.
#   https://tools.ietf.org/search/rfc1035#section-4.1.4
#
###############################################################################

require 5.003;
use strict;

use Getopt::Std;
use Data::Dumper;

my %opt = ();
my $do_debug = 0;  # -d
my $allow_ext = 0;  # -e

###############################################################################

sub usage(;$) {
    my $msg = (shift || '');

    print <<EOF ;
$0 [-e] [-d] [-h] domain [...]

Shows the raw value needed for DHCP option 119, aka "domain-search", for
one or more domain names. Implements DNS compression as described in
RFC 3397.

-e      Allow extended characters. The original DNS standard, RFC 1034,
        required that DNS labels could contain only letters, digits, and
        hyphens. The rules have since been relaxed, and any character is
        technically allowed, although they tend to be avoided except for
        international names.

-d      Debugging. Shows the internal table of domain names and positions,
        used for DNS compression.

-h      Show this help message.

EOF

    if ($msg) {
        print $msg;
        exit 1;
    }

    exit 0;
}

###############################################################################
###############################################################################
###############################################################################

# Process the command line options
getopts('hde', \%opt);
$opt{'h'} && usage();
$do_debug   = ($opt{'d'} ? 1 : 0);
$allow_ext  = ($opt{'e'} ? 1 : 0);

###############################################################################

# Process the domain names on the command line
my $out = '';  # output as raw bytes
my %pos = ();  # domain => position within $out
my @seq = ();  # order that domains were added to $out (for debug output)

usage qq[ERROR: no domain names specified\n] if ($#ARGV < 0);

while (my $name = shift @ARGV) {
    ########################################
    # Make sure the name is a valid DNS domain name
    die qq[ERROR: name "$name" is longer than 255 characters\n] if (length($name) > 255);
    die qq[ERROR: name "$name" contains invalid characters\n] if ($name =~ m|[^a-z0-9\-\.]|i and !$allow_ext);

    ########################################
    # Process each label within the name
    my $remain = $name;
    my $compressed  = 0;

    while ($remain ne '') {
        ########################################
        # If the remaining name has already been seen,
        # * add a reference to it to the output
        # * remember that it's a compressed name
        #   (so we don't end with "00")
        # * we're finished with this name
        if (exists $pos{$remain}) {
            $out .= qq[\xC0] . chr($pos{$remain});
            $remain = '';
            $compressed = 1;
            last;
        }

        ########################################
        # Remember the name we're adding, in case
        # a later name needs to refer back to it
        $pos{$remain} = length($out);
        push(@seq, $remain);

        ########################################
        # Extract the first label from the remaining name
        my ($label, $x) = split(/\./, $remain, 2);
        $remain = ($x || '');

        die qq[ERROR: label "$label" is longer than 63 characters\n] if (length($label) > 63);

        ########################################
        # Add the length followed by the label itself to the output string
        $out .= chr(length($label)) . $label;
    }

    ########################################
    # If we didn't end with a compression reference,
    # add a zero byte to end this name.
    $out .= qq[\x00] unless ($compressed);
}

die qq[ERROR: the output string is larger than 255 bytes\n] if (length($out) > 255);

########################################
# Show $out as a sequence of hex numbers
map {printf '%02X', ord($_)} split(//, $out);
print qq[\n];

########################################
# Debugging - show the entries in %pos
if ($do_debug) {
    print qq[\n];
    map {printf qq[%02X %s\n], $pos{$_}, $_} @seq;
}