Setting Up Network Interfaces in Linux

By | September 17, 2009


06 - ResolvConf

Save it as well. Pay attention that you need to introduce the data received from the administrator of your network, not the ones used in this example.

For the changes to take place you need to restart network services (the system reads configurative files and automatically reconfigures network interfaces using ifconfig command). To do so, enter the following command in terminal:

sudo service networking restart

If there is DHCP server, for the automatic configuration you just need to add to configurative file (/etc/network/interfaces):

auto lo eth0
iface lo inet loopback

iface eth0 inet dhcp

… and restart network services. Moreover in this case there is no need to enter your DNS server in /etc/resolv.conf, because the system will make it for you.

For now let’s talk a little bit more in detail about ifup and ifdown commands. The ifup and ifdown commands should be used to configure (and, respectively, deconfigure) network interfaces based on interface definitions in the file /etc/network/interfaces.  Here are some of the options to use with these commands:

-a (all)

If given to ifup, affect all interfaces marked auto. Interfaces are brought up in the order in which they are defined in /etc/network/interfaces. If given to ifdown, affect all defined interfaces. Interfaces are brought down in the order in which they are currently listed in the state file. Only interfaces defined in /etc/network/interfaces will be brought down.

-h (help)

Show summary of options.

-n (no act)

Don’t configure any interfaces or run any “up” or “down” commands.

-v, –verbose

Show commands as they are executed.

For example:

ifup -a

Bring up all the interfaces defined with auto in /etc/network/interfaces

If you would like to check other options for given commands, please visit this page.

While using the above mentioned commands, you need to take into consideration that network manager of modern operating systems independently manages network settings, so it can rewrite the data introduced by you.

To check network operability you should start from data exchange with any computer of your network, for example, with yourself (your own ip address) or gateway. There is ping command for that. Here is the way it would look if you used the above parameters:

# ping

In case of success you will get something like this:

$ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=255 time=2.39 ms
64 bytes from icmp_seq=2 ttl=255 time=2.34 ms
64 bytes from icmp_seq=3 ttl=255 time=2.43 ms
64 bytes from icmp_seq=4 ttl=255 time=3.62 ms

To terminate the command enter Ctrl + C:

— ping statistics —

4 packets transmitted, 4 received, 0% packet loss, time 3000ms

rtt min/avg/max/mdev = 2.343/2.698/3.623/0.537 ms

For now let’s see how you can diagnose the problems. Most likely some of the terms we are going to use won’t be familiar to you, still we feel the necessity to mention them, at least to give you an opportunity to check them if you need to.

3 thoughts on “Setting Up Network Interfaces in Linux

  1. Pingback: PPPoE Connection | LAMPDocs

  2. C H Tan

    hello vadim:
    this is an excellent work for beginners.

    I’m using Ubuntu 8.40. But the system-preferences do not give a link to network connections! so, I’m not getting the graphical interface that you have shown. Am I missing something?

    Could you kindly clarify?

    Thanks very much.

    1. Vladimir Usenco

      Could you, please, specify, what are you exactly getting?

Comments are closed.