UNIX Network
UNIX Network
Ethernet interfaces are identified by the system using the naming convention of ethx, where
x represents a numeric value. The first Ethernet interface is typically identified as eth0, the
second as eth1, and all others should move up in numerical order.
To quickly identify all available Ethernet interfaces, you can use the ifconfig command as
shown below.
IP addressing
The following section describes the process of configuring your systems IP address and
default gateway needed for communicating on a local area network and the intenet.
By adding an interface configuration as shown above, you can manually enable the interface
through the ifup command which initiates the DHCP process via dhclient.
$sudo ifup eth0
To manually disable the interface, you can use the ifdown command, which in turn will
initiate the DHCP release process and shut down the interface.
$sudo ifdown eth0
To configure your system to use a static IP address assignment, add the static method to the
inet address family statement for the appropriate interface in the file
/etc/network/interfaces. The example below assumes you are configuring your first
Ethernet interface identified as eth0. Change the address, netmask, and gateway values to
meet the requirements of your network.
auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1
By adding an interface configuration as shown above, you can manually enable the interface
through the ifup command.
$sudo ifup eth0
To manually disable the interface, you can use the ifdown command.
$sudo ifdown eth0
2
Loopback interface:
The loopback interface is identified by the system as lo and has a default IP address of
127.0.0.1. It can be viewed using the ifconfig command.
$ifconfig lo
By default, there should be two lines in /etc/network/interfaces responsible for
automatically configuring your loopback interface. It is recommended that you keep the
default settings unless you have a specific purpose for changing them. An example of the
two default lines are shown below.
auto lo
iface lo inet loopback
netstat
Displays contents of /proc/net files. It works with the Linux network subsystem; it
will tell you what the status of ports are i.e. open, closed, waiting, masquerade connections.
It will also display various other things. It has many different options.
ping
the ping command sends echo requests to the host you specify on the command line, and
lists the response received their round trip time. You can use ping as:
traceroute
traceroute will show the route of a packet. It attempts to list the series of hosts through
which your packets travel on their way to a given destination.
$traceroute machine_name
Or $traceroute ip_address
nmap
“network exploration tool and security scanner”. nmap is a very advanced network tool
used to query machines (local or remote) as to whether they are up and what ports are
open on these machines.
$nmap machine_name
This would query your own machine as to what ports it keeps open.