Most of this page looks horrifically out of date - it may even pre-date this whole wiki. Note references to "the woody installer"...

Networking questions (General)

I'm trying to install Debian, but I don't know which module to use for my NIC!

Press Alt-F2 to get a shell prompt. Type dmesg or ifconfig -a to see whether your NIC driver is already built in to the installation kernel. If it is, don't load any NIC drivers!

If your NIC isn't detected yet, use cat /proc/pci (since lspci isn't available in the installer) to see what hardware you have. Note that this will not show ISA or PCMCIA devices. If you can't determine which driver to use based on the output, try Google, and then ask in the channel. Use more /proc/pci instead to read PCI info one page at a time.

If you have extremely new (which means: less than two years old) hardware, then it's quite possible that the woody installer doesn't have any kernels which can handle your NIC. This is most especially true for integrated NIC chipsets in motherboards such as nvidia's nforce. In that case, you may need to install without network support (and build a custom kernel later), or find a net install image that has a kernel which will work with your hardware. You can also build your own custom net install images.

My NIC driver is loaded, and ifconfig -a shows eth0. How do I use DHCP?

Edit the /etc/network/interfaces file and put in the following lines:

auto eth0
iface eth0 inet dhcp

Then type ifup eth0 to bring up the interface.

Naming eth0 on the auto line makes the system bring up eth0 at boot time.

My NIC driver is loaded. How do I set up a static IP?

Edit /etc/network/interfaces and put in the following lines:

auto eth0
iface eth0 inet static
        address AAA.AAA.AAA.AAA
        netmask NNN.NNN.NNN.NNN
        gateway GGG.GGG.GGG.GGG

How do I add a static route, in addition to the default gateway?

You can add arbitrary commands to your interfaces in /etc/network/interfaces. These commands will be executed when the interface is brought up. For this particular example, you can add an up route add ... line. (The up means "run the following command after the interface comes up".)

You may also use the up instruction to set your NIC's speed and duplex; see below.

In general, for each up command you should include a down command which reverses its effect.

Where do I put my DNS name server addresses?

In /etc/resolv.conf. The syntax looks like this:

search my.domain
nameserver NNN.NNN.NNN.NNN
nameserver NNN.NNN.NNN.NNN

The domain you put here is appended to queries that don't already have one. For example, if you try to look up the IP address for "mail", the resolver will first try "".

Note that there is no letter e on the end of resolv in the file name. This is for historic reasons.

If your system roams from one network to another then you should consider installing the resolvconf package. It manages the resolv.conf file dynamically, obtaining nameserver addresses from DHCP and PPP clients (which get the addresses when they negotiate with the server or peer). Resolvconf also obtains nameserver addresses for statically configured interfaces from ifup. These addresses are stored on the dns-nameservers line in the logical interface definition, as follows.

auto eth0
iface eth0 inet static
        address AAA.AAA.AAA.AAA
        netmask NNN.NNN.NNN.NNN
        gateway GGG.GGG.GGG.GGG
        dns-nameservers NNN.NNN.NNN.NNN NNN.NNN.NNN.NNN

How do I set up networking with a PCMCIA card? /etc/network/interfaces didn't work!

Traditionally this was done entirely by the pcmcia-cs package -- more specifically, by the /etc/pcmcia/network script in that package. To customize the behavior of that script you edited /etc/pcmcia/network.opts. In woody, the default behavior of the script was to run ifup for the interface on card insertion and ifdown on card removal.

Nowadays we use the hotplug package to configure all devices that are hot plugged (however, note that at this time hotplug still requires that pcmcia-cs is installed). hotplug also makes use of the standard ifup mechanism for managing interfaces. Whereas pcmcia-cs ran /etc/pcmcia/network, hotplug runs /etc/hotplug/net.agent. The latter script contains a form of the ifup command that is, in effect, disabled unless the following stanza is added to the /etc/network/interfaces file:

mapping hotplug
    script echo

Where do I set my hostname?

The current system hostname is stored in memory (in the kernel). To change it, use the hostname command.

The hostname command gets run at boot time and sets the hostname to the string stored in /etc/hostname. Thus, if you want to change your hostname permananently then you must edit this file.

Usually there needs to be an entry for your hostname in /etc/hosts. Suppose your hostname is foo. If you have a statically configured network interface with address NNN.NNN.NNN.NNN then /etc/hosts should contain a line like this:


If your interface is configured dynamically via DHCP then you should have a line like this: localhost.localdomain localhost foo

or lines like these: localhost.localdomain localhost foo

so that programs are able to look up an IP address for your host even when you are not connected to a network. When the machine's NIC is configured using DHCP, the LAN's DNS server should allow you to look up the IP address for your hostname that is externally visible. To make sure that this address is found in preference to the one in /etc/hosts, make sure that the hosts: line in /etc/nsswitch.conf has

hosts:   dns files

With this configuration, attempts to look up host names take a long time if the network is down and nameserver addresses are still listed in /etc/resolv.conf. A solution is to install the resolvconf package which removes those addresses from resolv.conf when the network is down.

You may also need to edit the configuration files for various applications such as apache, exim, sendmail, qmail, etc. if you use any of them. Clients that access services such as these on the same machine should generally use localhost as the hostname.

How do I set my NIC to full duplex?

If the normal auto-sensing doesn't work for your NIC, then there are three possibilities. The first is to use the mii-tool command in an up instruction in your NIC's stanza in /etc/network/interfaces. Unfortunately, not all NICs (or drivers) are supported by mii-tool. You can also use ethtool, via /etc/network/interfaces, for NICs that don't support MII. In some other cases, you may have to load the NIC driver with special parameters. You can get a list of parameters for your driver module with modinfo. If it's not immediately clear what the parameters mean, check for documentation, or as a last resort, consult the driver's source code.

If you didn't build your NIC driver as a module, you may have to pass boot parameters (e.g. in an append= line in lilo.conf) and then reboot. Using modules for NIC drivers is strongly recommended.

How do I assign additional IP addresses to a single interface?

Add some more lines to /etc/network/interfaces, thus:

auto eth0:1
iface eth0:1 inet static
        address AAA.AAA.AAA.AAA

How do I setup e-mail clients/servers?

See MailQuestions

How do I list open network connections?

Using the deprecated net-tools package: netstat -pltuna (as Root) ToDo: equivalent ss command

CategoryNetwork | CategoryRedundant: merge with Network related pages | CategoryObsolete