Debian Router - Network Interfaces Configuration
In preparation of using debian as a router, We'll configure network interfaces, after performing initial setup.
In this debian router articles series also:
- Introduction.
- Hardware Requirements.
- Software installation.
- Basic Setup.
- /etc/network/Interfaces Configuration. (We are Here!)
- Unbound dns server setup.
- DHCP server setup.
- Squid setup.
- Final step iptables and sysctl.conf configuration.
We'll modify /etc/network/interfaces for setting up the network, as said previously eth0, eth1 are used for KISS sake only.
Lets start our network interfaces automatically after boot, add the folowing:
# automatic start the following interfaces: auto eth0 eth1
If you use usb ethernet cards, then its helpful to start/stop interfaces whenever you plug/unplug usb cards, then add the following:
# usb interfaces support for plug/unplug: allow-hotplug eth0 eth1
eth0 is the primary ethernet get its internet/wan ip address from WAN-AP so add the following:
# primary ethernet (connected to the WAN-AP) iface eth0 inet dhcp
eth1 is the secondary ethernet connected to LAN-AP, we need to assign it a static ip address by our DHCP server, add the following:
# secondery ethernet (connected to LAN-AP) iface eth1 inet static
address 10.5.5.1 netmask 255.255.255.0
network 10.5.5.0
broadcast 10.5.5.255
gateway 10.5.5.1
After applying these changes your /etc/network/interfaces may will look similar to the following:
# The loopback network interface:
iface lo inet loopback
# automatic start the following interfaces:
auto lo eth0 eth1
# usb interfaces support for plug/unplug
allow-hotplug eth0 eth1
# primary ethernet (connected to the WAN-AP)
iface eth0 inet dhcp
# secondery ethernet (connected to LAN-AP)
iface eth1 inet static
address 10.5.5.1
netmask 255.255.255.0
network 10.5.5.0
broadcast 10.5.5.255
gateway 10.5.5.1