Monday, March 26, 2018

Use iptables on Linux to port forward

IPTABLES on Linux can be configured to replace Web Reverse Proxy in some cases to redirect ports. Below is how on Ubuntu.

Enter command below in SSH session to redirect port 80 to port 8080. Port 8080 will keep working.

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
Verify it it is working. Then make sure the configuration will be loaded every time Linux starts.

sudo iptables-save | sudo tee /etc/iptables.conf
to save your current iptables rules to /etc/iptables.conf and then insert these lines in /etc/rc.local:
# Load iptables rules from this file
iptables-restore < /etc/iptables.conf

Sunday, March 25, 2018

Cisco UCS Blade Server Setup Hints

The online information for Cisco UCS mainly covers concepts, but lacking on specifics, like cabling and admin access issues. Here is my notes.

Java Compatibility

Cisco UCS Admin Console is only compatible with Java 7, not Java 8.

The KVM console also requires Flash, so Firefox with Flash has the best compatibility. Chrome does not work with KVMconsole

Cabling 

Plug two, four or eight ports on the first network module on Chassis to Fabric Interconnect A, starting from left. If Fabric Interconnect is configured in cluster mode, two, four or eight ports on the second network module connect to Fabric Interconnect B.

In UCS Admin Console, set these ports on Fabric Interconnect as Server Ports. When done, chassis will show.

In UCS Admin Console, set some ports on Fabric Interconnect as Uplink Ports for connection into company network. Set speed to 1Gb if company network is 1Gb, otherwise the link will come up.

Use copper Ethernet SFP+ transceiver to connect Fabric Interconnect quickly into copper network.

Network Setup

Use LAN Pin Group to assign ports to network.


Small Cron Job Tricks

While troubleshooting a Linux script that fails to run, learned following three tricks about cron job:
  1. Check system log at /var/log/cron to see if the job has been executed on time.
  2. The last cron command in file, say a file in /etc/cron.d, must be followed by an empty line. Otherwise the last cron command will not be executed.
  3. Add  “2>&1” to the end of cron command to disable sending STD to email. By default, root receives email, or address specified by "[email protected]"

Chinese Wireless Router LB-Link

Recently I bought a couple cheap wireless router LB-Link BL-600N from China during my trip there. I bought it because I found people were discussing on Chinese router forum saying it is the cheapest router (less than CAD$10) with very high spec (dual band 600M, gigabit Lan and USB) and supports Tomato firmware. Although people says it runs super hot and suffers from wireless dropouts, I bought it anyway because I have been always pretty lucky buying cheap routers and configure them with 3rd party firmware to run stably. I believe I can attach heatsink to it to solve the heat problem and the wireless dropout issue seems to be heat related.

After a months of effect, I admit my confidence is defeated.

First is the temperature. One guy on the forum used a laser thermometer tested the running temperature. Without heatsink mod, the inner metal shield case runs 90 degree celcius. With heatsink covering the entire metal shield case, the temperature lowers to 70 degrees celcius. I do not have thermometer but by touching, it can attest the claim. Without heatsink mod, in other words with stock setup, the router starts to restart itself randomly after two weeks obviously due to high temperature. And it keeps restarting every  few hours as long as the temperature is not lowered. With heatsink mod, it does not restart itself anymore.

Second, after restarting problem solved, I come to realize the wifi dropouts. It is happening with and without heatsink mod and on both of my routers. The heatsink I used is from an old Nvidia fanless video card and it almost as big as the router itself. It does not runs too hot to touch. So either the wifi part of the router is defective or the temperature should be even lower, which I will try if I come across a giant heatsink in future, LOL.

Edit after a year.

I have now been running this LB-Link BL-600N for a year without rebooting. I ended up sticking a big heatsink onto the metal shield of the router, with plastic case removed of course. Wi-Fi is also disabled because it is not stable with or without heatsink. I plugged a dual band Lenovo Newfi router configured as AP for wireless signal. This setup has been rock solid ever since.

The firmware running on LB-Link BL-600N is Tomato Shibby for Tenda N60.