2008年12月27日星期六

Connecting to an AP with WPA-PSK

I got help from the madwifi wiki for a lot of this.
http://madwifi-project.org/wiki/UserDocs/WPA_PSK_on_Both_Ends
http://ultramookie.com/wayback/2006/09/17/centos4-and-wpa-psk/

The Station (client) Side

Get wpa_supplicant


On All workstations that want to subscribe to the WPA enabled AP, do the following:

Go here: http://hostap.epitest.fi/wpa_supplicant/ and get: Latest stable release: (as of this writing: wpa_supplicant-0.4.7.tar.gz). Unpack it to /usr/src/wpa_supplicant-0.4.7


Copy this to /usr/src/wpa_supplicant-0.4.7/.config


CONFIG_DRIVER_MADWIFI=y
CFLAGS += -I/usr/src/madwifi-ng
CONFIG_CTRL_IFACE=y

Now build wpa_supplicant on the station

cd /usr/src/wpa_supplicant-0.4.7
make clean
make
make install

Run wpa_passphrase to make your PSK

You’ll have to edit /etc/modprobe.conf and add:

alias ath0 ath_pci
options ath_pci autocreate=sta

Reboot.

When the system comes up, you’ll want to configure wpa_supplicant for your network:

/usr/sbin/wpa_passphrase YOUR_AP_SSID “YOUR_WPA_PSK_PASSPHRASE” >> /etc/wpa_supplicant/wpa_supplicant.conf

Edit /etc/wpa_supplicant/wpa_supplicant.conf and add:

key_mgmt=WPA-PSK

proto=WPA

Test that your setup is working:

iwconfig ath0 essid “YOUR_AP_SSID”

ifconfig ath0 SOME_IP_ADDRESS up

/usr/sbin/wpa_supplicant -dd -Dmadwifi -iath0 -c /etc/wpa_supplicant/wpa_supplicant.conf

If you see:

CTRL-EVENT-CONNECTED - Connection to AP_ADDRESS completed (auth)

Then you’re OK.

Now, gettting things automated. First, setup your wireless card like usual in Applications -> System Settings -> Network. Then edit /etc/sysconfig/network-scripts/ifup-wireless

Add to the end of that file:

/usr/sbin/wpa_supplicant -w -B -Dmadwifi -iath0 -c /etc/wpa_supplicant/wpa_supplicant.conf

Test to see that it works with:

/etc/init.d/network restart

If it does, then you're all done!

Sometime I have connection problem with my linksys WRV54G router the network will be no response, I don't know why? And after I restart the router, they it will worked again.

Setup MadWifi on Centos5

字号MadWifi is a Linux driver for Wireless LAN devices with Atheros chipsets. The developer team currently provide three drivers, MadWifi, ath5k and ath9k.

MadWifi is one of the most advanced WLAN drivers available for Linux today. It is stable and has an established userbase. The driver itself is open source but depends on the proprietary Hardware Abstraction Layer (HAL) that is available in binary form only. The current stable release is v0.9.4.

ath5k is a relatively new and emerging driver and does not depend on the HAL. It is intended to replace MadWifi in the long run and exceed it feature-wise. ath5k is where most of our development resources are spent on now.

ath9k is the youngest of the three drivers. Initial development was done by Atheros, who then released the complete source code to the community. ath9k supports all currently available 802.11n chipsets from Atheros. For now please see here for further information.

Getting MADWiFi Sources

Download a MadWifi release from sourceforge.net and unpack it. Open a shell terminal in the MadWifi source directory.

Removing old modules

For this step you must be logged on as root.

First, set all your MadWifi devices down:

ifconfig ath0 down
ifconfig wifi0 down
#Repeat these 2 ifconfig lines for every MadWifi device you have (ath1, etc)

Assuming that you're inside the MadWifi directory, execute the following scripts to remove the current modules from your system and its memory:

cd scripts
./madwifi-unload
./find-madwifi-modules.sh $(uname -r)
cd ..

You should then be asked if you are sure that you want to remove the old modules.

Building MadWifi

Now that you have the MadWifi code, it's time to compile it into the actual driver. Thankfully, this is easy.

Assuming that you've met all of the requirements above, and you're inside the MadWifi directory, you can just type:

make
Which will start the build process. Watch for any questions you might be prompted to answer - when it finishes, quickly scan through for any errors. Maybe you will get the following error. It's already fixed,
just follow it.

Ticket #1956 (closed defect: wontfix) madwifi-0.9.4 compilation problem for new RHEL5.2 kernel, 2.6.18-92.el5

Reported by: hs@nhn.ou.edu Assigned to:
Priority: minor Milestone:
Component: madwifi: driver Version: v0.9.4
Keywords:
Cc:
Patch is attached: 0 Pending:

