Wednesday, August 13, 2008

Basic Command in Linux

The basic commands used in Linux are common to every distro:

ifconfig - Configures and displays the IP parameters of a network interface
route - Used to set static routes and view the routing table
hostname - Necessary for viewing and setting the hostname of the system
netstat - Flexible command for viewing information about network statistics, current connections, listeing ports
arp - Shows and manages the arp table
mii-tool - Used to set the interface parameters at data link layer (half/full duplex, interface speed, autonegotiation...)

Many distro are now including the iproute2 tools with enhanced routing and networking tools:

ip - Multi purpose command for viewing and setting TCP/IP parameters and routes.
tc - Traffic control command, used for classifying, prioritizing, sharing, and limiting both inbound and outbound traffic.

Every distro has its own configuration tool that operate on variously defined configuration files.
Some of them are common: /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts, /etc/services, /etc/protocols

Some, typically the ones where are defined IP addresses and routes, change. Here are some relevant files for various distro, their syntax may vary according the scripts used to handle them:



Debian
/etc/network/interfaces - Interfaces and network parameters

RedHat
Graphical interface: redhat-config-network
/etc/sysconfig/network-scripts/ifcfg-* - Configuration files for each interface.

The same file can be found, divided per profile, in /etc/sysconfig/networking/devices/*
/etc/sysconfig/network - Hostname, default gateway, general configuration
/etc/sysconfig/static-routes - Static routes (if any)

SlackWare
Graphical interface: Netconfig
/etc/rc.d/rc.inet1 - IP and network parameters
/etc/rc.d/rc.inet2 - Network Services configuration

Mandrake
Graphical interface: Drakconnect
/etc/sysconfig/network-scripts/ifcfg-* - Configuration files for each interface. The same file can be found, divided per profile, in /etc/sysconfig/networking/devices/*
/etc/sysconfig/network - Hostname, default gateway, general configuration
/etc/sysconfig/static-routes - Static routes (if any)

Gentoo
/etc/conf.d/net - Ip network and interfaces parameters
/etc/conf.d/routes - Static routes

SUSE
Graphical interface: Yast2
/etc/sysconfig/network/ifcfg-* - Configuration files for each interface.
/etc/sysconfig/network/config - General network configuration.

Fedora - Network configuration

Netowrk confgiruation on Fedora 2 is quite similar to the one for other versions of RedHat Linux,
besides the standard files, the main configuration is done on /etc/sysconfig/network where is defined the hostname and can be placed the default gateway and in the files of the /etc/sysconfig/network-scripts/ directory.

The TCP/IP network setup is done with the script /etc/init.d/network, with obviously must be started before other network services on a connected machine.
The official graphical configuration tool is system-config-network (Menu System Settings - Network), from here is possible to define the IP parameters for all the interfaces found on the system (tab Devices, modifies the /etc/sysconfig/network-scripts/ifcfg-interface and /etc/sysconfig/networking/devices/ifcfg-interface files), the IP of the DNS servers (tab DNS, modifies /etc/resolv.conf), the static host IP assignement (tab Hosts, modifies /etc/hosts).

Fedora supports also user's profiles, with differnet network settings.
The Network Configuration tools easily let the user define a profile and its parameters, the relevant system files are placed in the directory /etc/sysconfig/networking/profiles/profilename/. Currently Fedora doesn not allow the definition of a profile at boot time, when the machine is started the default "Common" profile is used, to switch to a custom one either launch system-config-network graphical tool and select your profile or type system-config-network-cmd -p profilename --activate.
RedHat provides other network configuration tools:
netconfig is an old text configuration tool, which is obsolete and may be used to a fast configuration;
system-config-network-tui is the text version of the graphical Network Configuration Tool.
system-config-network-druid (Menu System tools - Internet configuration wizard) is a guided wizard which helps an easy configuration of Ethernet, modem, ISDN, DSL, wireless configuration.

Firewall configuration
Red Hat stores the firewall configuration in the /etc/sysconfig/iptables file which is formatted in order to be used by the iptables-restore command. Firewalling is managed with the /etc/init.d/iptables script which can be followed by arguments like start to activate firewalling, stop to disable it, panic to shutdown any Internet access, status to view the current iptables rules.
A simple and not extremely flexible configuration tool is system-config-firewall, which is adeguate for a desktop machine but surely not for a router/firewall.

5 comments:

Anonymous said...



Feel fгee to surf to my site :: payday loans uk

Anonymous said...



Also visit my homepage - Pay Day loan

Anonymous said...

a x x n z
scrabble dictionary free k w 0 d
2 l 5 4 5
8 6 p 2 0 q s
n o 9 s q v

[url=http://scrabblehelp.biz]scrabble cheat help[/url] By scrabblehelp.biz

Anonymous said...

Hi there! I just wanted to ask if you ever have any trouble with hackers?
My last blog (wordpress) was hacked and I ended up losing months of hard work due to no
data backup. Do you have any methods to prevent hackers?


Visit my web page: instant payday loans

Anonymous said...

What's up, yes this paragraph is in fact nice and I have learned lot of things from it on the topic of blogging. thanks.

Also visit my page; loans in canada