Skip to main content

Posts

Showing posts with the label Linux

Mastering Iptable Command Line Usage Linux Networking

Some of the most useful commands related to iptable , To display filter table rules. #iptables -t filter -L To display nat table rules. #iptables -t nat -L To display raw table rules #iptables -t raw -L To display mangle table rules. #iptables -t mangle -L To delete all rules in the filter,nat,raw and mangle table. #iptables -t filter -D #iptables -t nat -D #iptables -t raw -D #iptables -t mangle -D Set up IP FORWARDing and Masquerading # iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE The above rule will do source nating. ( It will set eth0 IP address as source address for all outgoing packets on interface eth0.) # iptables --append FORWARD --in-interface eth1 -j ACCEPT Port forwading # iptables -t nat -A PREROUTING -i eth0 -d --dport -j DNAT --to The above rule will change the destinationIP:portnumber of the incoming packet to private.IP:portnum Enabing the packet forward in the kernel with proc entry. #echo 1 > /proc/sys/net/ipv4/ip_forward iptables ...

Creating & Working On a CVS Branch Example Usage

Example usage OF Creating & Working On a CVS Branch Tried working hard on CVs commands, here is simple example for working in branch using CVS, CVS is becoming nomore use with everyone opting for SVN, still CVS usages is wide as it is old, Lets start with CVS commands to create a branch This is done with two commands, cvs tag -b release-1 //create branch cvs update -j release-1 //merge the changes in main tot Lets see with simple example Creating and working on a branch for the existing kernel source. #cvs co kernel/linux-2.6.26 #cd kernel/linux-2.6.26/ #cvs tag -b release-1 First we created a branch to the kernel source, as we are doing first release. Continue your development work for second release. After some time, reported a problem in the first release. So you need to Get the kernel source code of first release. #cvs co -r release-1 kernel/linux-2.6.24 and fix the problems Now If you want to merge these changes in to main trunk. #cvs update -j release-1 And you are done with ...

Linux SMB write performance With Simple Tips

SMB write performance can be increased by Tuning the buffer cache. The secret to good performance is to keep as much of the data in memory for as long as is possible. Writing to the disk is the slowest part of any filesystem. If you know that the filesystem will be heavily used, then you can tune this process for Linux Samba. writing out dirty blocks to the disk until the filesystem buffer cache is 80 percent full (80). default is 40%, source = http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap29sec287.html by writing echo 80 > /proc/sys/vm/dirty_ratio I am getting around 2MB increase while write operation, tested in Xp. I have tried with this single option, as the ref source is for linux 2.2 and we are using 2.6 kernel. we can try out Linux General Optimization suggested at http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/gen-optim.html Tried with smb.conf, I am getting around 1MB gain while read and write. socket options = TCP_NODELAY I...

Define:Blu-ray & About Blu-ray Movies HDTV Info

The Advancement of technology had entered into nanometer age. search in google define:Blue-ray will get wiki pages here is summary of it. Blu-ray Disc (also known as Blu-ray or BD) is an optical disc storage medium designed to supersede the standard DVD format. Its main uses are for storing PlayStation 3 games, high-definition video, and data storage, with up to 50 GB per disc. This is quite impressive, The disc has the same physical dimensions as standard DVDs and CDs. Why Blu-ray disc stores 50GB on same size of DVD/CD? Well here is advancement of laser technology, thanks to Shuji Nakamura for his invention on blue laser, The name Blu-ray Disc derives from the blue-violet laser used to read the disc. While a standard DVD uses a 650 nanometre red laser, Blu-ray uses a shorter wavelength, a 405 nm blue-violet laser, and allows for almost six times more data storage than on a DVD. check out about Blu-ray Movies - Everything about Blu-ray movies and releases .at http://www.blu-ra...

Get HyperSCSI for SAN - Storage Area Network

