Search This Blog

Thursday, May 26, 2016

Why ifconfig command should not be used any more in RHEL7?

Why ifconfig command should not be used any more in RHEL7?

We could see the IP address configured on any network interface using command #ip addr show command.

Here you could see there already IP “192.168.0.12” is configured on network interface “eno16777736”

[root@rhelserver /]# ip addr  show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:3b:3c:a0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.12/24 brd 192.168.0.255 scope global eno16777736
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe3b:3ca0/64 scope link
       valid_lft forever preferred_lft forever
[root@rhelserver /]#

You could check the route information via command #ip route show

[root@rhelserver /]# ip route show
default via 192.168.0.1 dev eno16777736  proto static  metric 1024
192.168.0.0/24 dev eno16777736  proto kernel  scope link  src 192.168.0.12


Now I am trying to add one more IP address “10.0.0.10” on interface “eno16777736”.

# ip addr add dev eno16777736 10.0.0.10/24

[root@rhelserver /]# ip addr add dev eno16777736 10.0.0.10/24
[root@rhelserver /]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:3b:3c:a0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.12/24 brd 192.168.0.255 scope global eno16777736
       valid_lft forever preferred_lft forever
    inet 10.0.0.10/24 scope global eno16777736
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe3b:3ca0/64 scope link
       valid_lft forever preferred_lft forever


We could see both IP “192.168.0.24” & “10.0.0.10” are configured on interface “eno16777736

Now let’s use “ifconfig”, as many of us are used to using ifconfig command.