Description (Last modified by mrenzmann)

Hi,

I just upgraded my laptop to RHEL5.2, kernel 2.6.18-92.el5, yesterday, and then got the newest madwifi version, 0.9.4, since 0.9.3 wouldn't compile anymore, but 0.9.4 doesn't, either. I got the following error:

[root@laphep5 current]# make
Checking requirements... ok.
Checking kernel configuration... ok.
make -C /lib/modules/2.6.18-92.el5/build SUBDIRS=/home/local/rpm/wireless/enterasys/madwifi-0.9.4 modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.el5-i686'
CC [M] /home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/if_ath.o
In file included from :1:
/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/../include/compat.h:140: error: redefinition of 'skb_end_pointer'
include/linux/skbuff.h:417: error: previous definition of 'skb_end_pointer' was here
/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/../include/compat.h:145: error: redefinition of 'skb_tail_pointer'
include/linux/skbuff.h:835: error: previous definition of 'skb_tail_pointer' was here
/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/../include/compat.h:150: error: redefinition of 'skb_set_network_header'
include/linux/skbuff.h:1021: error: previous definition of 'skb_set_network_header' was here
/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/../include/compat.h:155: error: redefinition of 'skb_reset_network_header'
include/linux/skbuff.h:1016: error: previous definition of 'skb_reset_network_header' was here
/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/../include/compat.h:160: error: redefinition of 'skb_mac_header'
include/linux/skbuff.h:1036: error: previous definition of 'skb_mac_header' was here
/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/../include/compat.h:165: error: redefinition of 'skb_reset_mac_header'
include/linux/skbuff.h:1046: error: previous definition of 'skb_reset_mac_header' was here
make[3]: *** [/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath/if_ath.o] Error 1
make[2]: *** [/home/local/rpm/wireless/enterasys/madwifi-0.9.4/ath] Error 2
make[1]: *** [_module_/home/local/rpm/wireless/enterasys/madwifi-0.9.4] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-i686'
make: *** [modules] Error 2

I managed to "fix" it -- well, get it to compile -- by removing the KERNEL_VERSION(2,6,22) section from include/compat.h (see below), since that's where the errors seem to come from.

Not sure why that was necessary, since this is still kernel 2.6.18, but I was just glad it worked, and I'll leave the proper fix to you. :)

Thanks a lot for a great driver,

Horst Severini

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
#include
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
{
return skb->end;
}

static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
{
return skb->tail;
}

static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
{
skb->nh.raw = skb->data + offset;
}

static inline void skb_reset_network_header(struct sk_buff *skb)
{
skb->nh.raw = skb->data;
}

static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
{
return skb->mac.raw;
}

static inline void skb_reset_mac_header(struct sk_buff *skb)
{
skb->mac.raw = skb->data;
}
#endif

Installing MadWifi

This step will take the built MadWifi, and install it on your system. Once again, make does all of the work for you.

This step needs to be done as root, so either type su and enter root's password, or if you have it set up (e.g. Ubuntu), prefix the following command with sudo.

To install the driver, type:

make install

This will copy all of the modules, tools and man pages to the correct directories on your system. You've now completed the basic install.

Loading the MadWifi Module

This step will load the MadWifi driver module into your running system. This essentially lets all other software know how to talk to your MadWifi hardware.

This step needs to be done as root, so either type su and enter root's password, or if you have it set up (e.g. Ubuntu), prefix the following command with sudo.

To load the driver module, type:

modprobe ath_pci

If after running this command ifconfig doesn't show the additional wireless interface you might need to reboot. If you have any problems with building the MadWifi driver, please refer to UserDocs/BuildProblems.

Creating an Interface

MADWiFi supports virtual access points, which means you can create more than one wireless device per wireless card. By default, a sta mode VAP is created, which is MadWifi talk for a 'managed mode wireless interface'.

If your svn snapshot is more recent than the 23rd January 2006, (r1407) than you can skip the following step:

If not, then follow these instructions to make a normal station mode interface. Type (as root):

wlanconfig ath0 create wlandev wifi0 wlanmode sta

If wlanconfig doesn't work, you retry it after executing 'wlanconfig ath0 destroy'.

Now, if you type iwconfig, you should see a list like the following:

eth0 no wireless extensions. lo no wireless extensions. wifi0 no wireless extensions. ath0 IEEE 802.11g ESSID:"" Mode:Managed Frequency:2.457 GHz Access Point: 00:00:00:00:00:00 Bit Rate:0 kb/s Tx-Power:20 dBm Sensitivity=0/3 Retry:off RTS thr:off Fragment thr:off Power Management:off Link Quality=0/94 Signal level=-95 dBm Noise level=-95 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Then we need to bring up the wireless interface. This is done by typing (as root):

ifconfig ath0 up

