LINTEK = Life Is Naturally TE(K)hnical VoIP, Gadgets, Linux, Telecommunications & Technology BLOG!
Browsing all posts in: Tech Tips

Use IFTOP to display hosts’ bandwidth usage on the network

April 24

If the top command shows the processes currently taking the most CPU time and memory, iftop displays network usage by connection making your hosts’ bandwidth moitoring usage easier.  Iftop displays a table of hosts and their bandwidth usage for the past 2, 10 and 40 seconds. Identifying which hosts are causing network congestion is easy using iftop since it displays the pair of hosts responsible for most of the bandwidth on the top of the table.

iftop overview:

  • iftop (interface top) derives the name from the standard unix top command. top command displays real-time CPU Usage. iftop command displays real-time network bandwidth usage.
  • iftop displays the network usage of a specific interface on the host.
  • Using iftop you can identify which host is responsible for slowing down your network.
  • To find out which process is causing the problem, note down the port number from the iftop and use netstat -p to identify the process.
  • iftop monitors your network activity, and displays a table of current bandwidth.

Download iftop

# cd /root
# wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz

Install iftop

# cd /root
# tar -xzvf iftop-0.17.tar.gz
# cd iftop-0.17
# ./configure
# make
# make install

Use iftop

#iftop

iftop commands

S - display source port
D - display destination port
n - show IP instead of host name
1/2/3 - sort by the specified column
< - sort by source name
> - sort by dest name
P - pause display
j/k - scroll display
? - for help

Popularity: 1% [?]

Backup Directories Recursively and Preserve File Structure

April 18

Okay, there are many ways to backup your files in Linux and preserve the permissions and structure. But what is the fastest way to create one? The one line linux command below creates a backup of a directory recursively and preserve the file structure:

root@host# tar -pcvzf mytarball.tar.gz myfiles

WHERE: mytarball.tar.gz is the filename of the compressed backup file and myfiles is the directory you want to back  up.

Popularity: 1% [?]

Increase Samba Server’s performance

April 17

There are numbers of socket options in smb.conf that can be tuned to enhance/optimize the performance of a Samba  server.  Socket options are configurable controls on the networking layer of an operating systems that allow the connection to be tuned.

The single configuration line below when added to the global section of your smb.conf  can give you up to 200% throughput increase compared to the smb.conf’s default settings.

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536

TCP_NODELAY tells the samba server to send as many packets as necessary to keep delay low. Setting this option can increase the speed up to 30 to 50% and in Samba 2.0.4, socket options = TCP_NODELAY became the default value for that option.

SO_SNDBUF and SO_RCVBUF The send and receive buffers can often be the reset to a value higher than that of the operating system. This yields a marginal increase of speed until it reaches a point of diminishing returns. A modern Linux Systems serving Samba shares to Windows systems, setting the  SO_SNDBUF and SO_RCVBUF to 65536 can give you an additional 20% throughput.

IPTOS_LOWDELAY is an option that trades off throughput for lower delay, but which affects routers and other systems, not the server. All the IPTOS options are new; they’re not supported by all operating systems and routers. If they are supported, set IPTOS_LOWDELAY whenever you set TCP_NODELAY. If supported, this setting accounts for another 20% speed increase.

SO_KEEPALIVE initiates a periodic check every four hours to see if the client has closed connection or not. This setting will close dead connections and return unused memory and process-table entries back to the operating system.

Popularity: unranked [?]

TIP: Upload .SQL file to MySQL

September 15

One of my staff asked me on how to upload a 345MB SQL dump file he extracted from one of our DB servers to another server. He told me that he is having a problem doing this task using PhpMyAdmin because of the 2MB limitation found PhpMyAdmin’s import screen.

I know that the procedure below is very basic to others but still, allow me to give you the easiest way on how to upload an SQL dump file to another server:

  1. Upload the .SQL dump file to your target MySQL server via FTP or SFTP.
  2. Type the command below:
    mysql --user=username --password=password DB_name < dumpfile.sql
  3. Congratulations!

NOTES:

  1. The command used above will upload the table(s) and records inside dumpfile.sql to an existing database named DB_name.If the “CREATE TABLE” portion in the dumpfile.sql is present then it will create the table(s) inside DB_name, provided that the table(s) is (are) not yet in the DB_name.
  2. If the table(s) is (are) already in the DB_name and you just want to insert records inside the table(s), you need to remove the “CREATE TABLE” portion inside the dumpfile.sql. Just make sure that the fields of the existing table are the same with the fields in the dumpfile.sql you want uploaded.

Popularity: 2% [?]

SAMBA Installation HOWTO

July 29

Samba is a free software re-implementation of SMB/CIFS networking protocol, originally developed by Australian Andrew Tridgell. Samba is released under the GNU General Public License. The name Samba comes from SMB (Server Message Block), the name of the standard protocol used by the Microsoft Windows network file system.

I am posting some basic steps below on how to implement a simple samba server using slackware linux with IP address 192.168.0.5 for linux newbies out there:

STEP 1: Download and unpack the Samba source codes

#cd /usr/local/
#wget_http://mirrors.dotsrc.org/samba/samba-3.2.0.tar.gz
#tar -xzvf samba-3.2.0.tar.gz

STEP 2: Compile and install Samba

#cd samba-3.2.0/source
#./configure
#make
#make install

STEP 3: Configure Samba

#cd /etc/samba
#pico smb.conf (or use your favorite text editor like vim)

Copy and paste the sample config below:

[global]
workgroup = lintekfileserver
server string = akalainmonglinuxto
security = user
log file = /var/log/samba.%m
load printers = yes
max log size = 100
socket options = TCP_NODELAY

[home]
comment = Home Directory
path = /home/lintek/
valid users = lintek
writable = yes

STEP 4: Add a samba user and set the password

Make user you have an existing linux user named lintek (based on the configuration above), if you don’t have then you can use the command below:

#adduser lintek

NOTE: Make sure that lintek user’s home directory is /home/lintek

#smbpasswd -a lintek
New SMB Password:
Retype new SMB Password:

STEP 5: Start the server

#chmod 755 /etc/rc.d/rc.samba
#/etc/rc.d/rc.samba start
Starting Samba: /usr/sbin/smbd -D
/usr/sbin/nmbd -D

STEP 5: Mount SMB share from another Linux Machine

#mount -t smbfs -o username=lintek,password=lintektalaga //192.168.0.5/lintek /mnt/lintek

CONGRATULATIONS! You have successfully created a very simple samba server.

Popularity: 1% [?]

Delete pagefile.sys when Windows shuts down

July 22

The pagefile.sys file is the Virtual Memory file used by your Windows computer. If you have limited RAM, your windows machine to run programs and store data. It swaps out some of the RAM data to the page file and then reuses the freed up RAM.

You can improve the security of a computer running Windows if you delete pagefile.sys everytime you shut down your Windows machine.

How to do this?

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

Add the following registry keys:

Value Name: ClearPageFileAtShutdown
Value Type: REG_DWORD
Value: 1

You need to restart your computer for the changes to take effect.

Popularity: 1% [?]

Arnel Reodica is currently working as a Senior Network and System Administrator, he has a wide experience in maintaining different telecommunication equipment, from legacy switches to VoIP equipment. He has also a wide experience in maintaining different types of LAN/WAN and telecommunication network equipment using different networking technologies. Aside from these, he is also an experienced computer programmer with more than 13 years experience using different programming languages.

Popularity: 1% [?]