[root@rhelserver /]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.12  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fe3b:3ca0  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:3b:3c:a0  txqueuelen 1000  (Ethernet)
        RX packets 627  bytes 74074 (72.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 708  bytes 45361 (44.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 461  bytes 45712 (44.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 461  bytes 45712 (44.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


As you could see, we could see first IP address “192.168.0.12” , but “ifconfig” command has no capabilities of showing other IP address i.e. “10.0.0.24”


Even if you use # ifconfig –a, It will not show the IP address “10.0.0.10

[root@rhelserver /]# ifconfig -a
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.12  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fe3b:3ca0  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:3b:3c:a0  txqueuelen 1000  (Ethernet)
        RX packets 627  bytes 74074 (72.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 708  bytes 45361 (44.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 461  bytes 45712 (44.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 461  bytes 45712 (44.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


It would be shocking for many sys admin, who like ifconfig command so much, but the man page of ifconfig command says.

# man ifconfig

IFCONFIG(8)                                                                          Linux System Administrator's Manual                                                                          IFCONFIG(8)

NAME
       ifconfig - configure a network interface

SYNOPSIS
       ifconfig [-v] [-a] [-s] [interface]
       ifconfig [-v] interface [aftype] options | address ...

NOTE
       This program is obsolete!  For replacement check ip addr and ip link.  For statistics use ip -s link.

So do not use ifconfig command any more, you may miss any network information configured on the network interface.


Thank you for reading.
For Reading other article, visit to “https://sites.google.com/site/unixwikis/


Wednesday, May 25, 2016

How to check RAID Information in Linux

Have you ever tried to check how the hardware RAID Array configured on server from your Linux Shell? Have you ever wanted to change or modify your Hardware RAID configurations without rebooting the server and without leaving your Linux shell?


hpacucli utility is there to help you, If your server is HP Hardware. hpacucli  (HP Array Configuration Utility CLI) is a command line based disk configuration program for Smart Array Controllers and RAID Array Controllers. You can download and  install hpacucli tool from HP website.

Quick Abbreviations:

chassisname = ch
controller = ctrl
logicaldrive = ld
physicaldrive = pd
drivewritecache = dwc

As root, just type "hpacucli" and you will be into hpacucli command line interface. Let me give you a quick example of what you can do with this hpacucli.

To get the quick details about the RAID controller and its Health:
Using Syntax : ctrl all show

testnode:root:/ # hpacucli ctrl all show

Smart Array P400 in Slot 9                (sn: PAFGL0P9SWY39U)

Using Syntax: ctrl all show status

testnode:root:/ # hpacucli ctrl all show status

Smart Array P400 in Slot 9
   Controller Status: OK
   Cache Status: OK
   Battery/Capacitor Status: OK

To get a quick idea of how the disks are grouped and which raid level used:

testnode:root:/ # hpacucli ctrl all show

Smart Array P400 in Slot 9                (sn: PAFGL0P9SWY39U)

Using Syntax: ctrl all show config

testnode:root:/ # hpacucli ctrl all show config

Smart Array P400 in Slot 9                (sn: PAFGL0P9SWY39U)

   array A (SAS, Unused Space: 0  MB)


      logicaldrive 1 (136.7 GB, RAID 1, OK)

      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)

   array B (SAS, Unused Space: 0  MB)


      logicaldrive 2 (136.7 GB, RAID 1, OK)

      physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 146 GB, OK)
      physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 146 GB, OK)

To get complete details about how the raid configured in the server:

Using Syntax: ctrl all show config detail

testnode:root:/ # hpacucli ctrl all show config detail

Smart Array P400 in Slot 9
   Bus Interface: PCI
   Slot: 9
   Serial Number: PAFGL0P9SWY39U
   Cache Serial Number: PA2270J9SWXBAV
   RAID 6 (ADG) Status: Enabled
   Controller Status: OK
   Hardware Revision: E
   Firmware Version: 7.24
   Rebuild Priority: Medium
   Expand Priority: Medium
   Surface Scan Delay: 15 secs
   Surface Scan Mode: Idle
   Wait for Cache Room: Disabled
   Surface Analysis Inconsistency Notification: Disabled
   Post Prompt Timeout: 0 secs
   Cache Board Present: True
   Cache Status: OK
   Cache Ratio: 25% Read / 75% Write
   Drive Write Cache: Disabled
   Total Cache Size: 512 MB
   Total Cache Memory Available: 464 MB
   No-Battery Write Cache: Disabled
   Cache Backup Power Source: Batteries
   Battery/Capacitor Count: 1
   Battery/Capacitor Status: OK
   SATA NCQ Supported: True

   Array: A
      Interface Type: SAS
      Unused Space: 0  MB
      Status: OK
      Array Type: Data



      Logical Drive: 1
         Size: 136.7 GB
         Fault Tolerance: 1
         Heads: 255
         Sectors Per Track: 32
         Cylinders: 35132
         Strip Size: 128 KB
         Full Stripe Size: 128 KB
         Status: OK
         Caching:  Enabled
         Unique Identifier: 600508B1001050395357593339550006
         Disk Name: /dev/cciss/c0d0
         Mount Points: /boot 196 MB
         OS Status: LOCKED
         Logical Drive Label: A09C2125PAFGL0P9SWY39U6F89
         Mirror Group 0:
            physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)
         Mirror Group 1:
            physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
         Drive Type: Data

      physicaldrive 1I:1:1
         Port: 1I
         Box: 1
         Bay: 1
         Status: OK
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 146 GB
         Rotational Speed: 10000
         Firmware Revision: HPDC
         Serial Number: 3NM8D3HA00009922LSYG
         Model: HP      DG146BB976
         Current Temperature (C): 28
         Maximum Temperature (C): 42
         PHY Count: 2
         PHY Transfer Rate: Unknown, Unknown

      physicaldrive 1I:1:2
         Port: 1I
         Box: 1
         Bay: 2
         Status: OK
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 146 GB
         Rotational Speed: 10000
         Firmware Revision: HPDC
         Serial Number: 3NM8FY4M00009922R00K
         Model: HP      DG146BB976
         Current Temperature (C): 28
         Maximum Temperature (C): 43
         PHY Count: 2
         PHY Transfer Rate: Unknown, Unknown


   Array: B
      Interface Type: SAS
      Unused Space: 0  MB
      Status: OK
      Array Type: Data



      Logical Drive: 2
         Size: 136.7 GB
         Fault Tolerance: 1
         Heads: 255
         Sectors Per Track: 32
         Cylinders: 35132
         Strip Size: 128 KB
         Full Stripe Size: 128 KB
         Status: OK
         Caching:  Enabled
         Unique Identifier: 600508B1001050395357593339550007
         Disk Name: /dev/cciss/c0d1
         Mount Points: None
         OS Status: LOCKED
         Logical Drive Label: A09E85F0PAFGL0P9SWY39U8E5C
         Mirror Group 0:
            physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 146 GB, OK)
         Mirror Group 1:
            physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 146 GB, OK)
         Drive Type: Data

      physicaldrive 1I:1:3
         Port: 1I
         Box: 1
         Bay: 3
         Status: OK
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 146 GB
         Rotational Speed: 10000
         Firmware Revision: HPDC
         Serial Number: 3NM89MV900009922LUZX
         Model: HP      DG146BB976
         Current Temperature (C): 28
         Maximum Temperature (C): 43
         PHY Count: 2
         PHY Transfer Rate: Unknown, 3.0Gbps

      physicaldrive 1I:1:4
         Port: 1I
         Box: 1
         Bay: 4
         Status: OK
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 146 GB
         Rotational Speed: 10000
         Firmware Revision: HPDC
         Serial Number: 3NM8DAC800009922QE1N
         Model: HP      DG146BB976
         Current Temperature (C): 26
         Maximum Temperature (C): 41
         PHY Count: 2
         PHY Transfer Rate: 3.0Gbps, Unknown


Another Method to check the array hardware mirror status
testnode:root:/ # fdisk -l

Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 63 sectors/track, 17844 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          25      200781   83  Linux
/dev/cciss/c0d0p2              26       17844   143131117+  8e  Linux LVM

Disk /dev/cciss/c0d1: 146.7 GB, 146778685440 bytes
255 heads, 32 sectors/track, 35132 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d1p2               1       35132   143338544   8e  Linux LVM

testnode:root:/ # hpacucli ctrl all show config detail | grep -i /dev/cciss/c0d0
         Disk Name: /dev/cciss/c0d0

testnode:root:/ # cat /proc/driver/cciss/cciss0
cciss0: HP Smart Array P400 Controller
Board ID: 0x3234103c
Firmware Version: 7.24
IRQ: 74
Logical drives: 2
Sector size: 8192
Current Q depth: 0
Current # commands on controller: 0
Max Q depth since init: 161
Max # commands on controller since init: 343
Max SG entries since init: 128
Sequential access devices: 0

cciss/c0d0:      146.77GB       RAID 1(1+0)
cciss/c0d1:      146.77GB       RAID 1(1+0)

Be sure to verify your version of hpacucli and refer the ReadMe always, before you trying to modify the configuration of RAID or Smart Array controllers. 

Thank you for reading.

For Reading other article, visit to “https://sites.google.com/site/unixwikis/