Ubuntu-gutsy/hardy-Ethernet (nVidia MCP55 forcedeth) not working

This is a know issue in Ubuntu Linux ( gutsy , hardy ) with nVidia MCP55 Ethernet card.  This  card uses forecedeth module. forecedeth module  is loaded, network card seem to be up and running however it can not ping outside the box. Here is a quick fix for this problem, as a root [...]

Bash Script to create automatic FTP session and download file

This script automatically opens a FTP session and downloads file to local disk. Here is the scenario:
ftp: myftp.ext
username: myusername
password: mypassword
file to download: myfile.txt
1) Create bash script automatic_ftp_download.sh:
#!/bin/bash
# Script to create automatic FTP session and download file
ftp -n myftp.ext << end
us myusername mypassword
get myfile.txt
bye
end
2) make automatic_ftp_download.sh script executable:
chmod +x automatic_ftp_download.sh
3) run automatic_ftp_download.sh scrip:
./automatic_ftp_download.sh
4) find myfile.txt [...]

TCP port forwarding with linux iptables NAT, PREROUTING and DNAT example

Lets say that we would like to do port forwarding from our network interface eth0 on port 23  (telnet) to socket 10.0.0.1:23 (ip address:port):
iptables -t nat -I PREROUTING -p tcp -i eth0 –dport 111 -j DNAT –to 10.0.0.1:23
other example:
to do port forward from eth0 on port 456 to 192.168.0.1:788
iptables -t nat -I PREROUTING -p tcp [...]

Configure NAT (network address translation)with linux iptables command

Sharing internet connection with NAT (network address translation) can be easy as running commands:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
where ppp0 is your external interface.

Drop all outgoing traffic with linux iptables to destination port 80 / http / www

To block all outgoing traffic to the port 80 ( http, www, html ) use command:
iptables -A OUTPUT -p tcp –dport 80 -j DROP
To remove all iptables rules use command:
iptables -F
Sometimes you need to DROP all port 80 ( http, www, html ) traffic except certain IP address. In this case you ca run:
iptables -A [...]

Installing vmware and setup package dependancies on Fedora

1. Download vmware package (.rpm)
2. Install using rpm package manager
rpm -Uvh VMware-xxxxx.rpm (xxxxx = installation file)
3. Run config program
vmware-config.pl
- problems during configuration:
a.) None of the pre-built vmmon modules for VMware Workstation is suitable for your running kernel. Do you want this program to [...]

Set / configure DNS client with resolv.conf

DNS client (resolver) configuration file: /etc/resolv.conf
To configure your dns client setting, open /etc/resolve.conf and add entries as follow:
search mysite.com -> (this entry is optional – add this only when you host your own local domain)
nameserver 192.168.1.1 -> [...]

Configure Multiple Virtual IP Addresses on linux

Creating virtual IP address is very easy task. All we need is root access to the ifconfig command. This commands will create virtual ip addresses on eth0-> eth0:0 and eth0:1 network interface:
ifconfig eth0:1 192.168.148.143
ifconfig eth0:2 192.168.148.144

Disable ssh root access – Debian / Ubuntu

Open /etc/ssh/sshd_config if find entry similar to this:
PermitRootLogin yes
and change it to:
PermitRootLogin no
then restart your sshd service with:
/etc/init.d/ssh restart

Mount command to mount Samba or Windows share on linux

First make sure that you have support for smbfs by installing smbfs package then  issue command:
mount -t smbfs -o username=your-username,password=your-password //samba-windows-share-server/shared-folder /your/mount/point
To List shares on windows machine or samba server:
smbclient -L samba-windows-share-server