RHEL (6) Part 8

  • In This Part i would like to Discuss Networking in Linux. We will take a look at few of the important commands and their usage:

     

    Commands are:

     

    1. ifconfig

    2. netstat

    3. ethtools

    4. mii-tools

    5. route

    6. ping

    7. traceroute

    8. nslookup

    9. hostname

    10. resolv.conf

     

    We will Also take a look at what is Ethernet Bonding and how to configure it

     

    IFCONFIG:

     

    ifconfig is a linux command to check /configure Ethernet interfaces (Network Cards).

     

    The following commad check for ethernet cards in your linux system

     

    #ifconfig <---

     

    To list all of the interfaces use the following command

     

    #ifconfig -a

     

     

    To configure a Network Card temporarily with an IP address we use the command

     

    #ifconfig eth0 netmask <--

     

    However in the above , if network services are started or system is rebooted all the settings for Network will be lost.

     

    To make the changes permenant we can edit the file

     

    /etc/sysconfig/network-scripts/ifcfg-eth0  and add the enteries as show below

     

     

    DEVICE=eth0
    BOOTPROTO=static
    HWADDR=00:0c:29:e8:c3:BB
    ONBOOT=yes
    IPADDR=192.168.1.20
    NETMASK=255.255.255.0
    TYPE=Ethernet

     

    Once the configuration has been changed we need to restart the network services by:

     

    #service network restart <---

     

     

    We can also use the following utility to set the settings for Network Interface.

     

    #system-config-network-tui

     

    Once the utility has been launched you can select the required interface and make necessary changes.

     

    The changes from above utility will be permenant after the system or network servies reboot.

     

    Two More commands to take an interface up or down are

     

    #ifdown eth0 and or #ifup eth0

     

    NETSTAT:

     

    netstat command is used to look at the open connections. You can also use netstat to see the routing table.

     

    The following example would give you a clear idea.

     

    #netstat -aetlup <---

     

    a = All

    t= Tcp

    l= Listening

    u= Udp

    p= Process IDs

    e= Extended Information

     

    So inorder to get information about a specific service or port we can use the following:

     

    Let say we want to check what is running on port 3128

     

    #netstat -taupe | grep 3128  <---

     

    And it will return with a service of squid (which by default runs on port 3128) provided it is running on its default port.

     

    To check routing table with Netstat command do the following:

     

    #netstat -r <--

     

    ETHTOOLS:

     

    Coming Soon !

     

     

0 comments