Sunday, 26 July 2015

speedtest mini : check your internet speed locally - CentOS 7 is one of the most popular internet speed tests. It is very helpful if you want to determine your Internet download and upload speed similarly speedtest-mini can be performed on local server. 

Install your apache, PHP,  start httpd service and make sure 'httpd' service is allowed by your firewall. 

#yum install -y httpd php php-mysql php-gd php-mcrypt
#systemctl start httpd
#firewall-cmd --add-service=http 

Download "speedtest mini" from from their official site : 
#cd /var/www/html

Register to and download the latest version of mini. 

Make sure your apache doccument root is in /var/www/html
# grep -i "^documentroot" /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"
#cd /var/www/html/mini
#mv index-php.html index.html

point your browser to http://<ipaddress>/mini and start testing your speed on the local servers. 


Wednesday, 8 July 2015

Configure Network Teaming - RHEL 7

Network teaming is method for linking NIC's together logically to allow for failover or higher throughput. 

RHEL 7 implements network teaming with a small kernel driver and a user space daemon, teamd. The kernel handles network packets efficiently and teamd handles logic and interface processing. Software, called runners, implement load balancing and active-backup logic, such as roundrobin. The following runners are available to teamd:

- broadcast : a simple runner transmits each packet from all ports

- roundrobin : simple runner which transmits packets in a rounf-robin fashion from each port

- activebackup : failover runner which watches for link changes and selects an active port for data transfers

- loadbalance : this runner monitors traffic and uses a hash function to try to reach a perfect balance when selecting ports for packet transmission.

- lacp : implements the 802.3ad Link aggregation control protocol. can use the same transmit port selection possibilities as the loadbalance runner.


- Create team interface 
- Assigning the IPv4 or IPv6 attributes of the team interface
- Assign the port interfaces
- Bring the team and port interfaces up/down

Current existing network interfaces are beow, "eno33554984" and "eno50332208" will be the interfaces that will be the ports for the teamed interface.

# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:14:ef:0e brd ff:ff:ff:ff:ff:ff
3: eno33554984: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:14:ef:18 brd ff:ff:ff:ff:ff:ff
4: eno50332208: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:14:ef:22 brd ff:ff:ff:ff:ff:ff

- Create team interface:
# nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
Connection 'team0' (b781d554-6d28-4baa-9af8-5f3331acd427) successfully added.

'{"runner": {"name": "activebackup"}}' - In this setup i'm using method 'activebackup' 

- Assign IPv4 attributes to team interface.
# nmcli connection modify team0 ipv4.addresses ''
# nmcli connection modify team0 ipv4.method manual

- assign the port interfaces
# nmcli connection add type team-slave con-name team0-port1 ifname eno33554984 master team0
Connection 'team0-port1' (d7ae4a56-4872-4264-8f2f-215742deae92) successfully added.
# nmcli connection add type team-slave con-name team0-port2 ifname eno50332208 master team0
Connection 'team0-port2' (c6755f4b-8071-4294-b3d5-691da53cf264) successfully added.

- check the current state of teamed interfaces. 
# ip a show team0
7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 00:0c:29:14:ef:18 brd ff:ff:ff:ff:ff:ff
    inet brd scope global team0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe14:ef18/64 scope link
       valid_lft forever preferred_lft forever

# teamdctl team0 state
  runner: activebackup
    link watches:
      link summary: up
        name: ethtool
        link: up
    link watches:
      link summary: up
        name: ethtool
        link: up
  active port: eno33554984

Ping from your network gateway through the 'team0' interface, and when the 'eno33554984' || 'eno50332208' have been disconnected, you still have no interruptions in the PING. 

how to disconnect one of the interface:
#nmcli device disconnect eno33554984
#teamdctl team0 state
#nmcli device connect eno33554984

- Display team ports of the team0 interface
# teamnl team0 ports

- Display the active port
# teamnl team0 getoption activeport


