install
  1. Setting Screen Resolution to 1024 x 768 on a Red Hat Enterprise Linux 5 Virtual Machine

    If you using Redhat Enterprise Linux on a vmware console than you can change the resolution of the console running Linux according to your need by simply editing the configuration file  xorg.conf . You can find more about Vmware in my previous post here. Installing Rhel5 on Vmware here.

    Although when you run the vmware-tools script it makes all the necessary changes for you. But if you need to change the screen resolution to more than “800×600″ , you need to do it manually by editing the configuration file. To change the resolution simply follow the steps:

    • open the configuration file /etc/X11/xorg.conf mode and make sure you have included 1024 x 768 mode as shown below

    ——————————————
    Section “Screen”

    Identifier “Screen0″

    Device “Videocard0″

    Monitor “Monitor0″

    DefaultDepth 24

    SubSection “Display”

    Viewport 0 0

    Depth 24

    Modes “1024×768″

    EndSubSection

    ——————————————

    # vi /etc/X11/xorg.conf

    Configuration file for screen resolution of vmware in Linux

    You should have configuration file now as shown in above screenshot. Than save it and exit.

    • You need to restart the X server. To do this simply press Ctrl+Alt+Backspace or log out and login in again.
    • Now you can change the resolution of screen by simply switching to full screen mode.

    (ST)

  2. Vsftpd Config

    . Installation of VSFTPD

    For Red Hat, CentOS and Fedora, you may install VSFTPD by the command

    # yum install vsftpd

    For Debian and Ubuntu,

    # apt-get install vsftpd

    2. Virtual users and authentication

    We are going to use pam_userdb to authenticate the virtual users. This needs a username / password file in `db’ format – a common database format. We need `db_load’ program. For CentOS, Fedora, you may install the package `db4-utils’:

    # yum install db4-utils

    For Ubuntu,

    # apt-get install db4.2-util

    To create a `db’ format file, first create a plain text file `virtual-users.txt’ with the usernames and passwords on alternating lines:

    mary
    123456
    jack
    654321

    Then execute the following command to create the actual database:

    # db_load -T -t hash -f virtual-users.txt /etc/vsftpd/virtual-users.db

    On Ubuntu

    # db4.2_load -T -t hash -f virtual-users.txt /etc/vsftpd/virtual-users.db

    Now, create a PAM file /etc/pam.d/vsftpd-virtual which uses your database:

    auth required pam_userdb.so db=/etc/vsftpd/virtual-users
    account required pam_userdb.so db=/etc/vsftpd/virtual-users

    3. Configuration of VSFTPD

    Create a configuration file /etc/vsftpd/vsftpd-virtual.conf

    anonymous_enable=NO
    local_enable=YES
    guest_enable=YES
    virtual_use_local_privs=YES
    write_enable=YES
    pam_service_name=vsftpd-virtual
    user_sub_token=$USER
    local_root=/ftpfolder/$USER
    force_dot_files=YES
    chroot_local_user=YES
    hide_ids=YES
    listen=YES
    listen_port=21
    pasv_min_port=62222
    pasv_max_port=63333
    connect_from_port_20=YES
    local_umask=022
    tcp_wrappers=YES
    accept_timeout=180

    4. Creation of home directories

    Create each user’s home directory in /ftpfolder, and change the owner of the directory to the user `ftp’:

    # mkdir /ftpfolder/mary
    # chown ftp:ftp /ftpfolder/mary

  3. Cài đặt server lighttpd

    Xin chào tất cả các bạn, chắc hẳn các bạn đã khá quen biết với httpd server (Apache) và ít khi nghe đến lighttpd server. Nó là 1 webserver giống như apache có thể hoạt động trên môi trường Linux/Unix cũng như Windows và điều căn bản nếu bạn nghe xong là thích ngay là nó rất nhẹ. Có thể nói đây là 1 con webserver an toàn, nhanh nhẹn, khả chuyển và tối ưu cao đối với môi trường

    I. Cách cài đặt

    Hiện nay lighttpd đã có version 1.5 với việc hỗ trợ chuẩn h264(mp4) streaming đẳng cấp cao hơn so với version 1.4 chỉ hỗ trợ h263(flv) streaming. Ngoài ra còn 1 module nữa khá hữu ích đối với bạn đó upload_progress cho phép bạn quan sát được quá trình upload bao gồm bao nhiêu byte/byte, thời gian như thế nào …Bạn có thể download mã nguồn từ dòng lệnh shell như sau

    $ wget http://lighttpd.net/download/lighttpd-1.x.y.tar.gz

    với x và y là version của lighttpd (chi tiết về version các bạn có thể xem tại trang chủ). Sau đó bạn giải nén ra

    $ tar -zxvf lighttpd-1.x.y.tar.gz
    $ cd lighttpd-1.x.y

    Tiến hành biên dịch qua các câu lệnh sau

    ./configure –prefix=/usr/local/lighttpd

    make

    make install

    Nếu không có gì xảy ra là ta đã cài đặt xong.

    - Vào thư mục đã cài lighttpd và tạo một số thư mục cần thiết:
    + Nơi chứa file cấu hình lighttpd.conf:
    root@linux:/usr/local/lighttpd# mkdir etc

    + Nơi chứa các logs file.
    root@linux:/usr/local/lighttpd# mkdir logs

    + Nơi chứa website:
    root@linux:/usr/local/lighttpd# mkdir www

    + Nơi chứa pid file:
    root@linux:/usr/local/lighttpd# mkdir -p var/run

    - Tạo user và group cho lighttpd (tất nhiên ta ko dại gì mà chạy lighttpd dưới quyền root, vì như thế là quá nguy hiểm):
    Code:

     root@linux:/usr/local/lighttpd# groupadd lighttpd
    root@linux:/usr/local/lighttpd# useradd lighttpd
    -g lighttpd -s /bin/false -d /dev/null

    - Chỉnh lại quyền cho thư mục logs (vì lighttpd chạy dưới quyền user lighttpd nên user này phải có quyền ghi trên thư mục logs):
    Code:

     root@linux:/usr/local/lighttpd# chown -R lighttpd logs/

    Ở điểm này chắc Apache ngon hơn smilie).
    - Sau đó copy file lighttpd.conf tại nơi chứa mã nguồn sang thư mục etc mà ta vừa tạo (file này nằm trong thư mục doc).
    Code:

     root@linux:/usr/local/lighttpd# cp /usr/local/src/
    lighttpd-1.4.15/doc/lighttpd.conf /usr/local/lighttpd/etc/

    - Như vậy ta đã chuẩn bị xong, giờ ta dạo một vòng qua file lighttpd.conf và chỉnh sửa một số thông tin cho phù hợp:
    Xem qua file lighttpd.conf thì thấy nó hỗ trợ khá nhiều modules, nhưng mặc định lighttpd chỉ bật hai modules là mod_access và mod_accesslog.
    + Thay đổi Document Root (nơi chứa website):
    server.document-root = “/usr/local/lighttpd/www/”
    + Error Log:
    server.errorlog = “/usr/local/lighttpd/logs/lighttpd.error.log”
    + Access Log:
    accesslog.filename = “/usr/local/lighttpd/logs/access.log”

    + Mặc định lighttpd nghe trên cổng 80, bạn có thể thay bằng cổng khác.
    server.port = 80

    + Thay đổi đường dẫn của pid file:
    server.pid-file = “/usr/local/lighttpd/var/run/lighttpd.pid”

    + Thay đổi user và group cho lighttpd (user và group này ta đã tạo ở trên):
    server.username = “lighttpd”
    server.groupname = “lighttpd”

    + Thay đổi thông tin về webserver trên HTTP Header:
    server.tag = “Apache version 10″
    Thay nó bằngApache version 10 (cho vui smilie ).

    - OK, giờ ta chạy thử lighttpd:
    root@linux:/usr/local/lighttpd# ./sbin/lighttpd -f etc/lighttpd.conf
    Sau khi khởi động thành công bạn tạo một file index.html trong thư mục www và kiểm tra thử xem webserver đã chạy đúng chưa:
    http://ip_address

    II. Cấu hình lighttpd 1.5 với PHP

    + Trước tiên bạn cần phải cài đặt PHP (thường từ version 5 trở lên). Kiểm tra bằng cách gõ php-cgi -v nếu hiện thông tin thì bạn đã cài

    + Tiếp đến mở file config của lighttpd ra bỏ chú thích 2 dòng mod_proxy_core và mod_proxy_backend_fastcgi

    + Tìm đến đoạn

    $HTTP["url"] =~ "\.php$" {
    proxy-core.balancer = "round-robin"
    proxy-core.allow-x-sendfile = "enable"
    proxy-core.check-local = "enable"
    proxy-core.protocol = "fastcgi"
    proxy-core.backends = ( "unix:/tmp/php-fastcgi.sock" )
    proxy-core.max-pool-size = 16
    }
    Sửa thành
    $PHYSICAL["existing-path"] =~ "\.php$" {
    proxy-core.balancer = "round-robin"
    proxy-core.allow-x-sendfile = "enable"
    # proxy-core.check-local = "enable"
    proxy-core.protocol = "fastcgi"
    proxy-core.backends = ( "unix:/tmp/php-fastcgi.sock" )
    proxy-core.max-pool-size = 16
    }
    Sau đó chạy command sau để thiết lập fcgi-spawn
    /usr/bin/spawn-fcgi -s /tmp/php-fastcgi.sock -f /usr/bin/php-cgi
    -u lighttpd -g lighttpd -C 32 -P /var/run/spawn-fcgi.pid


    Sau đó khởi động lighttd bằng ./bin/ligttpd -f etc/lighttpd.conf

    Tags

  4. Tạo Hiren’s BootCD từ USB Flash Drive (USB Pen Drive - Sưu tầm)

    Các bước sau để tạo 1 đĩa Hirent Boot cho chiếc USB của bạn trong trường hợp bạn không có điều kiện boot từ CDROM hoặc nếu bạn dùng laptop HP các dòng DV4, DV5 thì 1 số bản Hirent boot cũ không hỗ trợ định dạng ổ cứng SATA

    Bước 1
    Bạn cắm USB vào (khuyến nghị dùng USB có dung lượng lớn hơn hoặc bằng 256Mb)

    Bước 2
    Tải và chạy chương trình USB Disk Storage Format USB Disk Storage Format usb_format.zip (34KB). Bạn sẽ nhìn thấy giao diện như sau:
    Screenshot

    Chọn các tùy chọn như hình vẽ và bấm Start

    Bước 3
    Tải và chạy chương trình grubinst_gui Grub 4 Dos grub4dos.zip (147KB)
    Screenshot

    Chọn các tùy chọn như hình vẽ và bấm Install

    Bước 4
    Copy 2 tệp grldr và menu.lst (từ thư mục grub4dos.zip) vào ổ USB
    Screenshot

    Bước 5
    Bạn giải nén File iso của Hirent boot vào ổ USB và phải đặt tên là HBCD (chú ý bên trong đó là tệp boot.gz)

    Link cho Hiren’s BootCD 10.0:

    http://rapidshare.com/files/273811704/Hiren_s_BootCD_10.part1.rar.html

    http://rapidshare.com/files/273810847/Hiren_s_BootCD_10.part2.rar.html

    Bước 6

    Chỉnh Bios cho boot từ USB và bạn có thể dùng như HirentBoot trên đĩa CD thật :D

    Tags

  5. Cài đặt Windows XP từ ổ USB Flash (Sưu tầm)

    Bước 1:

    Chuẩn bị sẵn 1 ổ USB Flash (ít nhất 2GB).

    Lưu ý: Khi thực hiện theo bài hướng dẫn này, bạn cần có một máy tính với ổ CD-ROM hoạt động tốt.

    Bước 2:

    Tải gói phần mềm Komku-SP-usb.exe tại đây.

    Bước 3:

    Kích đúp Komku-SP-usb.exe. Một cửa sổ xuất hiện, kích Install.

    Bước 4:

    Cắm ổ USB vào máy tính.

    Tìm tới thư mục C:\Komku\PeToUSB. Kích đúp PeToUSB.exe.

    Một cửa sổ sẽ hiện ra như sau…

    Destination Drive: chọn USB Removable

    Đánh dấu các ô Enable Disk Format, Quick Format, Enable LBA (FAT 16x)

    Drive Label: Đặt nhãn ổ USB tùy ý bạn, trong trường hợp này là XP-KOMKU

    Sau đó kích Start.

    Kích Yes để tiếp tục…

    Kích Yes

    Đợi một chút…

    Kích OK, sau đó bạn có thể đóng cửa sổ PeToUSB

    Bước 5:

    Mở Command Prompt bằng cách vào Start > Run > gõ cmd > kích OK

    Trong cửa sổ lệnh, chuyển tới thư mục C:\Komku\bootsect

    Cụ thể: đầu tiên, gõ cd\ rồi nhấn Enter

    Sau đó gõ cd komku\bootsect rồi nhấn Enter

    Kết quả…

    Đừng đóng cửa sổ Command Prompt, hãy tiếp tục bước 6.

    Bước 6:

    Trong cửa sổ Command Promt, gõ bootsect /nt52 H:

    trong đó H là tên ổ USB trên máy.

    Rồi nhấn Enter. Kết quả

    Bước 7:

    Tiếp tục gõ cd.. và nhấn Enter

    Sau đó gõ cd usb_prep8 rồi nhấn Enter

    usb_prep8 lần nữa, nhấn Enter

    Bước 8:

    Bạn sẽ thấy cửa sổ Command Prompt như sau:

    Ấn phím bất kỳ để tiếp tục.

    Bây giờ đưa đĩa Windows XP vào ổ CD/DVD ROM rồi quay trở lại cửa sổ Command Prompt.

    1 nhấn Enter hộp thoại Browse For Folder sẽ xuất hiện. Chọn ổ CD/DVD của bạn, kích OK.

    Kết quả: mục “XP Setup Source Path” sẽ chuyển thành tên ổ CD/DVD của bạn.

    Ở mục 2, nếu chữ cái T đã được gán cho 1 ổ đĩa trên máy tính bạn, bạn cần thay đổi mục này. Nếu không, hãy để nguyên.

    Vậy làm thế nào để thay đổi?

    2 rồi nhấn Enter, sau đó nhập 1 chữ cái bất kỳ không trùng với tên các ổ đĩa trên máy tính bạn. Ví dụ bạn không có ổ S, nhập S rồi nhấn Enter.

    Trở lại cửa sổ usb_prep8, gõ 3 rồi nhấn Enter.

    Nhập tên ổ USB của bạn. Trong trường hợp này ổ USB là ổ H

    vì vậy nhập H rồi nhấn Enter.

    Tiếp theo, nhập 4 nhấn Enter rồi đợi một lát.

    Y nhấn Enter và tiếp tục đợi.

    Sau khi quá trình format ổ đĩa ảo hoàn thành, nhấn phím bất kỳ để tiếp tục.

    Tiếp tục đợi….

    Nhấn phím bất kỳ để tiếp tục

    Chọn Yes

    Tiếp tục Yes

    Chọn Yes, đợi một lát rồi nhấn phím bất kỳ 2 lần để đóng cửa sổ usb_prep8

    Chúc mừng bạn, cuối cùng ổ USB của bạn đã sẵn sàng.

    Bước 9:

    Cắm ổ USB vào chiếc máy tính không có ổ CD-ROM mà bạn muốn cài đặt Windows XP. Vào BIOS, chọn khởi động từ USB HDD (hoặc USB ZIP tùy mỗi máy). Sau đó khởi động lại máy từ ổ USB.

    Chọn “TXT Mode Setup…”

    Tiếp tục cài đặt Windows XP như bình thường.

    Khi chế độ cài đặt text mode kết thúc, máy tính sẽ tự khởi động lại. Lần này chọn “GUI Mode Setup…”

    Tiếp tục cài đặt các bước cài đặt Windows XP cho tới khi hoàn thành!

    Chúc các bạn thành công!

    Tags

  6. Hướng dẫn cài memcacheq (Memcache Queue) trên Ubuntu 9.04

    Chúng ta biết rằng hiện nay các webserver ngoài việc sử dụng memcached để nâng cao tốc độ còn dùng memcached queue cho việc lập lịch những dữ liệu cần thời gian xử lý lâu. Hôm nay, tôi sẽ hướng dẫn các bạn cài memcacheq server phiên bản 0.1.1

    + Đầu tiên bạn cần có bản cài đặt của memcacheq và các thư viện cần thiết cho việc cài đặt. Phiên bản hiện tại tôi sử dụng

    Thư viện

    db-4.7.25.tar.gz

    libevent-1.4.9-stable.tar.gz

    Bản cài đặt memcacheq-0.1.1.tar.gz

    B1. Download BerkekeyDB từ<http://www.oracle.com/database/berkeley-db/db/index.html>
    Cài đặt

    $tar xvzf db-4.7.25.tar.gz
    $cd db-4.7.25/
    $cd build_unix/
    $../dist/configure
    $make
    $sudo make install

    B2. Download libevent <http://monkey.org/~provos/libevent/>

    Cài đặt
    $tar xvzf libevent-1.4.x-stable.tar.gz
    $cd libevent-1.4.x-stable
    $./configure
    $make
    $sudo make install

    Trên linux, thêm 2 dòng sau vào /etc/ld.so.conf::

    /usr/local/lib
    /usr/local/BerkeleyDB.4.7/lib

    sau đó chạy ‘ldconfig’.

    B3. MemcacheQ
    ==================
    Cài đặt
    $tar xvzf memcacheq-0.1.x.tar.gz
    $cd memcacheq-0.1.x
    $./configure –enable-threads
    $make
    $sudo make install

    Khởi động

    memcacheq -d -u root -r -H /data1/memcacheq -N -v -L 1024 -B 1024

    Vậy là các bạn có thể sử dụng memcacheq cho những mục đích riêng của mình rùi đó

    Tags

  7. Hướng dẫn cài đặt NS2 trên Ubuntu 9.04

    NS2 hay Network Simulator 2 là bộ mô phỏng mạng rất hữu ích trong việc nghiên cứu đánh giá hiệu năng mạng. Hôm nay tôi xin trình bày các bước để cài đặt bộ mô phỏng này trên hệ điều hành Ubuntu 9.04

    + Đầu tiên các bạn cần tải bản all-in-one phiên bản mới nhất của bộ mô phỏng này tại địa chỉ http://sourceforge.net/project/showfiles.php?group_id=149743&package_id=169689&release_id=684492

    + Mở chương trình Terminal của Ubuntu

    + Bạn cần cài đặt các thư viện cần thiết cho bộ mô phỏng như sau (yêu cầu có kết nối mạng Internet)

    sudo apt-get autoconf automake build-essential libxmu-dev

    + Sau đó vào thư mục ns-allinone-2.34 đã được giải nén và gõ:

    ./install

    + Tiếp đến bạn cần thêm các giá trị của biến môi trường bằng cách gõ

    sudo gedit ~./bashrc

    + Sửa file trên bằng cách thêm các nội dung sau

    #environment values for NS2/NAM

    # LD_LIBRARY_PATH

    OTCL_LIB=/your directory/ns-allinone-2.34/otcl-1.13

    NS2_LIB=/your directory/ns-allinone-2.34/lib

    X11_LIB=/usr/X11R6/lib

    USR_LOCAL_LIB=/usr/local/lib

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

    # TCL_LIBRARY

    TCL_LIB=/your directory/tcl8.4.18/library

    USR_LIB=/usr/lib

    export TCL_LIBRARY=$TCL_LIB:$USR_LIB

    # PATH

    XGRAPH=/your directory/ns-allinone-2.34/bin:/your directory/ns-allinone-2.34/tcl8.4.18/unix:/your directory/ns-allinone-2.34/tk8.4.18/unix

    NS=/your directory/ns-allinone-2.34/ns-2.34/

    NAM=/your directory/ns-allinone-2.34/nam-1.13/

    PATH=$PATH:$XGRAPH:$NS:$NAM

    Như vậy là bạn đã hoàn thiện xong quá trình cài đặt NS2 và có thể sử dụng để mô phỏng các thí nghiệm của riêng bạn.

    P/s: Chi tiết về Ns2 các bạn có thể tham khảo thêm ở địa chỉ sau http://www.isi.edu/nsnam/ns/index.html

    Tags

  8. Hướng dẫn cài đặt và cấu hình APE (Ajax Push Engine) Server trên Ubuntu 9.04

    APE là một giải pháp mã nguồn mở được thiết kế cho Ajax Push. Nó cho phép thực thi bất kỳ loại dữ liệu real time đối với web server mà không cần cài đạt thêm bất kỳ thứ gì ở phía client. Chi tiết về APE các bạn có thể tham khảo tại đây.

    Sau đây tôi xin trình bày các bước để có thể cài đặt, cầu hình cũng như chạy demo một ví dụ của APE.

    B1. Bạn cần cài đặt web server (Apache) trước

    sudo apt-get install apache2

    B2. Bạn vào trang chủ của dự án APE để down chương trình cài đặt bản mới nhất. Ở đây tôi dùng version 1.0 http://www.ape-project.org/files.php?f=APE-Project_1.0.tar.gz&v=1.0

    Sau khi down về và giải nén bạn chạy

    dpkg -i ape-1.0.i386.deb

    để cài đặt APE trên Ubuntu. Chú ý là cần phải có sẵn thư viện build-essential và libmysqlclient-dev đã được cài đặt

    B3. Vừa rồi chúng ta đã xong phần cài đặt. Tiếp đến là việc cấu hình chi tiết cho APE

    File config của APE nằm tại /etc/ape/ape.conf. Tại đây bạn có thể hiệu chỉnh số hiệu cổng và một số thông tin khác

    # ./bin/ape.conf
    Server {
    	port = 80               # The port of APE - Here 80 with the use of a dedicated IP for the APE Server.
    daemon = no # if "yes", launches APE in background
    ip_listen = <ip to bind APE>
    domain = auto
    rlimit_nofile = 10000
    }

    B4. Tiếp theo bạn vào file /etc/hosts thêm các dòng sau

    127.0.0.1 ape-test.local
    127.0.0.1 ape.ape-test.local
    127.0.0.1 0.ape.ape-test.local
    127.0.0.1 1.ape.ape-test.local
    127.0.0.1 2.ape.ape-test.local
    127.0.0.1 3.ape.ape-test.local
    127.0.0.1 4.ape.ape-test.local
    127.0.0.1 5.ape.ape-test.local
    127.0.0.1 6.ape.ape-test.local
    127.0.0.1 7.ape.ape-test.local
    127.0.0.1 8.ape.ape-test.local
    127.0.0.1 9.ape.ape-test.local

    Với ape-test.local là domain của bạn mong muốn

    B5. Bây giờ chúng ta đã cấu hình xong cho APE Server. Chúng ta cần thiết lập APE Javascript Framework và kiểm tra xem APE Server hoạt động có đúng không

    Chúng ta sẽ tạo một VirtualHost entry như sau

    <VirtualHost *>
    Servername yourdomain.com
    ServerAlias ape.yourdomain.com
    ServerAlias *.ape.yourdomain.com

    DocumentRoot "/directory/of/your/choice/"
    </VirtualHost>

    Ở đây yourdomain.com chính là ape-test.local ở trên

    B6. Sau khi hoàn thiện việc trên bạn cầu khởi động lại APE server và apache2 server

    B8. Kiểm tra kết quả

    sudo /etc/init.d/apache2 restart

    sudo /etc/init.d/ape-server restart

    B7. Đưa các tệp trong ape-jsf vào thư mục gốc của VirtualHost vừa tạo ra ở trên (/directory/of/your/choice/)

    Sau đó mở tệp Demos/config.js và sửa như sau

    // To test, go to http://ape-test.local/ape-jsf/Tools/Check/
    APE.Config.baseUrl = 'http://ape-test.local/ape-jsf'; //APE JSF
    APE.Config.domain = 'ape-test.local'; // /etc/hosts domain, must be same as domain in aped.conf
    APE.Config.server = 'ape.ape-test.local:6969'; //APE server URL

    Sau đó từ trình duyệt bạn chạy đường dẫn sau

    http://ape-test.local/ape-jsf/Tools/Check/

    Nếu Ok thì bạn đã có thể dùng thử các ứng dụng demo mà APE Project đã tạo sẵn ra.

    APE Server là một giải pháp hữu ích đối với những web server muốn bổ sung các tính năng real time. Do đó, ngay từ bây giờ các bạn có thể trải nghiệm nó để khám phá những điều thú vị.

    Tags

  9. Shadowing model in ns-2

    I wanted to do simulations with a more realistic propagation model in ns-2, to examine the effect of lossy links at the edge of the propagation area. To do this, I had to work with the Shadowing propagation model, and I’ve made some discoveries. :-|

    First and foremost, the Phy/WirelessPhy RXThresh_ variable cannot be reduced below something like 10^-12. Thus, to get what I wanted, a more or less sharp cut-off at above 250 m radius, I had to increase the antenna gains from 1 to 20.

    The radio propagation application threshold can be used to determine the RXThresh_ value for a certain packet reception probability rate at a radius from the node. I used it for a 0.95 probability rate at 250 m. However, without increasing the gain of the antenna reception and transmission to 20.0, the RXThresh_ value was too small, at 4.73e-13, actually producing the same results as setting the RXThresh_ value to 0. Thus, don’t make the same mistake as me, be mindful of the (hidden?) minimum value of the RXThresh_ even if the output from threshold states otherwise.

    At the University of Hamburg – Harburg a Matlab-script to plot the packet receival probability at varying distances using the shadowing propagation model with defined parameter settings can be found. Firefox may not like the certificate and block you from the page, but I recommend to make an exception for this page, as the script works perfectly in Matlab. The script is an enormous help in determining the optimal shadowing parameters, and the picture on the right is a graph generated by the script.

    The result on the picture to the right was obtained with the following parameter values:

    Pt = 0.28183815;       % transmit power
    Gt = 20.0;              % transmit antenna gain
    Gr = 20.0;              % receive antenna
    freq = 2.4e9;        % frequency
    sysLoss = 1.0;         % system loss
    pathlossExp = 10.0;     % path loss exponent
    std_db = 4.0;          % shadowing deviation
    dist0 = 120.0;           % reference distance
    lambda = 3.0e8/freq;   % lambda
    rxThresh_=1.10552e-10;      % rx threshold

    Now you have no excuse; go run some simulations with shadowing!

    Tags

  10. Running TORA in ns-2.34 on Ubuntu 10.04

    First, patch the ns-2.34 code using the patch and recipe from http://wpage.unina.it/marcello.caleffi/ns2/tora.html.

    Then, to avoid eternal loops making the simulation never ending, fix the line 504 (ns-2.34) in imep/imep.cc which reads

    rexmitTimer.start(rexat - CURRENT_TIME);

    If rexat – CURRENT_TIME is 0, then the same function is called immediately without increasing the simulation time, creating an eternal loop. I would have replaced the line with the following lines:

    if (rexat-CURRENT_TIME<0.000001) // Preventing eternal loop.
       rexmitTimer.start(0.000001);
    else
       rexmitTimer.start(rexat - CURRENT_TIME);

    Then recompile with make, and enjoy. :-)

    (Sưu tầm)

    Tags