Network Configuration in Red Hat Linux

 Every computer on a network must have an IP Address (Internet Protocol address). The IP Address for a computer is like the phone number of a telephone.  IP address will be of the form 192.168.xxx.yyy, where xxx represents the subnet and depends on which form or building you are in, and yyy is unique to your computer. Most computers on company obtain an IP address automatically via DHCP (the Dynamic Host Configuration Protocol). Some computers require a static IP address which is assigned by CIS. If you don't know that you need a static IP address then you should configure your machine to use DHCP.

1. How to find Ethernet network interface card information in Linux.

Sometimes you may want to know the product name or hardware settings of the network interface cards (NICs) attached to your Linux system. For example when you check whether a particular network device driver or a kernel module is compatible with your Ethernet adapter
 There are so many options to find out the network card information in linux, some are given below:

a)  lspci | grep -i 'ethernet'
b)  # dmesg | grep eth
c)  # lshw -class network

 


2. Check existing network setting.

# ifconfig  







 3.Now you need to create the configuration file for your new interface. The network interface configuration files are placed in /etc/sysconfig/network-scripts/.





 #   vim ifcfg-eth0


 

 & save it.

# service network restart


 4. Find out the recently added new ethernet card mac address & configure it without rebooting the server

After you add secondary network interface from VMware level, the file will automatically added the mac address in /etc/udev/rules.d/70-persistent-net.rules. Please take note on the mac address for eth1.





 Here I am not adding an extra interface, but if you want to add new interface in your server & want to get information of MAC address & define the ipaddress, then copy the MAC address from the above configuration file & create a new interface in /etc/sysconfig/network-scripts.


 5. Bonding configuration in Red Hat Linux :

 There are almost six types of Channel Bond types are available. Here, we’ll review only two type
of Channel Bond which are popular and widely used.

  a)   0: Load balancing (Round-Robin) : Traffic is transmitted in sequential order or round-robin fashion
    from both NIC. This mode provides load balancing and fault tolerance.
   b)  1: Active-Backup : Only one slave NIC is active at any given point of time. Other Interface Card
    will be active only if the active slave NIC fails.
  
    # cat /etc/modprobe.conf
    alias bond0 bonding
    options bonding mode=1 miimon=100 use_carrier=0







 

Bonding driver uses “use_carrier”  with default value of 1 ( i.e. to use netif_carrier_ok() function), to identify the link status. Just incase if the bonding driver doesn’t support netif_carrier_ok() function, it cannot determine the link status properly. As a workaround we can set use_carrier to value 0 ( i.e. to use  MII/ETHTOOL ioctl method) to determine the link status

  
    # vi /etc/sysconfig/network-scripts/ifcfg-eth1
    DEVICE="eth1"
    TYPE=Ethernet
    ONBOOT="yes"
    BOOTPROTO="none"
    USERCTL=no
    MASTER=bond0
    SLAVE=yes

    # vi /etc/sysconfig/network-scripts/ifcfg-eth2
    DEVICE="eth2"
    TYPE="Ethernet"
    ONBOOT="yes"
    USERCTL=no
    BOOTPROTO=none
    MASTER=bond0
    SLAVE=yes
  
    # vi /etc/sysconfig/network-scripts/ifcfg-bond0
     DEVICE=bond0
     ONBOOT=yes
     IPADDR=192.168.246.130
     NETMASK=255.255.255.0
     BONDING_OPTS="mode=0 miimon=100"
    
     Note: In the above configuration we have chosen Bonding Options mode=0 i.e Round-Robin
     and miimon=100 (Polling intervals 100 ms).
    

Activating Bonding Channel With out rebooting

# modprobe bonding

# service network restart 
 
     Checking the status of the bond.
 # watch -n 1 cat /proc/net/bonding/bond0

Verify that Bonding channel is active, by using the commands

 


Ethtool

Ethtool is a utility for configuration of Network Interface Cards (NICs). This utility allows querying and changing settings such as speed, port, auto-negotiation, PCI locations and checksum offload on many network devices, especially Ethernet devices.
We present here a short selection of often used ethtool commands together with some useful commands that are not well known. For a full list of commands type ethtool -h or refer to the man page, ethtool(8), for a more comprehensive list and explanation. The first two examples are information queries and show the use of the different formats of the command. 
 
# ethtool eth0



Issue the following command, using the short or long form of the argument, to query the specified network device for associated driver information: 

# ethtool -i eth0

 


The --statistics or -S queries the specified network device for NIC and driver statistics. It takes the following form:

# ethtool -S eth0





The --show-time-stamping or -T option queries the specified network device for time stamping parameters. It takes the following form:

# ethtool -T eth0





--port
The --port option is used to select the device port . It takes the following form:
--port value devname
where value is one of the following:
  • tp — An Ethernet interface using Twisted-Pair cable as the medium.
  • aui — Attachment Unit Interface (AUI). Normally used with hubs.
  • bnc — An Ethernet interface using BNC connectors and co-axial cable.
  • mii — An Ethernet interface using a Media Independent Interface (MII).
  • fibre — An Ethernet interface using Optical Fibre as the medium.
and devname is your NIC. 
 
  # ethtool --port  tp eth0









Comments

Popular posts from this blog

Defining Audit Rules

AIX Install packages, upgrade, patching commands

Oracle Database Quick Installation steps 11g Release 2 for Linux x86-64