NAT dns failed of VirtualBox 4.1 on Ubuntu 12

After upgrade to Ubuntu 12.10, the NAT settings failed of VirtualBox VMs. Resources from Internet shown that it caused by Ubuntu changes the way the resolv.conf works. However in my desktop, it ONLY happened since this upgrading. From this reference, they said the local dns resolver switch to rather the old one,

There are much more feasible solutions on the Net: install dnsmasq, alter the interface settings of Ubuntu, etc. In my opinion, the problem only affected to VirtualBox and it is patched in the next release (4.2) that I use the simplest way: change per VM settings if it need of which is not shown in GUI settings. Steps are simple:

  1. Shutdown the VM you want to alter
  2. Open terminal and use the following command to enable resolver
    VBoxManage modifyvm "{the vm's name}" --natdnshostresolver1 on

. This command will alter the vbox’s XML settings and it works fine. Enjoy it. 🙂

MySQL exception of DATETIME value in JSP

There is a column type DATETIME and default value as “0000-00-00 00:00:00″ in MySQL. When Using JSP with JDBC query and get result via getString, there arise an error:

java.sql.SQLException: Value ’0000-00-00 ‘ can not be represented as java.sql.Timestamp

As far as I see, this is a new feature of JDBC since version 3.1. However I did not encounter (or I ignore) it for a long time.

The value of MySQL is not valid in JAVA and the solution is to add a parameter in connection. Reference is here: Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J

That is, add zeroDateTimeBehavior=convertToNull into JDBC connection. and it works. 🙂

Authentication with lighttpd on CentOS

To enable authentication in lighttpd is easy. We can follow this reference to set up a functional environment: Module mod_auth – Using Authentication. However, it is a tragedy in my new CentOS 6 box with lighttpd 1.4.31, due to the separated configuration files.

After I enable mod_auth in modules.conf, set up my authentication functions in conf.d/auth.conf and restart the service, the function seems no work. The issue is on a lost include command in main configuration file – lighttpd.conf, then configuration will not be loaded.

The solution is adding include "conf.d/auth.conf" into lighttpd.conf and everything works fine. What a stupid problem. Enjoy it. 🙂

Server migrate in recent days

This host will migrate to another server of my VPS provider. We may disconnect in few days.

20121029 Edit:

There are some trouble in my previous VPS provider, the hostitek, that I lost much more data since 20120822. Although the data had been sync to a dropbox account that I still lost data since 20120822. However, thanks to hostigation, a new VPS provider for this site, services will back sooner.

Use droid font as default on Ubuntu 12.04

This post is an extension from Use Droid font on ubuntu linux. In Ubuntu 12.04, the font config for zh-tw modified. In order to make the whole system with ttf-droid, we need to comment out the sections of font binding:

  1. Bind AR PL UMing with DejaVu Serif
  2. Bind WenQuanYi Micro Hei with DejaVu Sans
  3. Bind WenQuanYi Micro Hei Mono with DejaVu Sans Mono

Then restart your session, all font settings are the same. Enjoy it. 🙂

GNOME Shell on Ubuntu 12.04

An updated instruction from Replace Unity with gnome-shell on Ubuntu 11.10. In Ubuntu 12.04, there are better support for Unity and GNOME Shell coexists.

1. Install gnome-shell related packages:

$ sudo apt-get install gnome-shell \
gnome-themes-standard \
gnome-sushi \
gnome-contacts \

2. Disable strange overlay-scrollbar

$ export 'export LIBOVERLAY_SCROLLBAR=0' \
> ~/.xprofile

3. Use native notification of GNOME

$ sudo apt-get install notification-daemon

However, we should check the support of DBus to prevent other issues. Just check if there is ONLY contain notify-osd in the notification service file.

# vim /usr/share/dbus-1/services/org.freedesktop.Notifications.service

If the exec parameter in you file only contains notify-osd, such as: Exec=/usr/lib/…/notify-osd, you should alter it as Exec=/usr/lib/notification-daemon/notification-daemon.

4. Restart Ubuntu and change login session with GNOME. Then enjoy it. 🙂

IPv6 and Internet Connection Sharing on Windows

I move house and apply for installation of Cable Modem network recently. For network topology needed in home, I chosen to use Internet Connection Sharing (ICS) on Windows XP. When using the default settings of ICS, DHCP server and DNS cache server are enabled. The default IP setting of ICS server is and the DHCP range is within and

Install IPv6 support and 6to4 relay

For the feature of IPv6, in Windows XP (above SP2), we can install the driver with

C:\>ipv6 install


There are modules for IPv6 tunneling such as Teredo, 6to4 and isatap. If there are native IPv6 support, the modules are disabled by default. If there is no native IPv6 but the PC has a public IPv4 address, the 6to4 tunnel will be enabled by default.

My Windows XP ICS server is Teredo tunnel disabled and 6to4 tunnel enabled but the default 6to4 relay routing function is broken. I can obtain its v6 address as gateway but failed to transfer the request. According to my test, the ONLY ONE workable 6to4 relay is We can use

C:\>netsh interface ipv6 6to4 set relay enable

to enable a new relay for 6to4 tunnel.

Make the Teredo tunnel work with ICS

To enable the Teredo service, using the netsh command with

C:\>netsh interface ipv6 set teredo client

. There will be a IPv6 address prefixed by 2001: and a gateway :: shown with the ipconfig command. The tragedy is, with ICS enabled, the Teredo will be at the position of host-specific relay and cannot obtain an IPv6 address. I have no idea if this scenario is caused by modules conflicts or pre-defined policy rules by Windows. The way to make Teredo work is to disable 6to4 relay with

C:\>netsh interface ipv6 6to4 set state disabled

. IP address obtained for a short time after this command.


Although without 6to4 tunneling, there are no IPv6 address for ICS members provided by ICS DHCP server, the network is more stable. By the way, the Facebook App malfunctioned within ICS plus broken 6to4 tunnel environment.

On the other hand, if you want to make the isatap work, try this command:

C:\>netsh interface ipv6 isatap set router
C:\>netsh interface ipv6 isatap set state enabled

where the tunnel router is provided by 上海交通大学.

Enjoy it. 🙂