Debian IP Configuration

The IP configurations on the Debian distribution of the Linux operating
system are stored in the file /etc/network/interfaces. Below is a sample
that will configure the device eth0 to have an IP address of 192.168.1.42
on a class C network with 192.168.1.1 as the default gateway.

/etc/network/interfaces:

	# /etc/network/interfaces – configuration file for ifup(8), ifdown(8)

	# the loopback interface
	auto lo
	iface lo inet loopback

	auto eth0
	iface eth0 inet static

		address   192.168.1.42
		netmask   255.255.255.0
		broadcast 192.168.1.255
		gateway   192.168.1.1

In order to assign multiple IP addresses on the same interface (eth0), add
the following stanza (incrementing the subinterface name as necessary).
The below example will add three more IP addresses to the same interface:

	auto eth0:0
	iface eth0:0 inet static

		address 192.168.1.41
		netmask 255.255.255.0
		broadcast 192.168.1.255

	auto eth0:1
	iface eth0:1 inet static

		address 192.168.1.44
		netmask 255.255.255.0
		broadcast 192.168.1.255

	auto eth0:2
	iface eth0:2 inet static

		address 192.168.1.45
		netmask 255.255.255.0
		broadcast 192.168.1.255

To update your system’s IP configuration after making changes to
/etc/network/interface, execute:

	# /etc/init.d/networking restart

Make sure to double-check your configuration as this could leave your
server unreachable.

--------------------------------------------------------------------------------

To change the MTU of an interface on GNU/Linux, you just need to tell ifconfig
to do so, like this for example:

	#/sbin/ifconfig eth0 mtu 1492

To change it permanently on Debian, put it in the /etc/network/interfaces file
where almost all network parameters are found. To do this, just add a line mtu
to the definition of your interface and save the file.

	iface eth0 inet static
	  address 192.168.0.1
	  network 192.168.0.0
	  gateway 192.168.0.254
	  netmask 255.255.255.0
	  mtu 1492



Warning: the following is mostly obsolete in Debian Sid and Etch

It seems that the dhcp clients are not configured by default to do the same
for dynamically assigned configurations. So, you need to use a tweak to achieve
the same. We’re going to use the pre-up feature of /etc/network/interfaces
like this:

	iface eth0 inet dhcp
	  hostname “mymachine”
	  name LAN Interface
	  pre-up /sbin/ifconfig $IFACE mtu 1492

More common Recommended Values:

	Dial-up Connections - 576 Bytes
	PPPoE Broadband Connections - 1492 Bytes
	Ethernet, DSL and Cable Broadband Connections - 1500 Bytes

--------------------------------------------------------------------------------

To use a wireless card with a WEP or other secure keying mechanism, try the
iwconfig command which works for WEP keys.

ifup eth1
iwconfig
iwconfig --help
iwconfig eth1 mode managed
iwconfig eth1 essid aph
iwconfig eth1 key xxx
iwconfig eth1 commit
dhclient eth1

The iwconfig commands can be integrated into the debian /etc/network/interfaces
configuration file. The following options from the interfaces file demonstrate
the use of the iwconfig syntax to bring up a wireless interface with WEP. The
"commit" stanza does not appear to work when added to the interfaces file as
it does not have an argument to the action:

#debian:/etc/networking/interfaces:
	auto eth1
	iface eth1 inet dhcp
		wireless-mode  managed
		wireless-essid aph
		wireless-key   xxxxxxxx

--------------------------------------------------------------------------------

To bring up an interface without an IP address configuration method such as dhcp
or static ip addressing, use "manual". This is a highly specialized method which
may be useful for bridging a VMware vSwitch to the pNIC.

#debian:/etc/networking/interfaces:
	auto eth1
	iface eth1 inet manual