Free Hosting Online for WorkStations

< Previous | Contents | Next >

This instructs your computer to look up hostnames and IP addresses first in the /etc/hosts file, and to contact the DNS server if a given host does not occur in the local hosts file. Other possible name services to contact are LDAP, NIS and NIS+.


More in man nsswitch.conf.


10.2.3. Network configuration commands


10.2.3.1. The ip command


The distribution-specific scripts and graphical tools are front-ends to ip (or ifconfig and route on older systems) to display and configure the kernel's networking configuration.


The ip command is used for assigning IP addresses to interfaces, for setting up routes to the Internet and to other networks, for displaying TCP/IP configurations etcetera.


The following commands show IP address and routing information:


benny@home benny> ip addr show

1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 brd 127.255.255.255 scope host lo inet6 ::1/128 scope host

2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100 link/ether 00:50:bf:7e:54:9a brd ff:ff:ff:ff:ff:ff

inet 192.168.42.15/24 brd 192.168.42.255 scope global eth0 inet6 fe80::250:bfff:fe7e:549a/10 scope link


benny@home benny> ip route show 192.168.42.0/24 dev eth0 scope link 127.0.0.0/8 dev lo scope link default via 192.168.42.1 dev eth0

benny@home benny> ip addr show

1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 brd 127.255.255.255 scope host lo inet6 ::1/128 scope host

2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100 link/ether 00:50:bf:7e:54:9a brd ff:ff:ff:ff:ff:ff

inet 192.168.42.15/24 brd 192.168.42.255 scope global eth0 inet6 fe80::250:bfff:fe7e:549a/10 scope link


benny@home benny> ip route show 192.168.42.0/24 dev eth0 scope link 127.0.0.0/8 dev lo scope link default via 192.168.42.1 dev eth0

Things to note:


two network interfaces, even on a system that has only one network interface card: "lo" is the local loop, used for internal network communication; "eth0" is a common name for a real interface. Do not ever change the local loop configuration, or your machine will start mallfunctioning! Wireless interfaces are usually defined as "wlan0"; modem interfaces as "ppp0", but there might be other names as well.

• IP addresses, marked with "inet": the local loop always has 127.0.0.1, the physical interface can have any other combination.

• The hardware address of your interface, which might be required as part of the authentication procedure to connect to a network, is marked with "ether". The local loop has 6 pairs of all zeros, the physical loop has 6 pairs of hexadecimal characters, of which the first 3 pairs are vendor-specific.


10.2.3.2. The ifconfig command


While ip is the most novel way to configure a Linux system, ifconfig is still very popular. Use it without option for displaying network interface information:


els@asus:~$ /sbin/ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:70:31:2C:14

inet addr:60.138.67.31 Bcast:66.255.255.255 Mask:255.255.255.192

inet6 addr: fe80::250:70ff:fe31:2c14/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:31977764 errors:0 dropped:0 overruns:0 frame:0 TX packets:51896866 errors:0 dropped:0 overruns:0 carrier:0 collisions:802207 txqueuelen:1000

RX bytes:2806974916 (2.6 GiB) TX bytes:2874632613 (2.6 GiB)

Interrupt:11 Base address:0xec00 inet addr:127.0.0.1 Mask:255.0.0.0


lo Link


inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:765762 errors:0 dropped:0 overruns:0 frame:0 TX packets:765762 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0

RX bytes:624214573 (595.2 MiB) TX bytes:624214573 (595.2 MiB)

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:765762 errors:0 dropped:0 overruns:0 frame:0 TX packets:765762 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0

RX bytes:624214573 (595.2 MiB) TX bytes:624214573 (595.2 MiB)

Here, too, we note the most important aspects of the interface configuration:


• The IP address is marked with "inet addr".

• The hardware address follows the "HWaddr" tag.


Both ifconfig and ip display more detailed configuration information and a number of statistics about each interface and, maybe most important, whether it is "UP" and "RUNNING".


10.2.3.3. PCMCIA commands


On your laptop which you usually connect to the company network using the onboard Ethernet connection, but which you are now to configure for dial-in at home or in a hotel, you might need to activate the PCMCIA card. This is done using the cardctl control utility, or the pccardctl on newer distributions.


A usage example:


cardctl insert


Now the card can be configured, either using the graphical or the command line interface. Prior to taking the card out, use this command:


cardctl eject


However, a good distribution should provide PCMCIA support in the network configuration tools, preventing users from having to execute PCMCIA commands manually.


10.2.3.4. More information


Further discussion of network configuration is out of the scope of this document. Your primary source for extra information is the man pages for the services you want to set up. Additional reading:


• The Modem-HOWTO: Help with selecting, connecting, configuring, trouble-shooting, and understanding analog modems for a PC.

Top OS Cloud Computing at OnWorks: