Table of Contents

Networking - Router - Build a Router

A router is defined as a system that performs the following duties:

The following interfaces are needed:


Networking

Enable IP Forwarding

echo 'net.inet.ip.forwarding=1' >> /etc/sysctl.conf

Configure IP Address

Set an IP Address for the device.

Either DHCP or a Static IP.


Configure the WiFi Network.


DHCP

The DHCP resolver should be started at boot time to provide client machines with local IP addresses.

Example for DHCP servers include:


Configure Primary IP Addresses

NOTE: Any RFC 1918 address space may be specified here.

Usually there is an option to point to the local DNS server.

  • This will be configured later.
  • For now, enter an IP for this if known.

Firewall

Configure Firewall with:

NOTE: Unroutable addresses include:

<code> 0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 <code>


DNS

Use Unbound

A DNS cache is recommended.

An example configuration would include:

unbound.conf
server:
  interface: 192.168.1.1
  interface: 192.168.2.1
  interface: 127.0.0.1
  access-control: 192.168.1.0/24 allow
  access-control: 192.168.2.0/24 allow
  do-not-query-localhost: no
  hide-identity: yes
  hide-version: yes
 
forward-zone:
  name: "."
  forward-addr: 1.2.3.4  # IP of the upstream resolver.

NOTE: The above configuration assumes that the 192.168.1.0/24 subnet is used for the wired clients and 192.168.2.0/24 for the wireless.


Configure /etc/resolv.conf

/etc/resolv.conf
nameserver 127.0.0.1
nameserver 1.2.3.4
search localdomain

NOTE:

  • nameserver 127.0.0.1: Needed as the router is using the caching resolver.
  • nameserver 1.2.3.4: The IP of the DNS Resolver.

Reboot the system.