Enable Port Forwarding in Windows 7

When working from home, I need to access the company network using a VPN software which works on Windows only.  However, all my tools are in Linux, thus working in Windows (dual-boot) or in a Windows virtual machine is very tedious and inefficient.

The solution is to create a Windows virtual machine.  Use it to run the VPN software.  Then, my linux OS will connect to the virtual machine and go into the office network via the VPN connection created by the virtual machine.  This is how to do it:

  1. Create a virtual machine with Windows 7 (I’m using Virtual-box).
  2. Create two network adapters for the virtual machine.  The first one uses NAT.  The second one uses Host-only Adapter.  To configure a Host-only Adapter, you will have to create a Host-only Network in the virtual-box (File > Preferences > Network > Host-only Network).
  3. Start up Windows 7 virtual machine.  Make sure VPN is working fine (can connect to the office network from within the Windows 7 virtual machine).
  4. Make sure the second adapter can be reached from the host Linux OS.  You can simply ping the IP address of the second adapter from the host Linux OS.  You will have to disabled the firewall in the Windows 7 virtual machine.

Now is the port forwarding.  Click the Windows start button and type cmd.  Right-click on the search result and choose Run as administrator.  In the command prompt, type the following command:

netsh interface portproxy add v4tov4 listenaddress=x.x.x.x listenport=xx connectaddress=x.x.x.x connectport=xx

My Windows 7 virtual machine has its 2nd network adapter configured with the IP address 192.168.56.101.  I would like to connect to my office server with IP address  10.1.69.83.  The office server is listening at port 22 (SSH).  My final command becomes:
netsh interface portproxy add v4tov4 listenaddress=192.168.56.101 listenport=22 connectaddress=10.1.69.83 connectport=22

The listenport=22 can be set to any other number as long as you specify it when connecting from your Linux OS to the Windows virtual machine like the following:

ssh -oPort=<listenport> user@192.168.56.101

The effect is like running the following command

ssh -oPort=<connectport> user@10.1.69.83

from the Windows 7 virtual machine.

To show all port forwarding configurations:

netsh interface portproxy show all

To clear all port forwarding settings:

netsh interface portproxy reset

If the forwarding does not work, you may want to clear all settings and re-add them.

More info here: http://woshub.com/port-forwarding-in-windows/

END.

Setup A Wifi Router using a Laptop Running Windows 7

In work, I need to connect to LAN using Windows OS (running some CISCO NAC software).  However, all developers are using Linux laptops.  Running virtual machines in Linux with Windows 7 OS, failed to connect to the LAN with the CISCO NAC software.  So I tried to set up a Windows 7 laptop which can connect to the LAN (with this CISCO NAC software), and turn the laptop wifi into hosted mode, so that all Linux laptop can connect to it and use the LAN interface to access the network.  Initially, I set up the ad-hoc network, but no machines (linux and windows) can connect to it.  Android cannot even see it.  Then I read about the the windows miniport setup, which is able to turn the laptop wifi into an access point with hosted mode instead of just an ad-hoc network.  This is great for it should work with all laptops as well as android phones.  This is how to do it:

Step 1: Press start and type cmd and right click on it click on “Run as Administrator”
Step 2: Type netsh wlan stop hostednetwork and press enter.
Step 3: Type netsh wlan set hostednetwork mode=allow ssid=NAME key=PASSWORD keyUsage=persistent and press enter.
Step 4: Type netsh wlan start hostednetwork and press enter.

That’s it!  You can now scan the network with laptop or android phones and connect to it.  To share the network, modify the properties of the LAN interface to allow internet sharing through the newly created miniport adapter.

Details explanation can be found here: http://forum.xda-developers.com/galaxy-s2/general/guide-alternate-to-ad-hoc-wi-fi-network-t1924911

In one of the setup, the network is created, devices are able to connect to the network but IP addresses cannot be obtained (stuck at obtaining IP addresses…).  To fix it, modify the miniport adapter properties by removing all ticks except the TCP/IPv4.  Then, repeat step 1 to step 4.

More posts here: http://superuser.com/questions/339448/windows-7-hosted-network and here: http://mintywhite.com/windows-7/set-windows-7-wifi-hotspot-quick-tip/

Sending Emails from Redhat to External Email Addresses

There is a need to send the cronjob output from a server to an external email address.  The server is not allow to connect to the internet, so a relay is required.  All emails will be forwarded to the SMTP server (acts as a relay) and then sent to the internet.  To do that in Redhat, edit the file /etc/postfix/main.cf.  Change the following:

relayhost=smtp.server.ip.address

Check for syntax error:

postfix check

List down all non-default configuration:

postconf -n

Restart the mail service:

service postfix restart

Done.

 

Sending Emails from Solaris to External Email Addresses

There are many cronjobs running on the servers I maintained.  Each cronjob creates output which needs to be sent to the external email addresses.  However, none of the cronjob mails were received by the external email accounts.  I guess the servers were not setup correctly.  I run the mail program from the terminal and got a bounced email with the following content:

