Showing posts from January, 2012

Linux - VPN with vpnc

If you want to set up a VPN client that connect to a CISCO vpn server. The following may help you.

As I had tested, vpnc is compatible to connect to a CISCO vpn server. This is guide is assumed that the Linux machine is a CentOS text based linux client.

Installing vpnc

1. You need RPMForge repository. See Add RPMForge for CentOS for guide
2. After adding RPMForge. Type

yum install vpnc
3. After successful installation, test your install with

and you should see the application request for the following

Enter IPSec gateway address: 
4. Ctrl-X to terminate the program. You have successfully installed vpnc
Configuration and Usage
1. Go to vpnc folder
cd /etc/vpnc
2. You should see 2 files
vpnc.conf - sample configuration file
vpnc-script - a script that vpnc required to run
3. Set execution permission to vpnc-script
chmod +x vpnc-script
4. Set up a configuration file. The configuration file is best to store at /etc/vpnc  Below is a sample configuration content named my-vpnc.conf
### …

Adding RPMForge to CentOS

Base on the link, you will get enough information to add RPMForge to CentOS machine.

For me, I have some trouble on this as my Linux machine is text based only

1. My VM cannot use RPM to download the those listed RPM file directly.
2. RPM parse PM-GPG-KEY.dag.txt with error.
3. My Window machine cannot download those list RPM as well (I really have no idea why???)

If you encounter the above issue, this small tips may help. And, it is so naive....

Use wget!!

1. wget
2. rpm --import RPM-GPG-KEY.dag.txt  3. wget 4.  rpm -i rpmforge-release-0.5.2-2.el4.rf.i386.rpm or rpm -Uhv rpmforge-release-0.5.2-2.el4.rf.i386.rpm 
That all. You can test your yum by yum install vpnc

Perl - Debugging

Finally, I have to debug a perl script. These are some of the helpful command. I am assuming the perl debugger version 1.27

1. Debugging - Adding -dwill trigger a debug mode on your perl script

perl -d

 Stepping - Type s in debug console will let you step through your code line by line

Break Point - Type b (line number) in debug console will let you set a break point

b 100

Print variable - Type p (variable) in debug console will display your variable value

p $varname

Continue - Type c in debug console will bring you to the next break point

Delete a Break Point - Type B (line number) in debug console to remove a break point

B 100

List all break point/action - Type L in debug console to list all breakpoint and action

Watch - Type w (variable) in debug console to set a watch to the variable. Changes will appear on the debug console if your watch variable is altered

w $varname

Delete a Watch - Type W (variable) in debug console to delete a watch point W $varnameHelp - Type h in debug …

Linux Command - iptables

Finally, get irritated on iptables as it keeps blocking my web server. Done some searching online and the follow helped me to unblock my port and also redirect my port internally. I am working on CentOS 5.6

1. Type the following, to open the iptables configuration file

vi /etc/sysconfig/iptables
2. Look for :RH-Firewall-1-INPUT - [0:0] and add the following before any REJECT rule. Reject rule are generally the last line of the configure file before COMMIT

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

3. Save the configuration file and type

service iptables restart
4. If you type "iptables -L", you should see a entry like below. You can verify your rule by accessing your webserver via port 80

ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 
5. Now, for local redirection. You cannot add the command to the above iptables configuration file. You must type the following at run time. The following will forward p…