2010年9月2日 星期四

openvpn client install

1.install openvpn gui client on windows
2.copy ca.crt client1.crt client1.key from server to C:\Program Files (x86)\OpenVPN\config(64 bit or 32bit)
3.modify openvpn1.ovpn
add content as below
================================================================
client
dev tun
proto udp
remote-cert-tls server
remote 210.200.200.200 1195
resolv-retry infinite
nobind
persist-key
persist-tun
ca C:\\Program\ Files\ (x86)\\OpenVPN\\config\\ca.crt
cert C:\\Program\ Files\ (x86)\\OpenVPN\\config\\client1.crt
key C:\\Program\ Files\ (x86)\\OpenVPN\\config\\client1.key
tls-auth C:\\Program\ Files\ (x86)\\OpenVPN\\config\\ta.key 1
tls-client
comp-lzo
verb 3
==============================================================

2010年9月1日 星期三

openvpn server installion

#apt-get update
#apt-get upgrade
update and upgrade package

#apt-get install openvpn
install openvpn package

#cd /etc/openvpn
#mkdir /etc/openvpn/easy-rsa/
#cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/
copy sample file to /etc/openvpn folder

#edit /etc/openvpn/easy-rsa/vars
edit some vars for generate cert and key use
export KEY_COUNTRY="TW"
export KEY_PROVINCE="TW"
export KEY_CITY="TAIPEI"
export KEY_ORG="Cloud Service"
export KEY_EMAIL="tommy@csp.com"


#cd /etc/openvpn/easy-rsa/2.0
#source ./vars
#./clean-all
#./build-ca
#./build-key-server server
#./build-key client1
#./build-dh
create server certificate and client keys

#cd .../../
#mkdir cert
#cd cert
#mv ca.crt ca.key server.crt server.key dh1024.pem /etc/openvpn/cert/
move the keys that server needs

#cd ..
#vim server.conf
modify server.conf and add below content to it
=====================================================================
port 1195
proto udp
dev tun0

ca /etc/openvpn/cert/ca.crt
cert /etc/openvpn/cert/server.crt
key /etc/openvpn/cert/server.key # This file should be kept secret
dh /etc/openvpn/cert/dh1024.pem
;tls-auth /etc/openvpn/cert/ta.key 0 # This file is secret

server 172.16.0.192 255.255.255.192
ifconfig-pool-persist ipp.txt
push "route 10.0.0.0 255.0.0.0"
push "route 192.168.0.0 255.255.0.0"
push "dhcp-option DNS x.x.x.x"
push "dhcp-option DNS x.x.x.x"
push "dhcp-option WINS x.x.x.x"
push "dhcp-option WINS x.x.x.x"
push "dhcp-option DOMAIN csp.com.tw"

keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
log openvpn.log
log-append openvpn.log

#vim /etc/network/interfaces
add wanip for vpn client connect use
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 172.16.0.10
netmask 255.255.255.0
up /etc/network/route up
down /etc/network/route down

auto eth1
iface eth1 inet static
address 210.200.200.200
netmask 255.255.255.128
gateway 210.200.200.1

#vim /etc/network/route
add eth0 routing table
#!/bin/sh

PATH=/sbin:/bin:/usr/bin:/usr/sbin
case $1 in
up)
route add 172.16.0.0 netmask 255.255.0.0 gw 172.16.0.1
route add 10.0.0.0 netmask 255.0.0.0 gw 172.16.0.1
;;
down)
route del 172.16.0.0 netmask 255.255.0.0. gw 172.16.0.1
route del 10.0.0.0 netmask 255.0.0.0 gw 172.16.0.1
;;
esac

#vim /etc/sysctl.conf
uncomment the line below
#net.ipv4.ip_forward=1 to net.ipv4_forward=1

#permit all traffice from vpn interface
iptables -t nat -A POSTROUTING -s 172.16.0.192/26 -o eth0 -j MASQUERADE

#/etc/init.d/openvpn start
start openvpn service

2010年7月21日 星期三

how to install c compiler

#sudo apt-get install build-essential

show gcc version
#gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2010年7月19日 星期一

how to check ubunut version

#cat /etc/issue
Ubuntu 10.04 LTS \n \l

#cat /proc/version
Linux version 2.6.32-21-generic (buildd@rothera) (gcc version 4.4.3 (Ubuntu 4.4. 3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010

#uname -a
Linux ubuntu 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux

#cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"


#lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 10.04 LTS
Release: 10.04
Codename: lucid

#file /usr/bin/file

2009年10月25日 星期日

rsync over ssh

1.confirm ssh service on remote system
#ssh tommy@192.168.100.196

2.use -e command to run rsync
#rsync -avz --stats --progress -e ssh tommy@192.168.100.196:/backup/ /backup

2009年7月19日 星期日

how to remove trash file with command line

1.remove trash file
#sudo rm -rf ~/.local/share/Trash

2.when logout to clean trash file
#sudo vim ~/.bashrc
add new lins to run command
sync; sync; sync
rm -rf ~/.local/share/Trash

2009年7月18日 星期六

how to install firefox3.5

1.modify apt-get repository
add two lines as below
deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main

2.import PPA GPG key
#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE

3.run command to install firefox35 or firefox36
sudo apt-get update && sudo apt-get install firefox-3.5