socat

Server side socat tcp4-listen:5353,reuseaddr,fork UDP:nameserver:53

Client side: socat -T15 udp4-recvfrom:53,reuseaddr,fork tcp:localhost:5353

http://zarb.org/~gc/html/udp-in-ssh-tunneling.html

ssh tunneling

ssh -f user@personal-server.com -L 2000:personal-server.com:25 -N

The -f tells ssh to go into the background just before it executes the command. This is followed by the username and server you are logging into. The -L 2000:personal-server.com:25 is in the form of -L local-port:host:remote-port. Finally the -N instructs OpenSSH to not execute a command on the remote system

This essentially forwards the local port 2000 to port 25 on personal-server.com over, with nice benefit of being encrypted. I then simply point my E-mail client to use localhost:2000 as the SMTP server and we’re off to the races.

Route https request to vpn

iptables -A PREROUTING -i eth0 -t mangle -p tcp –dport 443 -j MARK –set-mark 1
echo 201 https >> /etc/iproute2/rt_tables
ip rule add fwmark 1 table https
ip route add default dev tun0 table https
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

Bundle Install Problem (sqlite3-1.3.4)

Installing sqlite3 (1.3.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb

Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/sqlite3-1.3.4 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.4), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v ‘1.3.4’` succeeds before bundling.

Solution: gem install sqlite3 -v ‘1.3.4’

mysql database backup

backup: mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

Restore is as follows:

# mysql -u root -ptmppassword 
mysql> create database sugarcrm;
Query OK, 1 row affected (0.02 sec)

# mysql -u root -ptmppassword sugarcrm < /tmp/sugarcrm.sql

# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

Reference: http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/