Difference between revisions of "DHCP server"
From ArmadeusWiki
(→Installation) |
(→Links) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This page will summarize the steps to install a DHCP server on your APF/OPOS. You might want that kind of server when, for example, your board is configured as a Wi-Fi access point or runs a webserver accessible from USB Network Gadget. | + | This page will summarize the steps to install a DHCP server on your APF/OPOS. You might want that kind of server when, for example, your board is configured as a [[APF_as_Wi-Fi_Access_Point|Wi-Fi access point]] or runs a webserver accessible from USB Network Gadget. |
==Installation== | ==Installation== | ||
− | DHCP server | + | Recommended DHCP server for embedded usage is ''dnsmasq''. This daemon can also serve as DNS & TFTP server (see below). |
+ | |||
+ | If you have a recent [[OPOS6UL]]/[[OPOS6UL_NANO]] BSP, then it is installed by default. Otherwise: | ||
<pre class="host"> | <pre class="host"> | ||
$ make menuconfig | $ make menuconfig | ||
Line 22: | Line 24: | ||
==Usage== | ==Usage== | ||
* ''dnsmasq'' is automatically launch at system startup, when ''/etc/dnsmasq.conf'' configuration file exists. | * ''dnsmasq'' is automatically launch at system startup, when ''/etc/dnsmasq.conf'' configuration file exists. | ||
− | So take your favorite text editor and create ''/etc/dnsmasq.conf'' with following informations (adapt interface name & IP addresses to the network you want to setup): | + | So take your favorite text editor and create ''/etc/dnsmasq.conf'' with following informations (adapt interface name (here ''usb0'' & IP addresses to the network you want to setup): |
<pre class="apf"> | <pre class="apf"> | ||
− | interface=usb0 | + | interface=usb0 (wlan0 or uap0 for Wi-Fi AP) |
dhcp-range=192.168.10.10,192.168.10.20,12h | dhcp-range=192.168.10.10,192.168.10.20,12h | ||
</pre> | </pre> | ||
* then reboot your board and it should be up and running | * then reboot your board and it should be up and running | ||
+ | |||
+ | ==DNS server== | ||
+ | * ''dnsmasq'' can also be configured as a local DNS server. Add the following lines to ''/etc/dnsmasq.conf'' to activate this functionality (here we define a new domain): | ||
+ | |||
+ | <pre class="apf"> | ||
+ | local=/opossom.lan/ | ||
+ | domain=opossom.lan | ||
+ | </pre> | ||
+ | |||
+ | * then update the ''/etc/hosts'' file with IP of machines that should be mapped to newly created ''opossom.lan'' domain. For example: | ||
+ | |||
+ | <pre class="apf"> | ||
+ | 192.168.10.1 mysystem.armadeus.lan | ||
+ | </pre> | ||
+ | |||
+ | where 192.168.10.1 is the SOM local IP adress on the network interface registered in ''/etc/dnsmasq.conf'' | ||
+ | |||
+ | * Restart ''dnsmasq'': | ||
+ | |||
+ | <pre class="apf"> | ||
+ | # /etc/init.d/S80dnsmasq restart | ||
+ | </pre> | ||
+ | |||
+ | * then your SOM should be available with ''mysystem.armadeus.lan'' on your local network. If your PC is connected to this local network, [https://linux.die.net/man/1/drill drill] is a nice command line tool to check ''mysystem.armadeus.lan'' name is correctly pointing to 192.168.10.1. | ||
==Links== | ==Links== | ||
* https://linux.die.net/man/8/dnsmasq | * https://linux.die.net/man/8/dnsmasq | ||
+ | * https://wiki.archlinux.org/index.php/dnsmasq | ||
* https://antanas.veiverys.com/how-to-enable-dhcp-on-usb-gadget/ | * https://antanas.veiverys.com/how-to-enable-dhcp-on-usb-gadget/ | ||
[[Category:DHCP]] | [[Category:DHCP]] |
Latest revision as of 18:14, 24 April 2018
This page will summarize the steps to install a DHCP server on your APF/OPOS. You might want that kind of server when, for example, your board is configured as a Wi-Fi access point or runs a webserver accessible from USB Network Gadget.
Contents
Installation
Recommended DHCP server for embedded usage is dnsmasq. This daemon can also serve as DNS & TFTP server (see below).
If you have a recent OPOS6UL/OPOS6UL_NANO BSP, then it is installed by default. Otherwise:
$ make menuconfig
... Target packages ---> ... Networking applications ---> ... [*] dnsmasq [*] tftp support [*] dhcp support [ ] DNSSEC support [ ] IDN support [ ] conntrack marking support
Usage
- dnsmasq is automatically launch at system startup, when /etc/dnsmasq.conf configuration file exists.
So take your favorite text editor and create /etc/dnsmasq.conf with following informations (adapt interface name (here usb0 & IP addresses to the network you want to setup):
interface=usb0 (wlan0 or uap0 for Wi-Fi AP) dhcp-range=192.168.10.10,192.168.10.20,12h
- then reboot your board and it should be up and running
DNS server
- dnsmasq can also be configured as a local DNS server. Add the following lines to /etc/dnsmasq.conf to activate this functionality (here we define a new domain):
local=/opossom.lan/ domain=opossom.lan
- then update the /etc/hosts file with IP of machines that should be mapped to newly created opossom.lan domain. For example:
192.168.10.1 mysystem.armadeus.lan
where 192.168.10.1 is the SOM local IP adress on the network interface registered in /etc/dnsmasq.conf
- Restart dnsmasq:
# /etc/init.d/S80dnsmasq restart
- then your SOM should be available with mysystem.armadeus.lan on your local network. If your PC is connected to this local network, drill is a nice command line tool to check mysystem.armadeus.lan name is correctly pointing to 192.168.10.1.