<< Prev. Page: Linux Network Administration Commands
A connection to a network made through a hardware interface Ethernet card or a modem and data passes through it. /etc/rc.d/init.d/network initialization file executes when the system starts.
ifconfig
The command configures the network interface, and it automatically generates a standard broadcast address and netmask.
It assigns the IP address to the interface. The commands argument includes the name of an interface and an IP address, as well as options. The domain used for the IP address provided it is listed along with IP address in the /etc/hosts file.
IP Address: host address or network address
# ipconfig interface -host_net_flag address options
-host_net_flag: -host or -net to indicate host or network IP address. The -host is default.
Options
- interface: Name of the network interface; eth0 for first Ethernet device or ppp0 for the first PPP device (modem)
- mtu n: maximum number of bytes it can transfer on an interface
- up: Activates an interface; implied if the IP address is specified
- down: Deactivates an interface
- allmulti: Turns on or off the promiscuous mode; preceding hyphen (-) turns it off; it allows network monitoring
- dstaddr address: Destination IP address on a point-to-point connection like Paralle IP (PLIP), Serial Line IP (SLIP). The Point-to-point operates between two hosts connected over a modem. The PLIP interface name identified with plip with an attached number, plip0 is the first PLIP interface. SLIP interface use slip0 and PPP interface starts with ppp0.
- point-to-point address: Point-to-point mode interface, if an address included, it is assigned to a remote system
- netmask address: specify IP network mask; preceding hyphen (-) turns it off
- broadcast address: Specify broadcast address; preceding hyphen (-) turns it off
- hw: Sets hardware address of an interface
# ifconfig eth0 192.168.0.1
route
Setup network connections accordingly
Static route: On small networks, one system knows how to reach another by moving through fixed paths. It keeps track of all the network connections.
Dynamic route: On large networks like Internet packets transmitted from one computer to another takes a specific route to reach its destination. The route determines where the process starts and what is needed to send the packet to reach its destination.
The routes listed in /proc/net/route file. To display the routing table enter the command route with no arguments or netstat -r
Argument
- add: To add routes either for the networks with the -net option or with the -host (default) option for IP interfaces (hosts)
- del
Parameters:
- netmask
- gateway (gw): IP address or hostname of the gateway the route uses
- interface device (dev) for more than one IP interface such as several Ethernet cards,
- and the default route (default)
IP Aliasing
It assigns a single Ethernet card to listen for added IP addresses. It is used to set up multiple IP-based virtual hosts for Internet servers. It enables the user to run several web servers on the same machine using a single interface. Thus can run different websites accessed with separate IP addresses on the same system.