echo "1" > /proc/sys/net/ipv6/conf/all/forwarding
or
sysctl net.ipv6.conf.all.forwarding=1
2011年5月18日
IPv6 forwarding seems to be disabled, exiting
2011年5月6日
IPv6 relevance commands
# /sbin/ip -6 addr add $ipv6address/$prefixlength dev $interface
# /sbin/ifconfig $interface inet6 add $ipv6address/$prefixlength
# /sbin/ip -6 route show [dev $device]
# /sbin/ip -6 route add $ipv6network/$prefixlength via $ipv6address [dev $device]
# /sbin/ip -6 route del $ipv6network/$prefixlength via $ipv6address [dev $device]
# /sbin/ip -6 route add 2000::/3 dev eth0 metric 1
# /sbin/ip -6 neigh show
# /sbin/ip neighbor
2011年3月21日
Hack svnmailer: Subject with "Log"
Change commit email subject to be the first line of change log.
Fedora 14
svnmailer-1.0.8
1. vi /usr/lib/python2.7/site-packages/svnmailer/notifier/_mail.py
2. Add the following blue line at L:334.
subject = dosubject('files')
if len(subject) > short_length:
subject = dosubject('dirs')
subject = "%s %s" % (subject, self.getLog())
# reduce to the max ...
if max_length and len(subject) > max_length:
subject = "%s..." % subject[:max_length - 3]
2010年9月24日
Improve DDOS, TIME_WAIT and CLOSE_WAIT issue
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_timestamps=0
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_keepalive_intvl=15
net.ipv4.tcp_keepalive_probes=5
net.ipv4.tcp_synack_retries=3
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_max_syn_backlog=2048
net.ipv4.ip_local_port_range=5000 65000
Query status:
netstat -nat|awk '{print awk $NF}'|sort|uniq -c|sort -n
2010年5月25日
Windows XP hangs at loading agp440.sys!?
1. Remove all USB devices except of mouse and keyboards, you can disable USB ports from BIOS as well. (Or yank out USB device when the boot is stopping at loading agp440.sys!?)
2. Trying to boot into Safe Mode.
3. Execute "chkdsk /R" and then reboot.
4. Windows will do disk check and recovery your system.
5. Done.
Reference: http://marc-bourassa.com/2005/04/24/agp440sys-and-dead-xp-system
Or
In my case, everything works fine after I remove CD-ROM drive.
2010年4月1日
SVN access rule
[groups]
sdk-developer = man1
sdk2-developer = man2
everyone = man1, man2, man3, man4
[MyRepo:/private]
@everyone = r
[MyRepo:/private/sdk]
@sdk-developer = rw
@sdk2-developer = r
@everyone =
Note: man3 and man4 can't access /private/sdk due to the limitation of last rule "@everyone =".
If the last rule is missed, for people not included in the list will use the rule which inherited from parent directory, then they will have "r" permission and be able to access /private/sdk.
2009年12月3日
Useful SVN commands
# Create new SVN repository
#> svnadmin create /svn/FOO
# Import new project FOO
#> svn import --no-ignore MyFOO svn://foo.domain.com/FOO/MyFOO -m "My First Project."
# Checkout FOO
#> svn co svn://foo.domain.com/FOO/MyFOO
# Add
#> svn add myfoo.c
#> svn commit myfoo.c -m "My Foo file."
# Delete
#> svn del myfoo.c
#> svn commit myfoo.c -m "Remove Foo file."
# Add tag
#> svn copy http://foo.domain.com/FOO/trunk http://foo.domain.com/FOO/tags/FOO-r1 -m "${LOGS}"
# Add branch
#> svn copy http://foo.domain.com/FOO/trunk http://foo.domain.com/FOO/branches/FOO-b1 -m "${LOGS}"
#> svn switch http://foo.domain.com/FOO/branches/FOO-b1
# Modify file permission
#> svn propset svn:executable "*" ${FILENAME}
2009年12月2日
Use external SMTP server on Mantis bugtracker
[mantis]# cat config_inc.php
# --- email variables -------------
$g_smtp_host = 'smtp.domain.com';
$g_smtp_username = 'user_id';
$g_smtp_password = 'user_password';
$g_use_phpMailer = 'ON';
# We do not use sendmail.
$g_phpMailer_method = '2';
?>
[mantis]#
2009年12月1日
God damn issue on Bugzilla installation!
[error] [client 192.168.99.11] (13)Permission denied: exec of /var/www/html/bugzilla/index.cgi failed
[error] [client 192.168.99.11] Premature end of script headers: index.cgi
Solution:
#> vi /etc/sysconfig/selinux
Set SELINUX=disabled, then reboot the system.
2009年5月24日
New AntiVir software will freeze Windows UI?
After upgrading to new Avira AntiVir, my WindowsXP sometimes stop responding requests and only mouse cursor is still alive, and all applications can't be launched and the machine is not able to be shutdown either.
In my case, restarting explorer.exe can solve this abnormal issue:
1. Press [Ctrl] + [Alt] + [Del], launch [Task Manager].
2. Find "explorer.exe" process and terminate it.
3. From [File] menu of [Task Manager], choose [New Task]...
4. Run explorer.exe again.
2009年3月17日
Install VMwareTools in Fedora 10
Issue: Cannot use share-folder after VMWareTools installed in Fedora 10.
After googling, found a solution from internet. With the following steps, the share-folder issue has been fixed. (My machine is WinXP-SP2 with v6.0.0 build-45731 VMware installed.)
1. Download open-vm-tools source from
"http://sourceforge.net/project/showfiles.php?group_id=204462&package_id=244023".
2. Do the compilation
# tar zxvf open-vm-tools-2009.02.18-148847.tar.gz
# cd open-vm-tools-2009.02.18-148847
# ./configure --disable-unity --without-gtkmm --without-dnet --without-icu
// Need --disable-unity --without-gtkmm --without-dnet --without-icu on my machine.
# make
3. Create needed tar files for VMwareTools.
# cd open-vm-tools-2009.02.18-148847/modules/linux
# for i in *; do mv ${i} ${i}-only; tar -cf ${i}.tar ${i}-only; done
// vmblock.tar, vmci.tar, vmhgfs.tar, vmmemctl.tar, vmsync.tar and vmxnet.tar will be created.
3. Untar VMwareTools-6.0.0-45731.tar.gz, the source is from VMware software itself.
4. Copy all tar files created by open-vm-tools to vmware-tools-distrib/lib/modules/source.
5. Run VMwareTools installation
# cd vmware-tools-distrib
# ./vmware-install.pl
6. Besides, "RgbPath" is not a valid keyword in /etc/X11/xorg.conf, "startx" cannot be activated due to the error. Please comment it from L:13 of /etc/X11/xorg.conf.
Reference:
http://diamondsw.dyndns.org/Home/Et_Cetera/Entries/2008/4/25_Linux_2.6.24_and_VMWare.html
2005年11月9日
Install Ser SIP server
Files needed:
ser-0.9.4_src.tar.gz
mysqld/mysqladmin
phpMyAdmin-2.6.4-pl3.tar.bz2
1. Compilation
# tar zxvf ser-0.9.4_src.tar.gz
# cd ser-0.9.4
# make
# make modules
# make install
// The default installed path is /usr/local/sbin.
// The configuration file will be placed under /usr/local/etc/ser.
# cp ser-0.9.4/rpm/ser.ini /etc/init.d/ser
# chkconfig ser reset
# chkconfig ser on
# service ser start
3. Activate and Configure MySQL
# chkconfig mysqld on
# service mysqld start
// Setup password for MySQL. (root/root)
# mysqladmin –u root password root
//Setup Ser database in MySQL:
# /usr/sbin/ser_mysql.sh create
4. Install phpMyAdmin to manage MySQL:
# tar jxvf phpMyAdmin-2.6.4-pl3.tar.bz2
# vi /etc/httpd/conf/httpd.conf
// Alias /php /home/phpMyAdmin-2.6.4-pl3
// Run http://IP-Address/php and use phpMyAdmin to modify permission and password of Ser service.
5. Add SIP users
# export SIP_DOMAIN=”porter10.mydomain.intra” serctl add
# /usr/local/sbin/serctl add 230 230 230@192.168.1.1
# /usr/local/sbin/serctl add 232 232 232@192.168.1.1
2005年4月28日
Useful configurations in Apache
1. Being able to display Chinese characters
# vi /etc/httpd/conf/httpd.conf
// Modify [AddDefaultCharset ISO-8895-1] to [AddDefaultCharset null], let browser to decide which character encoding to use.
// or to [AddDefaultCharset big5], only for Chinese Big-5.
2. Prohibit to list/browse directory
# vi /etc/httpd/conf/httpd.conf
// Find
2004年10月8日
Reminders in MySQL
1. Fix Chinese issue in MySQL
# vi /etc/my.cnf
// [myqld]
// default-character-set = big5
// [client]
// default-character-set = big5
2. Note port number while using mysql_real_connect()
// mysql_real_connect(&mysql, DB_IP, DB_USER, DB_PW, DB_NAME, DB_PORT, NULL, 0)
// DB_PORT=3306
3. To get the last day of every month
// (To_DAYS(DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH),\'%%Y-%%m-01\'))-TO_DAYS(DATE_FORMAT(CURDATE(),\'%%Y-%%m-01\')))
4. When configuring permission, the HOST field could be left as blank to prevent database connection failure.
2004年1月27日
Simple Router/NAT Settings
1. If there is no DHCP service, configure WAN/LAN IP manually.
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
ifconfig eth1 10.0.0.100 netmask 255.255.255.0 broadcast 10.0.0.255
2.Add routing rule if needed.
route add –net 192.168.1.0 netmask 255.255.255.0 dev eth0
route add –net 10.0.0.0 netmask 255.255.255.0 dev eth1
3. Add a default gateway IP.
route add default gw 10.0.0.1
4. Enable forwarding.
echo "1" > /proc/sys/net/ipv4/ip_forward
5. Set a simple NAT rule thru iptables tool. eth1 is output interface.
iptables –t nat –A POSTROUTING –o eth1 –s 192.168.1.0/24 –j MASQUERADE
6. Add DNS servers.
echo "168.95.1.1" > /etc/resolv.conf