- Hardware Requirements.
- Software installation.
- Basic Setup.
- /etc/network/Interfaces Configuration.
- Unbound dns server setup.
- DHCP server setup.
- Squid setup.
- Final step iptables and sysctl.conf configuration.
Router is the device that connect two or more networks together, handling directing(routing; hence the name) network packets ( tcp/udp .. etc) correctly to the connected devices ( computers, phones, watches ..etc) on the networks.
Since the router has the capability of routing packets, it can also do traffic shaping and prioritizing connections, for example you give phone calls over udp connection higher priority than web traffic which results in clearer voice call.
Linux by default has many networking feature built-in its kernel.
Router functionallity generally does not demand much computing resources, rather other factors such as hardware speed/bandwidth is much more important, however adding squid to our setup which is cpu bound by the way raise our hardward requirments in terms of cpu cores and ( storage requirements when we activate caching )
Thats it, hardware requirements varies based on number of requests/second to serve.
Lets Suppose that each cpu core can serve 1000 requests and each request use 150KB ram on average.
- CPU/RAM ( upto 1000 requests/second, average web page size 150KB)
- 1 cpu core
- Ram 512 MB
- Disk 5 GB ( without web cache )
- Disk 50 GB ( with web cache)
- 2 cpu cores
- Ram 1 GB
- Disk 10 GB ( without web cache )
- SSD Disk 100 GB ( with web cache )
- Internet access point device / direct internet cable: we refer to as WAN-AP (Wide Area Network Acess Point)
- >= 2 ethernet cards: You can use usb based ethernet cards, however motherboard attached ethernet cards are recommended, please note as of Debian 9 (stretch) network cards are NOT given general names like eth0 eth1, but their names will reflect their firmware/pci/mac address, like esn0, enp1s1, for simpicitly we''ll refer to them as eth0, eth1.
- Wireless access point/switch: where wireless/wired devices are expected to join/connect to, if you have wired/wireless router, you may disable its routing feature, since routing will be managed by debian, we''ll refer to this access point as LAN-AP ( Local Area Network Access Point). LAN-AP will set between debian and clients devices
The following programs are used for our setup:
- isc dhcp server: its need for giving each connected device ( pc, labtop, mobile, wearable ..etc) an ip address, you can install it by running
apt-get install isc-dhcp-server
- iptables: used for filtering and redirecting traffic through squid.
- unbound: for dns queries caching, dns caching can speed up browsing significantly on slow connections, you may install it by running the following command:
apt-get install unbound
- squid: caching and http proxy server, can be used for many purposes but we''ll used it for caching web static content.
apt-get install squid
- vnstat: show aggregated statistics about internet usage ( monthly and on realtime), it can be installed by running the following command:
apt-get install vnstat
- Pick up some private network, we''ll chose 10.x.x.x, make sure its not in use by your internet service provider.
- Connect the computer to ADSL modem( or internet cable line, WAN-AP) through its primary Ethernet hub ( eth0 for example ).
- Wireless router MUST be set to access point mode (disabling router feature) and give it the static ip 10.5.5.5
- Connect the computer to Wireless router( LAN-AP ).
- Test Debian router for internet connectivity, try ping for example:
ping -c 3 red.coderme.comif ping was not successful, then you need to troubleshoot your internet connection, try to connect the ADSL or internet cable to other computer make sure that computer can connect to the internet, if only Debian router isn''t connected to the internet try switch the position of the cable, connect internet cable to eth1 and LAN-AP to eth0.