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 [...]

apt - Fix GPG error

When doing an apt-get update to refresh index files from their sources, the indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list
Sometimes you will see an error like that:

debian:~# apt-get update
Get:1 http://www.backports.org etch-backports Release.gpg [189B]
Hit http://www.backports.org etch-backports Release    
~             
~
(output shortened)
~
~
Hit http://security.debian.org etch/updates/contrib Packages
Hit http://security.debian.org etch/updates/main Sources
Hit http://security.debian.org etch/updates/contrib Sources
Fetched 180kB in 2s (75.2kB/s)
Reading [...]

Using apt with proxy

If you are using APT (Advanced Package Tool) and you are bound to use a proxy server to connect to the internet, you have to configure it as follows.
If not existent, you have to create the file /etc/apt/apt.conf

touch /etc/apt/apt.conf

Now insert the following line…

Acquire::http::Proxy http://username:password@proxy:8080;

Please adjust the parameters to your requirements.
When you try “apt-get update”, it [...]

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 [...]