Get HyperSCSI for SAN - Storage Area Network SCSI (Small Computer Systems Interface) family of protocols. HyperSCSI can allow one to connect to and use SCSI and SCSI-based devices (like IDE, USB, Fibre Channel) over a network as if it was directly attached locally. Why HyperSCSI over iSCSI? The main advantage of HSCSI compared to iSCSI is especially a lower network load as well as an end system (server and client) load. TCP/IP SAN performance is still not good enough without hardware acceleration FC-based SANs cannot do Storage Wide-Area Networks Fully functional software implementation of both client and server so HSCSI can be used for a solution built on commonly available hardware, no expensive and specialized hardware is needed. Therefore, HSCSI can be used for building small and cheap SANs. HSCSI main disadvantage is this protocol has no official standard like iSCSI nd so it is unsupported in any way by manufacturers developing hardware data storage solutions. Two modes of oper...

Create File Of Any Size in Linux Using DD Command

How do I create a file of any given size on Linux? using the dd command. $ dd if=/dev/zero of=testss bs=1024 count=1048576 This will create a file of size 1024 * 1048576 bytes (or 1 GB). where if - input file of - output file or the file to be created bs - block size in bytes count - # of blocks of size bs Easiest and fasted way to create file of 250GB using DD command $ dd if=/dev/zero of=tests bs=1 count=0 seek=250G read dd(1) - Linux man page

Configure udhcpc for Setting IP netmask and Gateway

How to Configure udhcpc for Setting IP netmask and Gateway? Tell udhcpc client to run on eht1 interface with -i option. Also use -s option to tell udhcpc client to use script from specified path. /sbin/udhcpc -i eth1 -p /var/run/dhcpClient-wifi.pid -s /usr/share/udhcpc-wifi/default.script & default.script directs the udhcpc to executes one by one scripts from specified folder ie /usr/share/udhcpc-wifi/ else default folder location for udhcpc script is /usr/share/udhcpc/ For directing IP address to temp file obtained using udhcpc client or for DHCP , do little modification in sample.bound file. Here is Sample udhcpc renew script, which will update the ip address, netmask and gatway obtained by boradcasting. The new values will be updataed in /var/dhcpfile. #!/bin/sh # Sample udhcpc renew script RESOLV_CONF="/etc/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subn...

UDP Traffic Generator Client Side C code

Learning Networking basics using C programs, to start with here is simple UDP client side code, Why to start with UDP because its simple, no need of connection handshake like TCP . This code sends continues UDP traffic over network, depending on the payload (ie send_buf) and delay between each transfer, rate at which data is pumped over network is calculated. Example: this client program is sending constant length 0f 1400 (in sendto function), so if you keep delay as 1s then data transfer rate will be 1400 per sec, decrease the delay to pump traffic at high rate. You need UDP server side code for running this client. udp client #include #include #include #include #include #include #include #include /* memset() */ #include /* select() */ #define REMOTE_SERVER_PORT 1500 #define MAX_MSG 1600 int main() { int sd, rc, i; struct sockaddr_in cliAddr, remoteServAddr; struct hostent *h; char *send_buf; unsigned int count=0; int reply; send_buf= (c...

From Windows Vista Home Edition Access SMBD ver 2.2.12

How to Access NAS Box From Windows Vista Home Edition? Access NAS box windows vista (Ultimate editions), If you NAS box contains SMBD/ SAMBA version less than or equals 2.2.12 Steps to access NAS box from Windows Vista Home Edition 1. In the Windows taskbar, click Start and select Run. In Run window type “regedit” and press OK. 2. This will open User Account control window, here click continue. 3. Double click on the “HKEY_LOCAL_MACHINE” , “SYSTEM”, “Current Control Set” and “Control”. 4. Then click on “Lsa” then you will get some parameters in the right windowpane. 5. Find for “LMCompatibilityLevel” and double click on this item. 6. In the edit window change the “Value data” to 1 from 3. 7. Press OK then Close the Registry Editor (regedit). your Vista PC ready to access the NAS box.

How to participate in the Linux kernel community