The original message was received at Fri, 20 May 2016 12:02:03 +0800 (MYT)
from localhost [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<user@company.com>

   ----- Transcript of session follows -----
550 5.1.2 <user@compay.com>... Host unknown (Name server: mailhost.xxx.com: host not found)

The configured STMP server is mailhost.xxx.com but this host name is not valid.  I’m not sure how to modify the SMTP server configured, but I do know the IP address of the SMTP server.  So, I add the following line to the /etc/hosts file:

xxx.xxx.xxx.xxx    mailhost.xxx.com

Then, all emails can now be sent to external email accounts successfully.

九月二十六日

非常快乐的一天,我们的纪念日:)

第三场国标舞比赛

DSC_0106

昨天,我参加了第三场国标舞比赛。是在 Berjaya Time Square 的 Crystal Dance Sport Championship。和往年相比,这一届的参赛人数少得很。有说法是因为 Bersih 4.0 集会,人们担心会出事,所以没有参赛。我参加的国标舞 Beginner category,对手只有一个而且并不强,所以轻易的拿到了第一。Quickstep 出错也照拿第一,真是不好意思。

第二场国标舞比赛

DSC_0083

七月十九曰,我参加了第二场国标舞比赛。这一次共参加了 beginner waltz, tango 和 quickstep 三个项目。比赛地点是 KL 的精武体育馆。我早上八点左右抵达时,开始下起了雨,而且越下越大。可能下雨的关系, Shvonne 迟了,大约九点才到。不过还好,比赛推迟了半小时才开始,我们有点时间到场上练练步。比赛进行了约半小时后,终于轮到我们了。我们的第一支舞是华尔兹 (waltz)。共有七对选手参赛。Waltz 是三支舞中,我们最拿手的。整支舞跳下来,虽然没有练习时的好,但也没犯下什么明显的错误。第二支舞是 Tango。一个星期前才把舞步学完,练得最少的就是它了。抱着可能无法跳完整支舞的心里准备下场,却意外的跳完了。间中在节奏、舞步都有许多问题,但能跳完可真是出乎我的预料!第三支舞 quickstep,我自认是跳得不错的。可是开步不久,我的节奏却乱了!舞步也就变得一塌胡涂!我的心情更是跌到了谷底…… 颁奖环节,当听到我们拿了 waltz 的第一名时,心里有些安慰。至少还有华尔兹,心想其他的应该都在榜末了吧!意外却发生了!Tango 和 Quickstep 我们都拿了第三!真不敢相信,跳成这样还能拿奖,真是不好意思。这让我更相信,如果 Quickstep 没搞砸的话,要拿第一是有可能的。比赛已经结束,一切已不能重来,唯有继续努力,希望在下个月的比赛中做得更好。加油!

不再是舞伴了…

昨天,我与Adeline结束了拉丁舞伴的关系。我非常的对不起她,因为是我选择了其他人而辜负了她… 一起努力练习、上private class,最后却在不曾出赛的情况下结束了… 不久前,有人邀她做舞伴,她推辞了。她回说她已有了舞伴。可是如今,我却跟她拆伙… 我很不应该、全都是我的错!我衷心的希望Adeline能尽快找到一位新的舞伴。也希望我们的友谊能够继续…

第一场国标舞比赛

DSC_0047

学了七、八个月的国标舞,昨天终于上场比赛了!紧张啊~ 真是让我的舞伴笑话了😛 虽然跳的没有平时好,但是对手并不强,所以幸运的拿了第一。真的是开心。一个星期的每晚练习,没有白费😀   不能不提 Shvonne, 才学了不到两个星期的舞步,就能跳到这么好。我真是很幸运能有这么好的舞伴。也要特别谢谢 Andy 老师的教导。我们几乎每晚都到学院练习,老师教课之余,总会走过来指点我们。当然还要感谢师姐,没有你的教导,我一定没有现在跳得好:-)

After 7 or 8 months learning standard ballroom, I finally competed.  Was too nervous and being laughed at by my partner😛 We didn’t manage to dance as good as we can, but luckily the competitors were not strong and we got the first place.  We were really happy about it.  Practicing every night for a week has paid off😉  Shvonne is really good.  Learning the routine for less than 2 weeks and was able to dance so well.  I’m lucky to have such a good partner.  Special thanks to our teacher Mr Andy.  He let us practice every night in the studio.  We didn’t take any extra classes or private classes, but he had no problem coming over and guide us when we were practicing.  Last but not least, I must thank my senior for guiding me through the past 7 or 8 months.  Without you, I won’t be able to dance as good as I am now.  :-)

Henry Studio

唯一的一堂课,最终也画上了句号。如此的突兀,让我没有机会向同学们道别。或许这也是他们要的吧?一切的指责、中伤,我也懒得再理了。所有的是是非非,就留在这是非之地,与我再无瓜葛。

Follow

Get every new post delivered to your Inbox.