Wednesday 28 December 2011

NETWORK CONFIGURATION

                                           NETWORK CONFIGURATION
Networking scripts refer to logical interface names:
Ethernet
Dial-up
Loopback
:
:
:
eth0, eth1 …
ppp0, ppp1 …
lo
Driver selection:
 All drivers for network interface cards are built as modules
 /etc/modprobe.conf maps logical names to specific module name
Ex: alias eth0 r8179
 Network interface modules are loaded at boot time if networking has been enabled
    The appropriate module is loaded based on a alias line in /etc/modprobe.conf
 To view the module aliases
          grep ‘alias eth’ /etc/modprobe.conf
          ifconfig eth0 -View interface configuration
          netconfig - text based network configuration tool, only write config files,
          system-config-network - graphical tool to configure ipaddr

Use ifup and ifdown to activate the changes
    ifup eth0 -Enable eth0 interface
    ifdown eth0 -Disable eth0 interface
    mii-tool - This utility checks or sets the status of a network interface’s Media Independent
    Interface (MII) unit. Most fast ethernet adapters use an MII to auto negotiate link speed and
duplex setting
   ethtool - Display or change ethernet card settings
   kudzu - detects and configures new and/or changed hardware on a system
  Kudzu detects and configures new and/or changed hardware on a system.
  When started, kudzu detects the current hardware, and checks it against a database stored in
      /etc/sysconfig/hwconf, if one exists.
  It then determines if any hardware has been added or removed from the system.
     If so, it gives the users the opportunity to configure any added hardware, and unconfigure any
     removed hardware. It then updates the database in /etc/sysconfig/hwconf.
They do not activate device or changes
ethtool eth0

DEVICE CONFIGURATION IS STORED IN TEXT FILES
/etc/sysconfig/network-scripts/ifcfg-ethX

NETWORK CONFIGURATION IS STORED IN
/etc/sysconfig/network

CONFIGURING SECOND IPADDR OF THE SYSTEM:
netconfig --device eth1

BINDING MULTIPLE IP ADDRESSES:
For a small number of IP's, create ifcfg file for a virtual interface
ifcfg-ethX:XXX
For a large number of IP's create an ifcfg range file
ifcfg-ethX-rangeX
vim /etc/sysconfig/network-scripts/ifcfg-eth0-range0

IPADDR_START=192.168.1.1
IPADDR_END=192.168.1.255
CLONENUM_START=0
At the maximum of 256 IP address may be configured in a single NIC
Ex: Many websites running on a same server, this is used to identify different websites

DHCP/BOOTP:
dhclient - manages to configure ip address through dhcp/bootp

DEFAULT ROUTE:
Default gateway of the system

STATIC ROUTES:
It can be configured in two ways
ip route add 192.168.22.0/24 via 10.53.0.100
service network restart
ip route
Mount permanently using the following
vim /etc/sysconfig/network-scripts/route-ethX

IP/CIDR via GATEWAY
Ex: 192.168.22.0/24 via 10.53.0.100
Adds a static route to the 192.168.22.* network through 10.53.0.100 router
service network restart
If we have more than one interfaces use the following.
vim /etc/sysconfig/networking/devices/ethX.route
ADDRESS0=192.168.3.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.0.100
For the second static route uses ADDRESS1/NETMASK1/GATEWAY1, and so on.

DISPLAY STATIC ROUTES WITH:
route
route -n
netstat
connections, and multicast memberships
netstat -r
ip route
- show / manipulate the IP routing table
-
Print
network connections, routing tables, interface statistics, masquerade,

CHANGING HOSTNAME:
Hostname is set initially by /etc/rc.sysinit at the boot time
If we want to change the Hostname:
Then change the hostname in the following file
hostname=stationX.example.com (temporary entry)
vim /etc/sysconfig/network
service network restart
Changes will be activated at the logout

LOCAL DATABASE OF HOSTNAME TO IP ADDRESS MAPPINGS (OR) LOCAL RESOLVER
vim /etc/hosts
192.168.0.X
stationX.example.com
stationX

DNS RESOLVER:
vim /etc/resolv.conf
search example.com cracker.org
nameserver 192.168.0.254
nameserver 192.168.1.254

DNS UTILITIES:
nslookup
nslookup
dig
dig -x
 By default looks at both the nameserver and search lines in /etc/resolv.conf
host
host -l
 By default looks only at the nameserver line in /etc/resolv.conf

NETWORK DIAGNOSTICS:
ping - Network packet loss and latency measurement tool
Ex:
The default behavior of ping is to send 64-byte ICMP packet to the specified host every
second until you cancel the operation with a Ctrl-c. When ping operation is cancelled or done, ping
will report summary statistics such as aversge packet loss, number of packets sent/received, etc.
These statistics can allow us to measure the quality of the network between hosts.
traceroute, mtr
Displays network path to a destination
ping 192.168.0.254
Ping –c 4 192.168.0.254

No comments:

Post a Comment