Archive for the ‘Chennai’ Category

Linux Networking

Friday, September 12th, 2008

TCP/IP Network Configuration Files:

File: /etc/resolv.conf - host name resolver configuration file

search name-of-domain.com - Name of your domain or ISP’s domain if using their name server

nameserver XXX.XXX.XXX.XXX - IP address of primary name server

nameserver XXX.XXX.XXX.XXX - IP address of secondary name server

This configures Linux so that it knows which DNS server will be resolving domain names into IP addresses. If using DHCP client, this will automatically be sent to you by the ISP and loaded into this file as part of the DHCP protocol. If using a static IP address, ask the ISP or check another machine on your network.

Red Hat/Fedora GUI: /usr/sbin/system-config-network (select tab “DNS”).

Fedora/Red Hat Network Configuration Files:

Ø /etc/sysconfig/network

Red Hat network configuration file used by the system during the boot process.

Ø File: /etc/sysconfig/network-scripts/ifcfg-eth0

Configuration settings for your first ethernet port (0). Your second port is eth1.

Ø File:

· /etc/modprobe.conf (kernel 2.6)

· /etc/modules.conf (kernel 2.4)

· (or for older systems: /etc/conf.modules)

· Example statement for Intel ethernet card:

Ubuntu/Debian IP Configuration Files:

File: /etc/network/interfaces

Static IP example:

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static

address 208.88.34.106

netmask 255.255.255.248

broadcast 208.88.34.111

network 208.88.34.104

gateway 208.88.34.110

Changing the host name:

  1. Issue the command: hostname new-host-name
  2. Change network configuration file: /etc/sysconfig/network

Edit entry: HOSTNAME=new-host-name

  1. Restart systems which relied on the hostname (or reboot):

    • Restart network services: service network restart

(or: /etc/init.d/network restart)

    • Restart desktop:
    • Bring down system to console mode: init 3
    • Bring up X-Windows: init 5

One may also want to check the file /etc/hosts for an entry using the system name which allows the system to be self aware.

The hostname may be changed at runtime using the command: sysctl -w kernel.hostname=”superserver”

Network IP aliasing:

Config file: /etc/sysconfig/network-scripts/ifcfg-eth0:0

DEVICE=eth0:0

ONBOOT=yes

BOOTPROTO=static

BROADCAST=192.168.10.255

IPADDR=192.168.10.12

NETMASK=255.255.255.0

NETWORK=192.168.10.0

ONBOOT=yes

Activating and De-Activating your NIC:

Commands for starting and stopping TCP/IP network services on an interface:

  • Activate: /sbin/ifup eth0

(Also: ifconfig eth0 up - Note: Even if no IP address is assigned you can i isten.)

  • De-Activate: /sbin/ifdown eth0

(Also: ifconfig eth0 down)

These scripts use the scripts and NIC config

files in /etc/sysconfig/network-scripts/

GUI Interface control/configuration:

  • Start/Stop network interfaces

/usr/bin/system-control-network (Fedora Core 2/3)

/usr/bin/redhat-control-network (RH 9.0 - FC-1)

  • Configure Ethernet, ISDN, modem, token Ring, Wireless or DSL network connection:

/usr/sbin/system-config-network-druid (FC2/3)

/usr/sbin/redhat-config-network-druid (RH 9 - FC-1)