Free Hosting Online for WorkStations

< Previous | Contents | Next >

There are many more names, for instance for Virtual Private Network interfaces (VPNs), and multiple interfaces can be active simultaneously, so that the output of the ifconfig or ip commands might become quite extensive when no options are used. Even multiple interfaces of the same type can be active. In that case, they are numbered sequentially: the first will get the number 0, the second will get a suffix of 1, the third will get 2, and so on. This is the case on many application servers, on machines which have a failover configuration, on routers, firewalls and many more.


10.2.5. Checking the host configuration with netstat


Apart from the ip command for displaying the network configuration, there's the common netstat command which has a lot of options and is generally useful on any UNIX system.


Routing information can be displayed with the -nr option to the netstat command:


bob:~> netstat -nr

Kernel IP routing table


Destination

Gateway

Genmask

Flags

MSS

Window

irtt

Iface

192.168.42.0

0.0.0.0

255.255.255.0

U

40

0

0

eth0

127.0.0.0

0.0.0.0

255.0.0.0

U

40

0

0

lo

0.0.0.0

192.168.42.1

0.0.0.0

UG

40

0

0

eth0

This is a typical client machine in an IP network. It only has one network device, eth0. The lo interface is the local loop.


The modern way

The novel way to get this info from your system is by using the ip command:


ip route show

When this machine tries to contact a host that is on another network than its own, indicated by the line starting with 0.0.0.0, it will send the connection requests to the machine (router) with IP address 192.168.42.1, and it will use its primary interface, eth0, to do this.


Hosts that are on the same network, the line starting with 192.168.42.0, will also be contacted through the primary network interface, but no router is necessary, the data are just put on the network.


Top OS Cloud Computing at OnWorks: