Monday, December 16, 2013

How to mount disk used by ReadyNAS

The following steps are useful if we want to salvage data stored in the drive in ReadyNAS.
I am not sure if the steps below are going to work on other ReadyNAS models, but it works on my ReadyNAS Duo (Sparc CPU).

Basically, what we need is a SATA-to-USB cable (can be bought on the Internet for couple of bucks).
NETGEAR ReadyNAS partitions the drive into 4 partitions.  In my case, it is detected as /dev/sdc:


[root@r3000 media]# fdisk -l /dev/sdc

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               2     4096001     2048000   83  Linux
/dev/sdc2         4096002     4608001      256000   82  Linux swap / Solaris
/dev/sdc3         4608002  1953092233   974242116    5  Extended
/dev/sdc5         4608003  1953092233   974242115+  8e  Linux LVM
[root@r3000 media]# 


There are couple of issues if we try to mount the partitions directly:

  1. ReadyNAS uses non-standard ext3 block-size, which in my case is 16384 bytes (use command "lvsc" to check)
  2. The home directory is partitioned as LV group, so conventional mount command is not gonna work
Here's the steps:
  • Scan the usb for LVM volumes and identify in the output the volume group name that has your READYNAS volume (mine proved to be c):
# vgscan
[root@r3000 media]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "c" using metadata type lvm2
  Found volume group "vg_r3000" using metadata type lvm2
  Found volume group "VolGroup" using metadata type lvm2

  • Activate the group for ReadyNAS (in this case, the group name is "C")
# vgchange -ay c
  • Find the logical volume that  (mine proved to be 'c'):
# lvs
  • root@r3000:/home/root# lvs
      LV   VG   Attr      LSize   Pool Origin Data%  Move Log Copy%  Convert
      c    c    -wi-ao--- 929.09g  
     
  • To display the logical name of the partition, use command "lvdisplay":
# lvdisplay /dev/c
  --- Logical volume ---
  LV Name                /dev/c/c
  VG Name                c
  LV UUID                7HUOrf-B5bL-ur6r-ULsd-yl4m-gCrA-zQc4s9
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                929.09 GiB
  Current LE             29731
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:5


We cannot use regular command "mount" to mount the non-standard blocksize ext3 partition.  Fortunately, there is a tool called "fuse-ext3" running in userspace that can help us.  The tool can be downloaded here.

Here's an example how to mount my ReadyNAS's LV volume:

fuse-ext2 -o sync_read,allow_other,rw+ /dev/c/c /media/readynas2

And here is the command to mount the system (root) partition which has the Linux software (I will post later about how to reset root password without resetting the ReadyNAS to factory default etc.)

fuse-ext2 -o sync_read,allow_other,rw+ /dev/c/c /media/readynas2


Note: don't forget to unmount the partitions once your'de done.



Why we need to migrate to IPv6 sooner



The test result above was done using DOCSIS 3.0 modem, XFinity Blast and thru 5 MHz Wi-Fi (802.11n).
See how IPv6 improves the download speed more than 3 times of IPv4 in download test?

I think of the reason is that with IPv6, we no longer need NAT on the router.  So the router most likely bypassed the traffic and directly forward it from the server to my computer (using global IP address).

The latency also improves with IPv6.  This might be caused due to the fixed size of IPv6 header, unlike IPv4.  All other optional headers in IPv6 are moved beyond the header, so routers can forward packets faster.

Tuesday, December 3, 2013

AT&T U-Verse vs. Comcast Xfinity

Technology used

U-Verse: FTTN (Fiber-to-the Node) and VDSL
Comcast: DOCSIS (DataOver Cable Service Interface Specification) and HFC



Diagram



CMTS = Cable Modem Termination System  (usually at curbside of a neighborhood serving house)
VRAD = Video-Ready Access Device (usually at curbside of a neighborhood serving house)
VDSL = Very-high-bit-rate Digital Subscriber Line
CPE = Customer Premise Equipment (e.g, U-Verse Residential Gateway)
FTTN = Fiber To The Node
HFC = Hybrid Fiber Coax
RG = Residential Gateway

How They Work

The central office above is a simplified of interwork of switches, edge routers (facing customers), and core routers (facing the Internet cloud, where Tier-1 backbone connections are interconnected).

U-Verse


The top network is AT&T network, while the bottom one is Comcast network.  Off course, the diagram above is oversimplified.  There are many other components of the Internet (web servers, mail servers, dhcp servers, dns servers, etc.  They will be discussed some day in separate blog).

AT&T's U-Verse network system consists of CPE sitting inside customer's home.  The upstream connection most of the time use existing coax cable that are usually pre-installed inside most houses for cable tv to minimize cross-talk and noise.  The Layer-1 protocol of this connection to VRAD is VDSL (or VDSL2 for higher speed [24 Mbps], or even VDSL2 bonding for even faster speed up to 45 Mbps.  Using VDSL2 vectoring, theoretically we can achieve even 100 Mbps).  

VRAD is an equipment (a rack equipment) sitting at the curb aggregating traffic from premises (homes).  It acts mostly like a layer-2 switch (with some layer-3 capability, such as DHCP, IGMP, some filtering).  The uplink connection to C.O is FTTN (Fiber To The Node) via optical fiber using GPON technology (or other optical technologies), while downlink connections to premises using existing regular phone's twisted pairs.  VRAD usually is equipped with backup batteries, so even when there is power outage, customers still can make phone call (if the customer uses VOIP, he also needs backup battery for his/her CPE).

The AT&T's CPE usually has multiple downlink ethernet ports and one (or two) POTS for VOIP (optional).  One of the Ethernet port is connected to setop-box (in case the customer subscribes to video as part of dual-play or triple-play).  Internet packets and IPTV packet streams are separated over separate VLAN.  For example, VLAN=100 for the Internet, while VLAN=999 for IPTV.  

When customer wants to watch a TV program by selecting a certain channel via remote, the setop-box sends IGMP join packet to VRAD.  VRAD, with its IGMP snooping capability, then requests C.O's router to send multicast packets containing the program.  This multicast packets are then forwarded to the customer's CPE as unicast packets.When other customers watch the same channel, they just join the multicast group and VRAD then forward the stream to them as unicast packets, so there is single multicast video stream coming from central office to VRAD.

All AT&T's residential gateway /CPE support Wi-Fi.  Wireless connection is treated like other wired connection in a sense it is bridged logically.  Once a CPE is up, as usual it sends DHCP (if it is set for automatic IP assignment).  This DHCP is snooped by VRAD and forwarded to C.O.  Once the client device has been assigned an IP address (public IP address), everything is the same as normal wired connection.  It is up to the CPE/RG to assign a local private IP address to any device connected to it (see previous posting for more detail about how it works).

Cable Network


Front Panel of a cable modem


Back panel of a cable modem


Cost Comparison

Sunday, December 1, 2013

Connecting Cable Modem to Two routers

Sometimes we want to split our home private network to two separate subnets, but want to maintain connectivity to the Internet/outside world. The following article tries to explain the basics and internals of most home WiFi routers in the market.

First, let see what are the basic components of a Wi-Fi router:



The following is an example of topology and connection of typical home network:





Router-1: Linksys WRT-54G running DD-WRT firmware
Router-2: NETGEAR Genie WNDR3400v2

The cable modem (DOCSIS modem) is connected to cable provider thru coax cable and its main function is to modulate/demodulate DOCSIS signal to regular ethernet frames (it might bind multiple channels [channel bonding] to increase bandwidth).  The cable provider assigns a public IP address to us to use.  This single public IP cannot be shared if we don't use router.

Router-1 and Router-2 see packets coming from modem, but they don't know how to route them to our devices at home yet.  Assume router-1 is the router that assigns DHCP IP address (running DHCP server), while DHCP server on router-1 is set to forwarder to router-2.  Router-2 is chosen as the main router because it has more recent hardware, supports 11n Wi-fi and supports IPv6 (PS3 is actually better to be connected to router-2 to lower the latency).

Other clients such as as Ooma, Roku and PS3 don't support IPv6 yet, so it's Ok to connect them to Router-2.

