Archive

Archive for the ‘Unix / Linux’ Category

How to get your atheros wifi drive to work under Centos/Linux and get that WPA working

May 18th, 2009 Ali Abbas No comments

Many times I have come across this thread on forums… many wondering how to get their wifi card (Atheros) to work under Linux (Centos) and then how to proceed to get WPA working… now here is the bundle you have been looking for.

1) Do you have an atheros card?

lspci |grep Atheros (should give you enough info)

2) Get the madiwifi tarball

Go there http://snapshots.madwifi-project.org/madwifi-hal-0.10.5.6/ and download the latest tarball.

wget http://snapshots.madwifi-project.org/madwifi-hal-0.10.5.6/madwifi-hal-0.10.5.6-r4016-20090429.tar.gz

3) Untar it

tar -zxf  madwifi-hal-0.10.5.6-r4016-20090429.tar.gz

4) Compile it

(Note: yum install gcc gcc-cc make kernel-devel) is REQUIRED in case you do not have it yet installed

cd madwifi-hal-0.10.5.6-r4016-20090429

make && make install

5) Load the modules

modprobe -r ath5k (AND edit /etc/modprobe.d/blacklist and add blacklist ath5k to the list)

modprobe ath_pci
modprobe wlan_scan_sta

[ to verify all went well ]

lsmod | grep ath

you should obtain a similar or  even more output as

ath_rate_sample
ath_pci
wlan
ath_hal

6) Reboot (in some cases)

I know we did load the module so why the reboot fuss? with some cards a reboot would still be required… so go ahead reboot the machine

7)  Configure the card

First, do an ifconfig ath0 up if the network service didn’t bring the card up

Second… do an iwconfig ath0 scan to look for ESSID

So let’s sump up

a. ifconfig ath0 up
b. iwconfig ath0 scan

So now you see your favorite wireless signal in the iwconfig output… it is using WPA, how do you connect?

8) Connect to a signal WPA protected

Let’s assume our signal ESSID (the name) is bobHouse

First we need the wpa_supplicant installed… so yum install wpa_supplicant

on the command line, type wpa_supplicant bobHouse y&NcDspHUIfReX-Y$/IH

(keep in mind y&NcDspHUIfReX-Y$/IH is our WPA key)

now, look into /etc/wpa_supplicant/wpa_supplicant.conf and you should see something like

network={
ssid=”bobHouse”
#psk=”y&NcDspHUIfReX-Y$/IH”
psk=1ce60475894155fd6dec38082e749ccd70a29ad0452214472e9784e2f966d
}

(Of course, you would have different values than the one showed here)

So now that this is verified…

type on the command line

/usr/sbin/wpa_supplicant -i ath0 -c /etc/wpa_supplicant/wpa_supplicant.conf -Bw

if needed, do an ifdown ath0 and an ifup ath0 to request a new dhcp ip.

and voila.

Have the ios_supplicant command saved in a bash script and get creative…

Cheers,

Categories: Redhat/Centos

How to install flash plugin for firefox on centos/redhat

May 16th, 2009 Ali Abbas No comments

Hello,

There are many ways to get flash working on firefox, but here is a quick, easy, clean way to do it.

1) Go to http://www.adobe.com/go/getflashplayer

2) Download the tar.gz tarball

3) tar -zxf Flash_Player_10_for_Linux_.tar.gz

4) cd Flash_Player_10_for_Linux

5) Run the installer, when asked for the location of firefox, enter /usr/lib/mozilla…

If for some reasons you still experience problems… then manually copy the libflashplayer.so file which should be at the root of your untarred flash tarball to /usr/lib/mozilla/plugins/

5) cp libflashplayer.so /usr/lib/mozilla/plugins/

6) Once copied, restart firefox (or open it) and voila! enjoy :)

Clean, easy, simple, fast and no hassle.

Cheers,

Categories: Redhat/Centos

Dive into the I/O subsystems

April 19th, 2009 Ali Abbas No comments

I decided to write this article as to give a short intro, which I hope would help one another to dive into understanding but more tweaking the I/O scheduler for better computing performance.

So what is the I/O scheduler…

Talking about the I/O scheduler requires to immediately address the issue of I/O process execution on a system. Each action made by an application whether in a simple read/write manner, memory allocation in a nutshell creates an I/O request to the filesystem/virtual memory, which in return transmit the requests to the scheduler, who handles it back to the low-level device drivers…

The I/O scheduler therefore “resides” between the generic block layer and the low-end device driver… here is how it goes

