Monday 16 November 2015

To check Network Link status


[root@pratap ~]#for i in `seq 0 5`; do echo "--- eth$i --"; ethtool eth$i | grep Link; done

--- eth0 --
        Link detected: no
--- eth1 --
        Link detected: no
--- eth2 --
        Link partner advertised link modes:  1000baseT/Full
        Link partner advertised pause frame use: Transmit-only
        Link partner advertised auto-negotiation: Yes
        Link detected: yes
--- eth3 --
        Link partner advertised link modes:  1000baseT/Full
        Link partner advertised pause frame use: Transmit-only
        Link partner advertised auto-negotiation: Yes
        Link detected: yes
--- eth4 --
        Link partner advertised link modes:  1000baseT/Full
        Link partner advertised pause frame use: Transmit-only
        Link partner advertised auto-negotiation: Yes
        Link detected: yes
--- eth5 --
        Link detected: no
      
[root@pratap ~]#

[root@pratap ~]# for i in `seq 0 5`; do echo "--- eth$i --"; ethtool eth$i | grep Port; done
--- eth0 --
        Port: FIBRE
--- eth1 --
        Port: FIBRE
--- eth2 --
        Port: Twisted Pair
--- eth3 --
        Port: Twisted Pair
--- eth4 --
        Port: Twisted Pair
--- eth5 --
        Port: Twisted Pair
[root@pratap ~]#


Wednesday 19 August 2015

How to Map ethx coming from which PCI slot

ethtool -i eth0

lspci -bv |grep -i Eth

dmidecode -t slot


[root@pratap ~]# ethtool -i eth0
driver: igb
version: 4.0.1-k1-1
firmware-version: 3.29, 0x027a8000
bus-info: 0000:04:00.0
[root@pratap ~]#




[root@pratap ~]# lspci -bv | grep -i Eth
03:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
03:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
04:00.0 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
04:00.1 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
04:00.2 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
04:00.3 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
0a:00.0 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
0a:00.1 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
0a:00.2 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
0a:00.3 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
        Subsystem: Hewlett-Packard Company NC365T 4-port Ethernet Server Adapter
[root@pratap ~]#

[root@pratap ~]# dmidecode -t slot
# dmidecode 2.12
SMBIOS 2.8 present.

Handle 0x0901, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI-E Slot 1
        Type: x16 PCI Express 3
        Current Usage: In Use
        Length: Long
        Characteristics:
                3.3 V is provided
                PME signal is supported
Bus Address: 0000:04:00.0

Handle 0x0902, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI-E Slot 2
        Type: x8 PCI Express 3
        Current Usage: Available
        Length: Long
        Characteristics:
                3.3 V is provided
                PME signal is supported
        Bus Address: 0000:07:00.0

Handle 0x0903, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI-E Slot 3
        Type: x4 PCI Express 2 x8
        Current Usage: In Use
        Length: Short
        ID: 3
        Characteristics:
                3.3 V is provided
                PME signal is supported
        Bus Address: 0000:0a:00.0

Handle 0x0904, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI-E Slot 4
        Type: x16 PCI Express 3
        Current Usage: Available
        Length: Long
        Characteristics:
                3.3 V is provided
                PME signal is supported
        Bus Address: 0000:21:00.0

Handle 0x0905, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI-E Slot 5
        Type: x8 PCI Express 3
        Current Usage: In Use
        Length: Long
        Characteristics:
                3.3 V is provided
                PME signal is supported
        Bus Address: 0000:24:00.0

Handle 0x0906, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI-E Slot 6
        Type: x8 PCI Express 3
        Current Usage: In Use
        Length: Long
        Characteristics:
                3.3 V is provided
                PME signal is supported
        Bus Address: 0000:27:00.0

[root@pratap ~

Thursday 2 July 2015

HTTP Kickstart server

HTTP Kickstart server in 10 Steps


This is a quick tutorial on how to setup an Apache based Kickstart install server for provisioning Red Hat or CentOS hosts in your environment. By Kickstarting a host/s you can save time and standardize your environment by defining a configuration file that all hosts will use to perform automated installs.

1. Head over to centos.org and download the iso of the CentOS release you are interested in. I will be using CentOS 5.4 for the purposes of this tutorial.
2. Install Apache.
Check your system for Apache being installed using:
[root@kickstart kickstart]# rpm -qa |grep -i httpd
If nothing returns issue:
yum -y install httpd
This should download and install the dependencies for Apache.
3. Create a install root where we will be installing the contents of the cdrom to. I’ll be using the default document root in /var/www/html.
mkdir /var/www/html/centos5
4. Mount the iso you downloaded to a mount point.
[root@kickstart iso]# mount -o loop CentOS-5.4-i386-bin-DVD.iso /mnt
5. Copy the contents of the iso into the directory you created.
cp -ar /mnt/* /var/www/html/centos5/
6. Create a directory to house your kickstart configurations. Once again I’ll be using Apache’s default document root of /var/www/html. I will be creating a directory called ks to store my configurations.
mkdir /var/www/html/ks
7. Create the kickstart configuration file. I named my configuration ks.cfg and dropped it in the ks directory we created in step 6. Here is what I use for my kickstart profile. Very minimal config.
text
install
url --url http://192.168.3.128/centos5
lang en_US.UTF-8
keyboard us
langsupport --default=en_US.UTF-8 en_US.UTF-8
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$/KEoeArl$f5TokNUdzGIqlvRCLFWW9/
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone America/New_York
bootloader --location=mbr --append="console=xvc0"
#
zerombr yes
clearpart --all
part /boot --asprimary --fstype="ext3" --size=100 --bytes-per-inode=4096
part swap --asprimary --fstype="swap" --recommended --bytes-per-inode=4096
part / --asprimary --fstype="ext3" --grow --size=1 --bytes-per-inode=4096
reboot
#
%packages --nobase
authconfig
crontabs
kbd
kudzu
man
ntp
openssh-clients
openssh-server
passwd
pciutils
rootfiles
rpm
system-config-securitylevel-tui
traceroute
yum
yum-updatesd
vim-minimal
vixie-cron
which
wget
unzip
kudzu
man
ntp
openssh-clients
openssh-server
passwd
pciutils
rootfiles
rpm
system-config-securitylevel-tui
traceroute
yum
yum-updatesd
vim-minimal
vixie-cron
which
wget
unzip
sudo
%post
(
chkconfig --level 3 ip6tables off
chkconfig --level 3 kudzu off
chkconfig --level 3 netfs off
chkconfig --level 3 yum-updatesd off
#
useradd -p 'myreallycomplexpass' someuser
)  2>&1 | tee /root/post-install.log
8. Use the dvd you downloaded or grab a copy of the boot.iso from the install root. You can either use the install DVD iso you or use the 10MB boot.iso located in centos5/images/boot.iso I choose to use the boot.iso since its 10MB and is easily distributable.
9. Start up the Apache process
[root@kickstart images]# service httpd start
Starting httpd:                                            [  OK  ]
10. Now for the Moment of truth. Boot the system with boot.iso or install DVD. At the boot prompt enter:
linux ks=http://your_kickstart_ip/ks/ks.cfg
If all went well the system should boot and fetch the kickstart config. Then the installation will begin hands off.