On Router-1:  
  • Set DHCP to DHCP forwarder (forward DHCP requests) to router-2 IP address
  • Set router IP address to 192.168.0.1/24
  • Set DNS to either public DNS (such as Google: 8.8.8.8, opendns's IPs or our own local DNS server)
  • Operation mode: router
  • Set wireless to bridged mode (so router-1's wifi is like another L2 ethernet device in our private LAN)
  • WAN type: Static IP.  If it is set to DHCP and the WAN port of router-1 is connected to the ethernet bridge, DHCP server at the ISP site may deny the request or even worse, shutdown the connection completely (thus require modem reboot to fix the problem).
  • Set WAN static IP to router-2 ip address.  This way, we assume router-2 is the gateway and delegates NAT work to router-2 (that's why we set the operation mode of router-1 to "router")


Router-2:
  • Enable AP mode
  • Set router IP address to 192.168.1.1/24
  • Internet IP: Get dynamically from ISP
  • Set DMZ to Router-1

How it works:

A tablet is trying to connect to the Internet via router-2.  All Wi-fi transactions have been done and now it sends DHCP request to router-2.  If this is an initial request made to router-2, router-2 doesn't learn any IP yet so it first learns for the tablet's MAC. Because router-2 runs local dhcp server, it snoops any DHCP request and serves it.  In this case, router-2 then assigns an address in the subnet 192.168.1.0/24 along with DNS addresses and gateway IP (in this case, an ISP-assigned IP address) back to the tablet as DHCP RESP packet.

Now the tablet has a valid private address, now it can connect to the Internet via router-2.  All requests from the tablet is network-translated to public address and vice-versa.  So, if the public IP is a.b.c.d, tablet' IP address is 192.168.1.5 and it is requesting access to www.google.com (http www.google.com:80) from a local tcp port xxxx, the actual packet in the public wire is "a.b.c.d:yyyy", where xxxx is a the original tcp port and yyyy is the translated tcp port by NAT (router-2 maps local to public IP via port) [ Click this for more info about NAT/PAT mechanism].

OK, everything seems to work.  Wait...what about all other devices connected to router-1? What happens if we want to watch Netflix on Roku?

When Roku device is turned on, it sends DHCP REQ similar to tablet above.  The sequence is the same, but the difference is, because router-1 doesn't run DHCP server, all DHCP packets are forwarded to router-2.  So, it is assigned an IP address in the same subnet (sorry, the diagram above is wrong, the subnet should be the same).  When the Roku starts sending tcp packets, the packets not-intended to the private subnet and coming to router-1 are assumed to be forwarded to its gateway (router-2).  Router-1 sees these packets coming from its DMZ and do the same translation to public IP.

An alternative is to subtend router-1 to router-2 directly, not via ethernet switch.  The rest is the same.



Sunday, November 10, 2013

AT&T U-Verse with external wifi router running DD-WRT software



I don't like the way wi-fi connection is handled by CPE (Customer Premise Equipment, such as the provider's home gateway/router), so I want to use the Wi-Fi capability of Linksys.  DD-WRT gives features in handling L2 connections (MAC filtering etc.),  but I still want the CPE to handle DHCP and NAT services.  Basically, I just want to make the Linksys router acts like a Wi-Fi and Wired switch, as an extender of the existing CPE.

 The objects in yellow box represents component in the Wi-Fi router (in this case, a Linksys WRT54G running DD-WRT firmware).

DHCP server on U-Verse CPE is configured to give IPs in 192.168.0.x subnet.  The CPE address is set manually to 192.168.0.1

Here's what I want:
CPE internal IP address = 192.168.0.1
Linksys Internal IP address = 192.168.0.2
IP range for Clients = 192.168.0.3 - 192.168.0.254

CPE setting:
  • Wireless  disabled
  • Configure DHCP to assign IP range: 192.168.0.3 - 192.168.254

DD-WRT settings:
  • WAN connection type = disable
  • Local IP = 192.168.0.2/24
  • DHCP server = forwarding to 19.168.0.1 (CPE)
  • Check option box to assign WAN port to switch (NAT is thus disabled; it is now acting like a pass-thru to switch)
  • Wiress network configuration = bridged (so all Wi-Fi clients are seen by CPE as they're directly connected)
  • Wiress Tx Power = 250 mW
  • Advanced routing = router (doesn't matter actually)
  • Disable CPI firewall
  • Routing = disable
This way, all Wi-Fi is handled by Linksys router/switch, but only its L1-L2 layers.  Everything else is handled by the CPE.  We can also relocate the Linksys somewhere else, no need to be close to CPE as long as we have long ethernet cable or by using Powerline extender.

Monday, October 21, 2013

Which PC/gadget has the highest pixel resolution?

Here I have collected and calculated PPI (Pixels per Inch) for some laptops and tablets.



Screen Diameter (inch)Screen Ratio (Width/Height)Angle (rad)Screen widthScreen HeightNumber Of Pixels (Horizontal)Number Of Pixels (Vertical)PPI
15.61.780.5113.607.65128072094.14HP Pavilion 2000T
15.61.780.5113.607.651366768100.44
17.31.780.5115.088.481600900106.11HP Pavilion 17z Laptop
141.780.5112.206.861366768111.92HP Pavilion 14 Chromebook
15.61.780.5113.607.651600900117.68
18.41.780.5116.049.0219201080119.72Alienware 18
15.61.600.5613.238.2716801050127.00
17.31.780.5115.088.4819201080127.34HP ENVY 17t 1080p
15.61.780.5113.607.6519201080141.21HP ENVY 15t Quad 1080p
15.61.780.5113.607.6519201080141.21Dell XPS 15
8.91.600.567.554.721280800169.60Amazon Kindle HD
17.31.780.5115.088.4825601440169.78
15.41.600.5613.068.1628801800220.53Apple Macbook 15.4 with Retina Display
13.31.780.5111.596.5225601440220.84Toshiba KIRAbook™ 13 Ultrabook
13.31.600.5611.287.0525601600226.98Apple Macbook 15.4 with Retina Display
141.780.5112.206.8632001800262.25HP TouchSmart 14 Ultrabook
8.91.330.647.125.3420481536287.64iPad 8.9" with Retina Display
71.600.565.943.7119201200323.45Amazon Kindle HDX 7"
8.91.780.517.764.3625601440330.02Amazon Kindle HDX 8.9"


So far, nothing can beat Amazon Kindle HDX, not HP not even Apple iPad with Retina display.  Because the price of a laptop is significantly higher with higher PPI, the affordable price of Kindle plus its highest PPI makes it the best gadget for eyes and pocket!