/ Server / Debian Router - Network Interfaces Configuration


Published:2015-06-12T13:23:24Z Edited:2017-06-22T13:23:24Z
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
Debian Router - iptables and sysctl.conf configuration
Previous
Debian Router - DHCP server setup
Tags