Wednesday, August 14, 2013

Setting up Network (Red Hat based System)

Segment 1
The easiest way to setup network is by using the following commands-
# setup > network settings

Used for setting up network parameters
# system-config-network

Used for setting up network parameters
# service network restart
Restarts the network service
# ifconfig
Check the network parameters

Network related files

/etc/sysconfig/network-scripts/

This directory contains a single file for each network adapter named ifcfg-eth0, ifcfg-eth1, ifcfg-eth2 and so on. The contents of the file are:
NAME= eth0
name of the device
DEVICE=eth0
Device id
BOOTPRO= none/static/dhcp
none/static are used for static IP address.dhcp is used for automatic IP address.
IPADDR= X.X.X.X
4 bit IP address
NETMASK= X.X.X.X
Netmask of the provided IP address
GATEWAY= X.X.X.X
IP address of the gateway server/router
USERCTL= yes/no
Whether normal users are able to change IP address

/etc/resolv.conf

DNS IP is set in this file. Keep in mind that the there are some International free DNS that can be used such as 4.2.2.1, 4.2.2.2, 8.8.8.8.
nameserver X.X.X.X

/etc/sysconfig/network

This file is primarily used to set hostname.
HOSTNAME = stationX.example.com

/etc/hosts

This file is used in case the hostname has to be resolved locally. The following line should be added-
IP
FQDN
Hostname
X.X.X.X
stationX.exaple.com
stationX

Troubleshooting

When troubleshooting any network, the following commands can be used.
mii-tool
Note that there is no space in the command. Used for checking whether the cable is connected to the Network Interface Card.
ping X.X.X.X
If physical connection is okay, you should get a reply with information like latency and TTL.
# traceroute X.X.X.X
Used for tracing the path to a specific IP or domain.
                 
Segment 2

Virtual Interfaces

Each NIC card in Linux can be used to create virtual interfaces which contain separate IP addresses. As a result, one can use a single LAN card to create multiple virtual LAN cards with specific IP address.

Procedure:

1.     Create a copy of the LAN card configuration file and make changes as necessary. The following example contains minimum configuration-
# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0  ifcfg-eth0:1
# vim ifcfg-eth0:1
                 
      NAME=eth0:1
      DEVICE=eth0:1
      IPADDR= Y.Y.Y.Y
      SUBNET= Y.Y.Y.Y
2.  # service network restart

Check whether you can find the IP address of the virtual interface with ifconfig. If you’re successful, try pinging the IP address from local, as well as remote machines.

0 comments: