Define some server with DHCP requests

Hello
I would like to have DHCP-Server on my Omnia Router.
This server should also provide some Private IP for a DNS Server and for the NTP Server.
Where could this be defined so every DHCP Requester get this information too?

have a nice day
vinc

Hello @vinc

The Omnia router already has a DHCP-Server installed by default. It is Dnsmasq. You can configure it in the /etc/config/dhcp file to send information to DHCP Requesters with the list dhcp_option '...' directive.

For example:

config dhcp 'lan'
        option interface 'lan'
        option limit '150'
        option leasetime '12h'
        option start '10'
        list dhcp_option '6,192.168.1.1'

Here, the line list dhcp_option '6,192.168.1.1' indicates that Dnsmasq will send 192.168.1.1 to DHCP Requesters on the LAN as the IP address of the DNS server (code 6) they should use.

You can get the list of codes for DHCP options with the following command:

$ dnsmasq --help dhcp
Here is the output

1 netmask
2 time-offset
3 router
6 dns-server
7 log-server
9 lpr-server
13 boot-file-size
15 domain-name
16 swap-server
17 root-path
18 extension-path
19 ip-forward-enable
20 non-local-source-routing
21 policy-filter
22 max-datagram-reassembly
23 default-ttl
26 mtu
27 all-subnets-local
31 router-discovery
32 router-solicitation
33 static-route
34 trailer-encapsulation
35 arp-timeout
36 ethernet-encap
37 tcp-ttl
38 tcp-keepalive
40 nis-domain
41 nis-server
42 ntp-server
44 netbios-ns
45 netbios-dd
46 netbios-nodetype
47 netbios-scope
48 x-windows-fs
49 x-windows-dm
58 T1
59 T2
60 vendor-class
64 nis±domain
65 nis±server
66 tftp-server
67 bootfile-name
68 mobile-ip-home
69 smtp-server
70 pop3-server
71 nntp-server
74 irc-server
77 user-class
93 client-arch
94 client-interface-id
97 client-machine-id
119 domain-search
120 sip-server
121 classless-static-route
125 vendor-id-encap
255 server-ip-address

You can see that code 42 can be used to give the IP address of the NTP server to DHCP Requesters. For that, add this line to the config dhcp 'lan' section:

        list dhcp_option '42,aaa.bbb.ccc.ddd'

aaa.bbb.ccc.ddd being the IP address of the NTP server.

Regards,
Phil

@Phil
this help a lot thanks for this information - so no GUI Anymore :wink:

and about the domain search would be like this?

list dhcp_option ‘119,domain.org

have a nice day
vinc

You can configure it in LuCi -> Network -> Interfaces -> e.g. Lan-Interface -> DHCP-Settings -> Advanced Settings, too.

1 Like

The syntax looks good to me. I’ve read some times ago that some DHCP requesters do not support code 119. I never used this code myself, so I let you give it a try! :wink:

Feel free to come back and tell us if that works for you. It could be useful for other users interested by this topic.

Have a good day too.

how to open ssh access over WAN?
or
would it also bee posible to access it via LAN connection in the same network?
i can’t find a point in the GUI to switch it on or off :thinking:

@protree this works fine too, merci

Hi,

There is nice documentation https://doc.turris.cz/doc/en/howto/accessing_turris_from_wan?s[]=ssh

1 Like