Skip to content

bobfraser1/alpine-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alpine-router

alpine linux based router using iptables and dnsmasq

Why?

There are many solutions for NAT routers but dnsmasq allows you to set up your own private network with DNS and DHCP. This can be very useful for modeling arbitrary domains, providing fully qualified host names, and testing things like SSL certificates or service discovery.

Vagrant Setup

VirtualBox is required for Vagrant setup.

VirtualBox configuration

In VirtualBox create a private network and set the IP address. Do not enable DHCP.

Vagrant configuration

Edit the Vagrantfile. Update the private network with the VirtualBox network name and the static IP address for the router. Example:

config.vm.network "private_network", ip: "192.168.60.2", name: "vboxnet1"

Update the shell provisioners to set the following environment variables:

PUBLIC_NET - external or public network
PRIVATE_NET - internal or private network
INTERFACE - interface to listen for DHCP and DNS requests
DOMAIN - domain for the private network
DHCP_RANGE - lower bound, upper bound, lease timeout

Deployment

vagrant up

will provision an Alpine Linux VM configured to be a NAT router with DHCP and DNS.

DNS configuration

The easiest way to provide fully qualified host names is to add entries in /etc/hosts. Only shortnames need to be provided, they will be expanded by dnsmasq.

Static IP assignments

Edit dhcp-hosts.sh. Add dhcp-host commands: dhcp-host=MAC,HOSTNAME,IP,LEASE-TIMEOUT

Shell Script Setup

If you don't want to use Vagrant or Alpine Linux, you can use any Linux machine or virtual machine and follow the Shell Script Setup guide.

About

alpine linux based router using iptables and dnsmasq

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages