First uninstall pre-installed dnsmasq:
/etc/init.d/dnsmasq stop opkg remove dnsmasq
Then install the ISC DHCP server app:
opkg install http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/oldpackages/isc-dhcp-server-ipv4_4.2.4-3_ar71xx.ipk
Once that is done run:
nano /etc/dhcpd.conf
and replace the content with this:
# Show that we want to be the only DHCP server in this network: authoritative; option domain-name "myHome.com"; option domain-name-servers 192.168.0.1, 192.168.0.2; #DHCP Scope: subnet 192.168.0.0 netmask 255.255.255.0 { #DHCP range range 192.168.0.100 192.168.0.130; #default gateway option routers 192.168.0.1; } default-lease-time 691200; # 8 days max-lease-time 864000; # 10 days # Static assignments host PC1 { hardware ethernet 00:11:22:33:44:55; fixed-address 192.168.0.10; } host PC2 { hardware ethernet 00:88:77:77:66:66; fixed-address 192.168.0.11; }
Save the file and start the service
/etc/init.d/dhcpd start
To see dhcpd leases run:
more /var/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.4 lease 192.168.1.100 { starts 4 2015/03/05 17:57:24; ends 4 2015/03/05 17:59:24; tstp 4 2015/03/05 17:59:24; cltt 4 2015/03/05 17:57:24; binding state free; hardware ethernet 11:22:33:55:44:33; client-hostname "Windows7-PC"; } lease 192.168.1.102 { starts 4 2015/03/05 18:19:06; ends 4 2015/03/05 18:21:06; tstp 4 2015/03/05 18:21:06; cltt 4 2015/03/05 18:19:06; binding state free; hardware ethernet 11:33:55:ee:ff:55; client-hostname "mobile-phone"; }
Job done. To install DNS follow here.