There is more information on the creating of interfaces in UserDocs.

Scanning for Access Points

If you know that there are some APs around, having a quick scan can be an excellent way of getting some instant gratification, and knowledge that everything's working OK.

The first step is to insert the scanning module. Type (as root):

modprobe wlan_scan_sta

Next, you can do the actual scan, which can be done in two ways.

The first way is specific to MadWifi. and gives you a nice, succinct results table.

This is done by issuing the command (again, as root):

wlanconfig ath0 list scan

This should give you a list that looks something like this:

SSID BSSID CHAN RATE S:N INT CAPS eddie 00:06:25:e8:3a:05 6 54M 36:0 100 EPs

The second way is the more usual way of scanning (and works with other wireless cards), it also gives you somewhat more information, and is therefore a bit less easy to read. The command is:

iwlist ath0 scan

Which gives an output which looks like this:

ath0 Scan completed : Cell 01 - Address: 00:06:25:E8:3A:05 ESSID:"eddie" Mode:Master Frequency:2.437 GHz (Channel 6) Quality=37/94 Signal level=-58 dBm Noise level=-95 dBm Encryption key:on Bit Rate:1 Mb/s Bit Rate:2 Mb/s Bit Rate:5.5 Mb/s Bit Rate:11 Mb/s Bit Rate:18 Mb/s Bit Rate:24 Mb/s Bit Rate:36 Mb/s Bit Rate:54 Mb/s Bit Rate:6 Mb/s Bit Rate:9 Mb/s Bit Rate:12 Mb/s Bit Rate:48 Mb/s Extra:bcn_int=100

Especially useful is the line reading Encryption key:on, which indicates that this AP is running some kind of WEP.

If you get a message such as:

ath0 Failed to read scan data : Resource temporarily unavailable

instead of actual scan results, and you are in an environment that requires a shared encryption key, try running:

iwconfig ath0 key iwpriv ath0 authmode 2

This will tell the card that it is operating in a restricted, shared-key environment, and thus it needs to use the key you supply with iwconfig. To use an open system key (which is often considered more secure) use iwpriv authmode 1:

iwconfig ath0 key iwpriv ath0 authmode 1

Once this is done, re-run the scan, and you may see proper results.


2008年12月19日星期五

An useful firefox plugin

ForecastFox
Get international weather forecasts from AccuWeather.com, and display it in any toolbar or statusbar with this highly customizable and unobtrusive...

2008年10月31日星期五

add dictionary of StarDict

Downloading dictionary files from website.
extract file
put dictionary folder into /usr/share/stardict/dic

How to setup Multimedia

The following procedures will help you setup multimedia support under CentOS 5. After completing the steps below, you should be able to play dvds on your computer. You'll also be able to view different media formats, for example Xvid, dvix, quicktime etc. You will also have mplayer integrated as a browser plugin which will allow you to view streaming video/audio content from within Firefox.

Some recommendations should be mentioned pertaining to the yum priorities plug-in. This will prevent accidentally overwriting packages from the base repositories. Also note the following needs to be performed as root user in a command line or terminal.

Please consider following the wiki document to assist in setting up the priorities plug-in, due to the fact that we are adding some third party repositories.

http://wiki.centos.org/PackageManagement/Yum/Priorities

Step 1: Add the Rpmforge Repo (needed for majority of multimedia files)

rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

" src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" title="" height="15" width="15"> If you are running CentOS 4, you should use the el4 package. See CentOS Repositories

Step 2: Add the Macromedia Repo (needed for flash)

rpm -Uhv http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm

Step 3: Install Multimedia Applications (command line to install required packages)

The following steps will use the yum package manager to install all the binaries needed to have full multimedia support. Note there will be a lot of dependencies

yum install libdvdcss libdvdread libdvdplay livdvdnav lsdvd mplayerplug-in mplayer mplayer-gui compat-libstdc++-33 flash-plugin gstreamer-plugins-bad gstreamer-plugins-ugly libquicktime

Step 4: Installing w32Codecs (required for xvid and other proprietary formats)

wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-20061022-1.i386.rpm ; rpm -ivh mplayer-codecs-20061022-1.i386.rpm
wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-extra-20061022-1.i386.rpm; rpm -ivh mplayer-codecs-extra-20061022-1.i386.rpm
You should now have full multimedia and video support for most popular formats.

mplayer 播放rmvb,rm没有图像只有声音
把selinux设置一下就好了
chcon -t textrel_shlib_t /usr/lib/codecs/drvc.so
chcon -t textrel_shlib_t /usr/lib/codecs/drv4.so.6.0
......
等等的都设置一下

mplayer播放rm、rmvb都没有问题,
只是播放有的rm、rmvb文件的时候有点问题,可以安装realplayer来播放,不要用realplayer官方网站上的,可以用http://forms.helixcommunity.org/heli...alplay-current