How to participate in the Linux kernel community? check out A GUIDE TO THE KERNEL DEVELOPMENT PROCESS Jonathan Corbet has written a very interesting article on "how to participate in the Linux kernel community" Section 1 is the executive summary. Section 2 introduces the development process, the kernel release cycle, and the mechanics of the merge window. Section 3 covers early-stage project planning, with an emphasis on involving the development community as soon as possible. Section 4 is about the coding process; several pitfalls which have been encountered by other developers are discussed. Section 5 talks about the process of posting patches for review. Section 6 covers what happens after posting patches; the job is far from done at that point. Section 7 introduces managing patches with git and reviewing patches posted by others. Section 8 concludes the document with pointers to sources for more information on kernel development. Please take a look at the complete documen...

Access Samba Using Dos Commands List Here

I was searching for accessing samba using DOS command, Finally I managed it by own; here is list of useful command. To mount or to map the SAMBA folder to local machine. eg; to map public folder from and copy test.txt use :- net use z: \\computer\folder Map the Z: drive to the network path //computer/folder. net use z: \\2.168.4.500\public enter user-name (if connecting first time) enter password To copy the data to this drive ie to put file copy test.txt \\2.168.4.500\public to get the file copy \\2.168.4.500\public\test.txt To delete the connection use net use z: /del /yes

Linux Essential Shortcuts and Commands

Linux essential shortcuts and sanity commands Switch to the first text terminal. Under Linux you can have several (6 in standard setup) terminals opened at the same time. (n=1..6) Switch to the nth text terminal. tty Print the name of the terminal in which you are typing this command. Switch to the first GUI terminal (if X-windows is running on this terminal). (n=7..12) Switch to the nth GUI terminal (if a GUI terminal is running on screen n-1). On default, nothing is running on terminals 8 to 12, but you can run another server there. (In a text terminal) Autocomplete the command if there is only one option, or else show all the available options. THIS SHORTCUT IS GREAT! It even works at LILO prompt! Scroll and edit the command history. Press to execute. Scroll terminal output up. Work also at the login prompt, so you can scroll through your bootup messages. Scroll terminal output down. (in X-windows) Change to the next X-server resolution (if you set up the X-server to more than o...

Useful Vi Editor Trick

Here is yet another Vi editor trick. At the Vi editor, we can edit multiple files by switching between them (With out opening another terminal) $vi ex1.c ex2.c ex3.c To switch one file to another use :n, :#e (With out exiting and opening the file) like $vi ex1.c ex2.c ex3.c :n Move forward to next file is the file list :e# Toggle between the last two edited files :rew Rewind file list and reopen first file in the list

Animated LILO The Linux Loader for SuSE Linux 7.2 or Animated boot-up screen

It's just something fun to do to add eye candy to your boot-up screen, if your tired of looking at the same old LILO prompt or boot-up screen every time you start your system. Make your LILO boot screen more exciting with animated pictures! From the author's web page: Since mid-2001, most Linux distributions include some patched versions of LILO (the LInux LOader) that support VGA or VESA graphical modes and make it possible to have a nice background image while booting. Starting with SuSE Linux 7.2, the SuSE distribution includes an interesting extension to LILO that allows a programmer to define some callback functions that are triggered when some events occur (key pressed, timeout, ...). It gives a much greater flexibility than the other extensions that are provided by most of the other Linux distributions, including the new graphical modes that have recently been added to the official version of LILO 22.x. While testing the SuSE version of LILO and the helper program mkboot...

Gear Up for GSoC 2009 Google Summe of Code

The Google Summer of Code is a program designed to encourage college student participation in open source development. How does it work ? Students submit project proposals to the organizations, organizations rank the submissions (students paired with mentor from open source community).Google allocates a given number of slots to each organization, the students work all summer on their project in close mentored collaboration with that organization. GSoC 2009 Timeline March 9-13: Google will accept applications from open source projects. March 13-17: Google program administrators review organization applications. March 18: List of accepted mentoring organizations published on code.google.com/soc/ March 23-April 3: Student applications acceptance period. March 23: Student application period opens. April 3: Student application deadline. April 20: Accepted student proposals announced at http://code.google.com/soc/ August 24: Final evaluation deadline. September 3: Students can begin submitt...

Useful VI Commands For Linux Beginners Read on

useful vi commands for Linux beginners 1) To open two files in single window of vi editor a) vi a.c b) give the following command in vi editor to open b.c file :sp b.c c) Now vi editor contain two files in each half screen. TO switch between two files use ctrl+ww. 2)Replacing a text a) vi a.c b) In a.c file, replace printf with printk using follwing command :%s/printf/printk This will replace only first occurrence of printf in each line. :%s/printf/printk/g The above command will replace all printf words in entire file with printk. :%s/printf/printk/gc The above command will ask confirmation. :s/printf/printk This commamnd will replace in current line. 3)setting auto indentation: In home directory create .exrc file add the following commands :set nu :set cindent :set cindent will do indentation in C 4) To open a man page of a system call from vi editor a) vi a.c put the cursor at s...

