• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Wednesday, October 16, 2013

    How to configure network in Red Hat Linux

    Configuring network in Red Hat Linux can be hectic and confusing if you don't know the parameter details which are used. Also from Red Hat 6 the configuration parameter has been changed for network-config. Let me show you out the steps to do the same along with some possible explanation.

    The Interface device which controls the network of your Linux machine is mostly eth0 which is the default NIC interface in the system.
    There can be multiple NIC in your system which might be denoted as eth1, eth2 and so on.

    The configuration files used for complete network configuration in Red Hat 6 are
    /etc/sysconfig/network-scripts/ifcfg-eth0 (can vary as per the NIC present)

    Command Line configuration

    Step 1 : 

    Here below is a sample file configuration for ifcfg-eth0
    # less /etc/sysconfig/network-scripts/ifcfg-eth0


    Now let me just explain theese configuration parameters
    DEVICE = name
    name : It is the name of the physical device

    HWADDR = MAC-Address
    MAC-Address : It is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module.

    TYPE = device
    device : Mention if the NIC device you are connecting is Ethernet or Wifi device

    UUID = xx-xx-xx
    This is used by the Network Manager and is self generated so in case you are not using Network Manager this field is not required. Do not manually edit this line

    ONBOOT = answer
    where answer can be one of the following

    • yes — This device should be activated at boot-time.
    • no — This device should not be activated at boot-time.

    NM_CONTROLLED = answer
    where answer is one of the following:

    • yes — NetworkManager is permitted to configure this device.This is the default behavior and can be omitted.
    • no — NetworkManager is not permitted to configure this device.

    IPADDR = IPv4 address
     Give the IPv4 address of your system

    DNS1 = nameserver
    nameserver :  where address is a name server address to be placed in /etc/resolv.conf if the PEERDNS directive is set to yes

    GATEWAY = address
    address : Give the gateway address of your network

    NETMASK = address
    address : Give the netmask address of your network

    BOOTPROTO = protocol
    where protocol is one of the following:

    • none — No boot-time protocol should be used.
    • bootp — The BOOTP protocol should be used.
    • dhcp — The DHCP protocol should be used.

    USERCTL = answer
    where answer is one of the following:
    • yes — Non-root users are allowed to control this device. 
    • no — Non-root users are not allowed to control this device.

    PEERDNS = answer
    where answer is one of the following:
    • yes — Modify /etc/resolv.conf if the DNS directive is set. If using DHCP, then yes is the default.
    • no — Do not modify /etc/resolv.conf.
    Step 2:
    Configure /etc/resolv.conf

    In case you have used directive no for the parameter PEERDNS then you will have to manually update your resolv.conf file.

    # vi /etc/resolv.conf

    Step 3:
    Configure /etc/nsswitch.conf
    #hosts:     db files nisplus nis dns
    hosts:      files dns

    Start your network services
    # service network restart
    # /etc/init.d/network restart

    To check the ip details of your machine
    # ifconfig
    eth0    Link encap:Ethernet  HWaddr 73:25:N4:2E:8C:46
              inet addr:  Bcast:  Mask:
              inet6 addr: fe20::7a35:c4gf:fe2e:8c46/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:642049 errors:0 dropped:0 overruns:0 frame:0
              TX packets:28185 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:74176258 (70.7 MiB)  TX bytes:6418581 (6.1 MiB)

    GUI configuration 

    GUI configuration can be done either on command line as well as on the GNOME or KDE desktop.

    Make sure the following package is installed
    # rpm -qa | grep system-config-network

    # system-config-network
    Follow the screenshots (Click on the image for clear view)

    Hit Enter on "Device Configuration"

     Select the device and hit Enter

    Fill up the required details as shown below and click on OK

    Once you click on OK you will reach on the first page of action. Select DNS Configuration and hit enter

    Fill up the required details as shown below and hit Enter

    Once you have filled up all detail move the cursor to Save and Quit and Hit Enter

    Restart your network to make the change affect
    # service network restart
    # /etc/init.d/network restart

    Please follow the below links for more useful tutorials


    Post a Comment