How to Mount an NTFS Filesystem

Installing required packages

  • " src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" title="" height="15" width="15"> While older ntfs drivers were prone to eat your data in r/w-mode, ntfs-3g seems to be r/w safe. See the ntfs-3g QA page for more information.

Make sure you have the rpmforge repo installed. If not, refer to Repositories.

Install the following packages.

yum install fuse fuse-ntfs-3g dkms dkms-fuse

(dkms and dkms-fuse install the fuse kernel module)

If the rpmforge repo is disabled by default,

yum --enablerepo=rpmforge install fuse fuse-ntfs-3g dkms dkms-fuse

If you are using the ATrpms repository there is no need to install dkms and dkms-fuse (you still need fuse-ntfs-3g from rpmforge).

The line to install from ATrpms then is

yum install fuse-kmdl fuse
  • " src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" title="" height="15" width="15"> Do not mix from both repositories if you have rpmforge and atrpms installed. Choose one to install fuse from. You might want to take a look at the yum priorities plugin to priorize one repository over the other.

    " src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" title="" height="15" width="15"> Make sure that you have the correct kernel-devel package installed - especially having one that matches your running kernel. dkms has kernel-devel as a requirement, but that only pulls in the standard kernel-devel package.

If you are running the xen kernel (kernel-xen), you need to

yum install kernel-xen-devel

If you're running kernel-PAE, you need to install

yum install kernel-PAE-devel

Same goes for kernel-smp and so on.

  • " src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" title="" height="15" width="15"> yum will install the latest kernel-*-devel package. Make sure that it fits the kernel you are using. You might have to reboot to run the latest installed kernel after a "yum update". The installed running kernel and the kernel-*-devel package have to match.

Mounting an NTFS filesystem

Suppose your ntfs filesystem is /dev/sda1 and you are going to mount it on /mnt/win, do the following.

First, create a mount point.

mkdir /mnt/win

Next, edit /etc/fstab as follows. To mount read-only:

/dev/sda1       /mnt/win   ntfs-3g  ro,umask=0222,defaults 0 0

To mount read-write:

/dev/sda1       /mnt/win   ntfs-3g  rw,umask=0000,defaults 0 0

You can now mount it by running:

mount /mnt/win

Users of the centosplus kernel

In centosplus (Repositories/CentOSPlus) kernels, both ntfs and fuse kernel modules are enabled. A main difference between ntfs and ntfs-3g is that the former is read-only. Therefore, if you do not need write access to the ntfs filesystem, add this line to /etc/fstab :

/dev/sda1       /mnt/win   ntfs  ro,umask=0222,defaults 0 0

If you wish to have read-write access, you would need the fuse-ntfs-3g package. But because the fuse module is already available in the kernel, you do not need dkms :

yum install fuse fuse-ntfs-3g
  • " src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" title="" height="15" width="15"> However, the fuse kernel module included in CentOS 5 (as of August 2007) produces a message: WARNING: Deficient FUSE kernel module detected. It still works, but it is advised that the fuse module from RPMforge (newer) be used instead.

Therefore, run:

yum install fuse fuse-ntfs-3g dkms dkms-fuse
to replace the existing fuse kernel module with the one from RPMforge.

Mount ntfs filesystem
mount -t ntfs-3g /dev/sda1 /mnt/windows


Let portable disk automount
ln -s /sbin/mnt.ntfs-3g /sbin/mnt.ntfs

2008年10月28日星期二

install wine+IE

Open a terminal. Log in as root to install wine and cabextract:

yum -y install wine*
yum -y install cabextract

Logout and install IEs 4 Linux with your normal user account:

wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux

2008年10月27日星期一

把白皑皑的窗口变成淡淡的苹果绿

>>>> 有一条养眼的做法:把白皑皑的窗口变成淡淡的苹果绿。方法是:桌面-右键 -属性-
>>>> 外观 -高级-项目-窗口(记住选窗口啊)-颜色-其它,,色调设为85,饱和度设为 90,亮
>>>> 度设为 205。然后单击[添加到自定义颜色]-确定...一路确定。
>>>>
>>>> 现在打开[我的电脑 ][资源管理器][浏览器]看看,原来的冰天雪地是不是已有了
>>>> 春意!天长日久,对眼睛的养护作用是不可低估的。

CentOS中文字体美化

我采用了苹果丽黑字体,效果很好。
1.字体文件夹位于/usr/share/fonts
建立新文件夹apple
2.将LiHeiPro.ttf字体文件放入
3.建立字体文件缓存
cd /usr/share/fonts/apple
mkfontscale
mkfontdir
fc-cache -fv
4.设置gnome,firefox的字体,全部设为LiHei Pro.