Linux Command Line Most Used Shortcuts

Just sharing some of the command line shortcuts that I used and learnt; please share yours also. 1. To search in history or run previous commands This is my most used shortcut. Hit Control-R and begin to type a string. For example, type the following and hit Enter . grep root /etc/passwd Then hit Control-R and begin to type 'grep'. Control-R (reverse-i-search)`gre': grep root /etc/passwd When you see the original command listed, hit Enter to execute it. Alternatively, you can also hit the Right-Arrow to edit the command before running it. Use -> ctrl + r and type the command, to go one more level back again hit ctrl + r, to edit the command before you execute use right key arrow. 2. To clear the present screen use -> ctrl + l (My discovery works on board also). 3. To edit previous command using vi commands -> set -o vi Now you can use the Vi cw command to change the word in command. 4. Use of alias alias ll='ls -l' alias gohome='cd; ls' If...

Effective Linux Kernel Search Trick here

I was wondering how to search a big kernel source for my specific keywords. Here I found out some of the combination. Also there may be lot of ways to do the same things, that's the beauty of Linux. Here we go 1. looking for MCS8142_SPI_FLASH in kernel use find . -name "*.c" | xargs grep "MCS8142_SPI_FLASH" | more And here is the output. ./drivers/mtd/devices/mcs8142.c: mtd = mtd_concat_create(mtd_con,NO_OF_BANKS,"MCS8142 _SPI_FLASH"); similar way you can grep for a particular struct from kernel source; eg; find . -name "*.c" | xargs grep "struct jffs_node" | more 2. looking for MTD flag is set from .config file here is the command grep MTD .config | grep =y output CONFIG_MTD=y CONFIG_MTD_DEBUG=y CONFIG_MTD_PARTITIONS=y CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y CONFIG_MTD_MAP_BANK_WIDTH_1=y CONFIG_MTD_MAP_BANK_WIDTH_2=y CONFIG_MTD_MAP_BANK_WIDTH_4=y CONFIG_MTD_CFI_I1=y CONFIG_MTD_CFI_I2=y CONFIG_MTD_MCS8142_SPI_FLASH=y E...

Kernel Programming Five Things to Keep in Mind before you start

Things to keep in mind for kernel programming If you want to hack Linux kernel and do some programs, before you start keep some points in mind First and very basic point to make you feel relax with linux kernel , as, kernel is nothing but a program as like other programs, which includes memory management, process scheduling, system management and all you need to work in. 1. In kernel space you do not have leisure of GLIBc library, ie you can not use printf also you have printk in kernel space. 2. Limited stack - you have limited stack space in kernel so do not make unnecessary variables declared, as tomorrow you may be going to add some new features. In user space you have almost unlimited stack so you will be little worried about how many variables you are using. 3. In kernel space no memory protection is there, as in user space if some memory corruption occurs kernel will trap and send signal. In kernel space there is no-one to trap memory corruption, it is like you are directly ...

Good Linux PDF Books Links Collection

I was busy doing testing, so could not get time on exploring things around, now will be regular here, Got one more good link collection which contains the linux related documents http://www.pdf-search-engine.com/understanding-linux-kernel-pdf.html One more link I like is Its collection of Free Computer Books Free online Books site buy online books free,This site contain free online books on computer science and software engineering. Books on C C++ Java web programming, Languages. Do you know that you can change the color of you command prompt in windows, well how to get command prompt? its easy, click on start button on you windows and in run menu type cmd, hit enter, you are in DOS command prompt. To change the color just type "color f2" as one example you can try out more combination. Keep updating.