openwrt - dnsmasq

最後更新: 2018-03-07

介紹

 


dnsmasq 設定檔位置:

/etc/config/dhcp

/etc/init.d/dnsmasq restart ==> /etc/config/dhcp + /etc/dnsmasq.conf ==> /var/etc/dnsmasq.conf

設定值:

config dnsmasq
        option domainneeded     1

        # Reject reverse lookups to private IP ranges where no corresponding entry exists in /etc/hosts
        option boguspriv        1

        option filterwin2k      0  # enable for dial on demand
        option localise_queries 1
        option rebind_protection 1  # disable if upstream must serve RFC1918 addresses
        option rebind_localhost 1  # enable for RBL checking and similar services
        #list rebind_domain example.lan  # whitelist RFC1918 responses for domains
        option local            '/lan/'
        option domain           'lan'
        option expandhosts      1

        # Default 得 150 ...
        option cachesizecachesize        2048
        option nonegcache       0


        # Force dnsmasq into authoritative mode. This speeds up DHCP leasing.
        option authoritative    1

        option readethers       1
        option leasefile        '/tmp/dhcp.leases'
        option resolvfile       '/tmp/resolv.conf.auto'
        #list server            '/mycompany.local/1.2.3.4'
        #option nonwildcard     1
        #list interface         br-lan
        #list notinterface      lo
        #list bogusnxdomain     '64.94.110.11'

 

# DHCP Server

config dhcp lan
        option interface        lan
        option start            100
        option limit            150
        option leasetime        12h
        # Forces DHCP serving on the specified interface
        option force            1

config dhcp wan
        option interface        wan
        # dnsmasq should ignore this pool
        option ignore           1

 

# Static Leases

config host
        option ip       '192.168.1.3'
        option mac      '11:22:33:44:55:66,aa:bb:cc:dd:ee:ff'
        option name     'mylaptop'

 

# Custom Domain

config 'domain'
    option 'name' 'typhoon'
    option 'ip'   '192.168.1.140'

它會建立

address=/mail.datahunter.org/192.168.123.251
ptr-record=251.123.168.192.in-addr.arpa,mail.datahunter.org

 


Authoritative

 

The client broadcasts messages on the network subnet using the destination address 255.255.255.255 or the specific subnet broadcast address.

A DHCP client may also request its last-known IP address.

If the client remains connected to the same network, the server may grant the request.

Otherwise, it depends whether the server is set up as authoritative or not.

An authoritative server denies the request, causing the client to issue a new request.

A non-authoritative server simply ignores the request, leading to an implementation-dependent timeout for the client to expire the request and ask for a new IP address.

 


DOC

http://wiki.openwrt.org/doc/uci/dhcp
 

 

 

Creative Commons license icon Creative Commons license icon