There were a bit too many tutorials on DIY Linux routers (ArsTechnica, Arch -, Gentoo -, Ubuntu wiki etc.), yet none on its own helped me create my own implementation. It was the joint forces of all above listed and further random forums, reddit etc. So I thought I'd share my own configurations and applications I used to make it easier for others and to keep my notes for later use.
Have these installed or get ready to replace them on your own.
- systemd
- systemctl
- netctl
- dnsmasq
- iptables
- wide-dhcpv6
working dir: /etc/netctl
Choose a sample config from the netctl configs that best describes your WAN setup:
- PPPoE ~ wan_pppoe
- DHCP ~ wan_dhcp
and edit your WAN interface and access data. IMPORTANT: if you choose PPPoE then your WAN INTERFACE will be ppp0 from now on excluding the wan_pppoe config file.
Choose one for the LAN setup too:
- Single LAN port ~ lan_single
- Multiple LAN port (dual/quadro NICs) ~ lan_bridge
IMPORTANT: if you choose BRIDGE MODE then your LAN INTERFACE will be br0 (or what you name it in the config) from now on excluding the lan_bridge config file.
config: /etc/dnsmasq.conf
Simply replace LANIF with your previously configured lan interface on all 3 occurences.
working dir: /etc/iptables
Replace all instances of WANIF and LANIF in iptables.rules
config: /etc/wide-dhcpv6/dhcp6c.conf
Replace all WANIF and LANIF with your interfaces' names.
Use your choice of wan / lan profiles' names!
systemctl enable netctl
netctl enable wan_XXXX
netctl enable lan_XXXX
systemctl enable dnsmasq
systemctl enable iptables
systemctl enable ip6tables
Either simply reboot
or
Use your choice of wan / lan profiles' names!
netctl start lan_XXXX
netctl start wan_XXXX
systemctl start dnsmasq
iptables-restore < /etc/iptables/iptables.rules
ip6tables-restore < /etc/iptables/ip6tables.rules