Syed Jahanzaib Personal Blog to Share Knowledge !

February 20, 2015

LEGACY OF CENTOS ! Continued …

Filed under: Linux Related — Tags: , , , , — Syed Jahanzaib / Pinochio~:) @ 3:14 PM

Some personnel notes /references for CENTOS , as my future R&D will be done mainly in centos dueto its preloaded options for ease of use.


x- CENTOS  6.6  <32 bit>   DOWNLOAD LINK   …


0- Enable SNMP in CENTOS , tested with 6.x

To enable SNMP in CENTOS quickly, copy paste following. it will add ‘public’ community as Read Only.

yum -y install net-snmp net-snmp-utils
> /etc/snmp/snmpd.conf

# Add following
echo "rocommunity public" > /etc/snmp/snmpd.conf
echo "syslocation "Karachi NOC, Paksitan" >> /etc/snmp/snmpd.conf
echo "syscontact  aacable_at_hotmail_com >> /etc/snmp/snmpd.conf

service snmpd restart
chkconfig snmpd on

snmpwalk -v1 -c public

1- Configuring Static IP address in CENTOS [6.x]

If you want to configure static IP address in CENTOS, then edit following file

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Use following as sample

IPADDR=  # IP Address you want to fix
NETMAST=   # Netmask as per network
# or if netmask dont work, use PREFIX=24 (change 24 as per network like /8 or whatever)
GATEWAY=   # Your Router/DLS Gateway
DNS1=   # Your ISP DNS or standard Google dns

Note: set following for sure


Save & Exit, and restart the network service or interface to take effect

service network restart


ifdown eth0
ifup eth0

Issue IFCONFIG command to verify the result.

centos7 is a mess😦 so better to stick with 6

2- Change/Clone MAC address

To change mac address in CENTOS , edit your required ethernet network config file , Example …

nano /etc/sysconfig/network-scripts/ifcfg-eth0

here you will see HWADDR line with current mac address, dont modify it, just add another line above it, like following

MACADDR=00:11:11:11:11:11          < Add this line with your required mac address
HWADDR=00:22:22:22:22:22       < Your current mac address

An example of full cfg file for eth0


Save & Exit, and restart the network service or interface to take effect

service network restart


ifdown eth0
ifup eth0

Issue IFCONFIG command to verify the result.


use the sed shortcut😉

sed -i -e ‘1iHere is my new top line\’ filename


3- Disabling default firewall SELINUX

To disable SELINUX temporary for the current session, use following…

echo 0 > /selinux/enforce


To disable builtin firewall permanently in centos, edit following

vi /etc/selinux/config

and change the




Save & Exit & reboot to take effect.

Or use the SED shortcut to replace the string within cli😉 # Zaib

sed -i "s/=enforcing/=disabled/g" /etc/selinux/config

4- Disabling IPTABLES

To disable iptables services

service iptables stop
chkconfig iptables off

You can check the status with following

service iptables status

and you can also use following command to clear the current iptables (for the current session only)

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT


5- Some must-have tools

yum install -y nano wget curl net-tools lsof

6- SERVICES Related

service --status-all

To disable service on startup , use

chkconfig httpd off

To always start any service on boot, use

chkconfig --add httpd on 

7- Excluding slow mirrors

When I was installing some packages in Centos and the YUm was doing it at painfully slow speed, I figured the mirror (indian and bangladeshi mirror sites) were very slow. So I disabled two mirrors domain it was selecting in start which were .in and .bd

use following file

nano /etc/yum/pluginconf.d/fastestmirror.conf

and add the slow mirror (to be excluded) like, .bd,

or use the cli command to add it in the file

echo ", .in, .vn," >> //etc/yum/pluginconf.d/fastestmirror.conf

 8- How to Check CentOS Version / kernel Number

cat /etc/centos-release
uname -a

9- Howto Disable IPV6 in CENTOS  [Tested on 6.x versions]

First edit sysctl.conf file in any editor , e.g:

nano /etc/sysctl.conf

and add following lines in the end

# IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Use following to add them directly to file using echo command

echo >> /etc/sysctl.conf  net.ipv6.conf.all.disable_ipv6 = 1
echo >> /etc/sysctl.conf net.ipv6.conf.default.disable_ipv6 = 1
echo >> /etc/sysctl.conf net.ipv6.conf.lo.disable_ipv6 = 1

Save and Exit and execute following to activate changes🙂

sysctl -p


10- Howto install PHPMYADMIN in centos 6.x

To install PHPMYAMDIN which is a good tool to manage your mysql via GUI in centos, use following…

 cd /tmp
rpm -ivh epel-release-6-8.noarch.rpm

yum search phpmyadmin
yum -y install phpmyadmin

Now You need to edit /etc/httpd/conf.d/phpMyAdmin.conf file, enter:

vi /etc/httpd/conf.d/phpMyAdmin.conf

Replace your ip in

Require ip

Allow from

Change to your management pc ip from where you want to access phpmyadmin

after saving, restart the httpd service.

service httpd restart


Or use the SED shortcut to replace the string within cli😉 # Zaib

sed -i "s/" /etc/selinux/config

[replace with your management pc ip]


11- WGET hangs problem when internet link breaks or with poor connectivity

wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0

12- Adding Virtual NIC

Quick and dirty way (it will add the nic temporary for the session, you can also add these commands in startup as well.

ip link add link eth0 address 11:22:33:44:55:66 eth0.10 type macvlan
ifconfig eth0.1 up
ifconfig eth0.1

Adding Virtual NIC  permanently.


Adding simple VPN Server (in view f connecting radius with nas)

On CentOS 6 x64:

rpm -i
yum -y install pptpd

Now you should edit /etc/pptpd.conf and add the following lines:


Where localip is IP address of your server and remoteip are IPs that will be assigned to clients that connect to it.

Next, you should setup authentication for PPTP by adding users and passwords. Simply add them to /etc/ppp/chap-secrets :
(example of id pass)

zaib    pptdp    zaibpass    *
service pptpd restart


To be continued …


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: