How to enable IP Forwarding in Debian

IP routing/forwarding is disabled per default in Debian.
For enabling on the fly, you only have to write “1″ in /proc/sys/net/ipv4/ip_forward or to set the kernel parameter net.ipv4.ip_forward to “1″.

Method #1:
echo 1 > /proc/sys/net/ipv4/ip_forward
Method #2:
sysctl -w net.ipv4.ip_forward=1

The actual setting can be checked as following:

debian:~# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
debian:~# cat /proc/sys/net/ipv4/ip_forward
1
debian:~#

If you want permanent setting, the most [...]

Bringing up an interface without an IP address

To create a network interface without an IP address at all use the manual method and use pre-up and post-down commands to bring the interface up and down.
This can be necessary, when you like to bridge a VMWare VM to this interface or when it’s connected to a mirror port on the switch for sniffing [...]

Network configuration with /etc/network/interfaces

When you use Debian Linux, you can administrate your network settings via /etc/network/interfaces.
Here’s a simple example to demonstrate syntax and parameters of the configuration file.

# loopback interface
auto lo
iface lo inet loopback
 
# Interface eth0 gets its IP via DHCP
auto eth0
iface eth0 inet dhcp
# Static IP for eth1
auto eth1
iface eth1 inet static
  address 192.168.222.140
  netmask 255.255.255.0
  network 192.168.222.0
  broadcast 192.168.222.255
  # Default gateway not [...]