Thursday, 2 July 2015

Install and configure Git - CentOS 7

In this article i'll try to explain how to install, configure and use Git.

Environment: CentOS 7
Git version:

Git is a distribute version control system used by developers, but since it can also store .files(files with '.') system admin's can use to store their customized configurations files like .bashrc, .vimrc or other important scripts ..etc

Git takes a snapshot of how the files look at that instant in time and will store a reference to it. It wouldn't matter to Git what data you insert as it will check-sum it using SHA1 algorithm and create 40-character hex key. Git is based on key-value data system.

- Install Git by using 'yum' 

#yum install git -y

# git --version
git version

I already have a Git account registered if you don't have, signup to and complete your registration. create your first repository by '+' 
NOTE: repository name you choose or the directory name which you create should be the alike. Git usually sync the directory or the files from your laptop or desktop to the one having the same name as in the GitHub.


setup your name and e-mail (similar email ID that you used to create GitHub account) on your local laptop or desktop which must be run very first time inorder to setup Git.

sunilka@centos7]$ git config --global "sunilka"
sunilka@centos7]$ git config --global ""
sunilka@centos7]$ git config --list

Create a directory and initialize Git by running git init, after that you have .git created with few files and directory under it. According to Git it's now been the working tree. now, everything under it can be uploaded to GitHub.

sunilka@centos7]$ mkdir configs
sunilka@centos7]$ cd configs; git init
sunilka@centos7]$ ls -ld .git

few files were been created and added into the directory, the moment we added the files into Git it creates a hash checksum and refers it by checksum.

sunilka@centos7 configs]$ git ls-files --stage
100755 af7ec7a5b7b361c10dcbf3db7286f97ef7df57d6 0       ks.cfg
100755 3e84972fcf7f688f98999d1bd5c38eaf250efcc9 0       ks_centos7.cfg
sunilka@centos7 configs]$

Now, lest pust to Gitgub which is our remote repository. first check you have remote repository already existing there
sunilka@centos7 configs]$ git remote -v
sunilka@centos7 configs]$ 

add the remote repository, URL which you had while creating the repository.
sunilka@centos7 configs]$ git remote add origin

sunilka@centos7 configs]$  git remote -v
sunilka@centos7 configs]$ 

      git remote add - add remote directory to Git
              origin - default name of the remote location

Push the file to GitHub using, use the same username and password which you use to create and access your GitHub account.
sunilka@centos7 configs]$ git push origin master

any changes made to the files, must be committed before Git push. 

sunilka@centos7 configs]$ git commit -m "CentOS 7 kickstart file" ks_centos7.cfg
[master 08632bb] CentOS 7 kickstart file
 1 file changed, 1 deletion(-)
sunilka@centos7 configs]$ git commit -m "CentOS 6 kickstart file" ks.cfg
[master 498a0ca] CentOS 6 kickstart file
 1 file changed, 2 deletions(-)
sunilka@centos7 configs]$ 

sunilka@centos7 configs]$ git push origin master
Counting objects: 9, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 591 bytes | 0 bytes/s, done.
Total 6 (delta 2), reused 0 (delta 0)
   57a7eb3..498a0ca  master -> master
sunilka@centos7 configs]$ 

Take a look at your GitHub page, it should have been uploaded. 

you can make a localcopy from your GitHub account using the clone feature

sunilka@centos7 configs]$ mkdir gitclones
sunilka@centos7 configs]$ cd gitclones/
sunilka@centos7 gitclones]$ git clone
Cloning into 'configs'...
remote: Counting objects: 10, done.
remote: Total 10 (delta 0), reused 0 (delta 0), pack-reused 10
Unpacking objects: 100% (10/10), done.
sunilka@centos7 gitclones]$ ls
sunilka@centos7 gitclones]$ ls configs/
ks_centos7.cfg  ks.cfg
sunilka@centos7 gitclones]$

you have same files are in your GitHub repository.