Debian Router - Network Interfaces Configuration

Updated:2021-12-03
Share:

In preparation of using debian as a router, We'll configure network interfaces, after performing initial setup.  

  In this debian router articles series also:

  1. Introduction.
  2. Hardware Requirements.
  3. Software installation.
  4. Basic Setup.
  5. /etc/network/Interfaces Configuration. (We are Here!)
  6. Unbound dns server setup.
  7. DHCP server setup.
  8. Squid setup.
  9. 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  


  Next Unbound dns server setup

Read also

Debian Router - Setup

![Debian router](/media/images/debian-router-coderme.png) In this articles series you will learn how to setup Linux (Debian) as a Router for home/business local networks, to spice things I'll show how to add dns server, proxy/web caching server, and basic web traffic filter to our cute debian box. ......

Debian Router - Squid setup

We've [configured the dhcp server](/using-linux-debian-as-router-dhcp-server-setup), so what's for today?! Today we'll configure Squid for caching web traffic and access control.     In this debian router articles series also: 1. [Introduction](/using-linux-debian-as-router-setup#intro). 2. [Hard......

Debian Router - DHCP server setup

We've learned [previously](/using-linux-debian-as-router-unbound-dns-server-setup) how to set up unbound dns server as caching dns server for our LAN users, in this article we'll configure dhcp server from which a unique ip address for each client assigned as a bonus automatically configure dns serv......

Debian Router - iptables and sysctl.conf configuration

Tody we'll finish configuring our awesome router, in the [previous](/using-linux-debian-as-router-squid-setup) article we'd configured squid proxy, in this article we'll pass all LAN traffic through squid using iptables.    In this debian router articles series also: 1. [Introduction](/using-linu......

Debian Router - Unbound DNS Server Setup

In the [previous artilce](using-linux-debian-as-router-etc-network-interfaces-configuration) we've configured network interfaces, so by now debian box is connected to internet through WAN-AP on eth0 and to local network throuch LAN-AP on eth1. Today we'll setup unbound dns server to serve dns querie......