DNS and IP

COnfigure IP address and domain names for the nodes Configure a DNS resolver in mesh enabled router.

IP

  1. Configure through /etc/dhcp
  2. Formula : n : a.b.c.d
  3. 10.0.0.0 to 10.255.255.255 #n devices supported

There are so many ways a node can acquire an IP address. We can configure an IP address statically for a node. We can deploy a protocol for IP address allocation to several nodes from within a server(where the address allocation protocol is runnning). The address allocation server can be run in many types of devices. Your desktop, laptop, an RPi node, or the router itself. The server is best running inside a machine which is alive as long as the network. So the router firmwares come with such servers. One of the popular address allocation protocol is DHCP and OpenWRT comes with DHCP server.

Configuring DHCP in OpenWRT

Configuration for the DHCP is kept under "/etc/config/dhcp" in contrast to other linux distros, where it lies under "/etc/dhcp/dhcpd.conf". The following configuration will prompt dhcp server to allocate ip addresses starting from the subnet with offset of 100 upto a total number of 100 addresses. Say if, the subnet is 192.168.1.0 then the address range will 192.168.1.100 to 192.168.1.199

config dhcp 'lan'
      option interface 'lan'
      option start '100'
      option limit '100'
      option leasetime '12h'

Note: the subnet is configured in /etc/config/network

config interface 'lan'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'

DNS

What is a DNS and why do we need it? DNS stands for Domain Name Server. Without DNS we cannot use human readable names for nodes. For instance, when you type, "google.com" in your browser, the "google.com" is resolved into an IP address of the google server. How does the broswer resolve the string into an IP address? The browser talks to the DNS server, more correctly it queries the DNS server for name resolution. DNS maintains the mapping between name to IP address. When ever someone ask for IP address corresponding to a name, the DNS servers looks in its map and reponds with the IP address.

Configuring Names For Nodes via LUCI

We saw that, the DNS server maintains a mapping between names and IP addresses. But how does the DNS server came to know that mapping? There are several ways to do that. The websites we browse over the internet, are registered with a global DNS server, so that anyone in the world can access it. The registration process involves buying a domain name from vendors like =========add more stuff =====. For our purpose, we can configure a local DNS server which can server our network. OpenWRT comes with a DNS utility called Dnsmasq. Dnsmasq is a combination of DHCP server and DNS server/forwarder. Let's say you have connected your laptop to the mesh-enabled-router, and want to server some content via webserver. You'd like to use a catchy name for your website(local to our network).

How do we do that?

  1. First we have find the IP address allocated to your laptop. Say it is 192.168.1.162
  2. Add the mapping entry in router.

    1. Log into the router, via ssh/telnet
    2. Create a new file under directory /etc, I pick hosts.pymesh
    3. add the following line to the file.

      192.168.1.162 pymesh.p2p

    4. Log into the router, via browser

    5. Go to DHCP and DNS configuration page, In the top menu click Network -> DHCP and DNS.
    6. In the Additional Hosts Files field(highlighted in the figure below) add the name of the file which we have created above.
    7. Click Save & Apply

Read that post on DNS in p2p

results matching ""

    No results matching ""