Topic: tech myref prev next
tech myref > Local DHCP Server
running a local DHCP server
These commands will rename an interface to a more memorable name, set an IP address on it, and start a DHCP server.
ip link set enx3c18a00f6d36 down
ip link set enx3c18a00f6d36 name ethusb
ip addr add 172.17.1.2/24 dev ethusb
ip link set ethusb up
dnsmasq --interface=ethusb --bind-interfaces --dhcp-range=172.17.1.10,172.17.1.20,1h
dnsmasq
will read from ‘/etc/dnsmasq.conf
’. Options set in this config
file override those set on the command line. For ad-hoc and custom setups, it
may be preferred to comment out all lines in the config file, or specify
--conf-file=/dev/null
.
In case the host decides that its default route is via the DHCP network, delete the default route by specifying the device
ip route del default dev enx3c18a00f6d36
dnsmasq \
--listen-address=$=LISTEN_ADDRESS$ \
-i $=UNIQUE_INTERFACE$ \
-I lo \
-z \
--dhcp-range=$=DHCP_START$,$=DHCP_END$ \
--dhcp-option=option:router,$=LISTEN_ADDRESS$ \
--dhcp-option=6,$=LISTEN_ADDRESS$\
-l /var/lib/misc/dnsmasq.leases.$=UNIQUE_INTERFACE$ \
--conf-file=/dev/null