the file system, the virtual memory manager submits I/O request to the I/O scheduler… the I/O scheduler takes it from there and forwards them to the low-end device drivers which in return forwards them to the device controller using specific protocols to the device controller. The device controller then “applies” the request and performs the action.

Now let’s go one step back… Remember we said the I/O request are submitted from the generic block layer… well in reality threads as in kernel space/user space initiate those I/O request (for example the kswapd thread from the Virtual Memory Manager of the kernel). Those I/O requests are referred as raw I/O requests and like we said earlier are handled by the block layer, then submitted to the I/O scheduler… which in turn, would queue it into an internal I/O queue (the 2.6 scheduler maintains 5 queues)… here is how it goes…

the thread/(generic block layer) initiates the I/O request and calls the __make_request() function of the kernel which in turn calls a I/O scheduler function such as elevator_merge_fn(). Those functions in return pipe, merge, schedule the I/O request into internal I/O queues. So ONE I/O request originating from a block device, gets piped through many internal I/O queues, which at the end represents one unique logical queue that gets automatically associated to the block device that originated the I/O request. It is therefore this logical queue that is handled to the low-end device driver.

Still Following?

When the low-end device driver receives the logical queue, it raises at different elapsed time the elv_next_request() function which would return the next request into the logical queue. The low-end device driver as we said then takes it from there by converting the I/O request into a protocol “device specific” command to the controller which would “execute” the request.

So now that we got some “basic” glimpse at what happens under the hood…

Let’s picture it… say you run an application that each sleep(50) does a read and then a write…

Well as in the 2.6 I/O scheduler, read I/O requests are prioritized over write I/O requests. The way the scheduler achieves that, is by assigning each request a deadline. Remember we mentioned that I/O requests got piped into internal I/O queues, which formed a single unique logical queue?… well while “queuing” the I/O requests, the scheduler assigns the deadline to each I/O requests and organizes the queues by the starting logical block number, the deadline tag or most often the FIFO batch list. The FIFO batch decides which request gets unto the 5th I/O queue which is the dispatch queue to the low-end device driver.

Requests therefore gets moved through the FIFO list as to ensure that no request is starving and meets its effective deadline. Thus the scheduler maintains 2 FIFO list for read and for write operations.

If there are no request in the dispatch queue, the scheduler therefore moves the head request of one of the 4 queues to the dispatch queue. If there are pending read and write requests and no write request have been dispatched for a while, write request from the fifo write list get placed on the dispatch queue. If some requests from the read fifo list expires, they will be automatically placed on the dispatch queue etc.. etc..

There is more to discuss regarding the I/O scheduler but it would take a probably > 400 pages to dissect all the in/out of the the scheduler and understand how to improve system overall performance.

Cheers,

Ali

Categories: Unix / Linux

Set the time / timezone on centos/Redhat

April 19th, 2009 Ali Abbas No comments

Alright… I know this is a trival matter, but you would be surprised how often I read, hear, got asked this question

so here it is …

1) get ntp

yum install ntp

2) start ntp at boot

chkconfig ntp on

3) sync to the ntp server

ntpdate ntp.pool.org

4) start ntp

service ntpd start

5) set your timezone

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

6) verify it is all correct

date

— enjoy!

Cheers,

Ali

Categories: Redhat/Centos

Squid with Ldap authentication – Centos

February 20th, 2009 Ali Abbas No comments

Here is a small easy way to set a simple web proxy to authenticate against an ldap server.

- Squid Install -
(using the rpmforge repository) do a ‘yum install squid’

- Locate squid_ldap_auth -

locate squid_ldap_auth ==> /usr/lib64/squid/squid_ldap_auth

- Test connection against your ldap server -

/usr/lib64/squid/squid_ldap_auth -b “dc=alouche,dc=net” -f “uid=%s” -h auth.alouche.net
myUser myPassword
OK

The OK prompt back shows us that we can easily connect to the ldap server

- Edit squid.conf -

Here is part of the configuration I use to set up the basic ldap authentication in squid

auth_param basic program /usr/lib64/squid/squid_ldap_auth -b “dc=alouche,dc=net” -f “uid=%s” -h auth.alouche.net
auth_param basic children 30
auth_param basic realm Please authenticate yourself
auth_param basic credentialssttl 1 hours
acl ldapauth proxy_auth REQUIRED
http_access allow ldapauth

Make sure http_access deny all is as well set and not deleted.

- Start Squid -

chkconfig squid on
service squid start

netstat -tupnl ==> should report a socket listening on tcp port 3128

- Next steps -

Make sure to either point your browser to your proxy server and you will see the auth prompt for ldap username and password or follow up on setting an Interception Proxy.

Hope that helped,

Ali