D-Link DSL-320B: A truly awful modem

D-Link DSL-320B: A truly awful modem

The irony of this post is that, only a few days ago, I was singing the praises of the D-Link DSL-320B. Sadly, I was more than a little wrong. This modem has turned out to be a shocking piece of software engineeringWikipedia: Software engineering (SE) is the application of engineering to the development of software in a systematic method.[1][2][3] and has stolen many hours of my life, that I will never get back.

When in 1483 Bridged IP mode, the modem was actually fine. It connected to the ISP and allowed the routing of a subnet over it. When I switched to a new ISP, which used PPPoA, the story was somewhat different. The setup is such that the PPPoA connection gets issued its own IP address, outside of the routed subnet, and then the subnet is routed over this. This modem implements a system called half-bridgingWikipedia: A network bridge is a computer networking device that creates a single aggregate network from multiple communication networks or network segments. This function is called network bridging.[1] Bridging...… in a horrible horrible way. A way which, in fact, kills kittens. Poor poor kittens.

When you first connect a computer to the modem, its DHCPWikipedia: The Dynamic Host Configuration Protocol (DHCP) is a standardized network protocol used on Internet Protocol (IP) networks. The DHCP is controlled by a DHCP server that dynamically distributes network ... server issues the computer with an IP address from the DHCP range – lets say 192.168.1.2. It also issues the computer with its own local address as the gateway – lets say 192.168.1.1. Once the PPPoA connection has established it re-issues the DHCP lease, giving the computer the public IP address (e.g. 62.132.23.205 ) as well as its local address as the gateway. As such, your IP configuration looks a little like this:

IPv4 Address. . . . . . . . . . . : 62.132.23.205
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 192.168.1.1

The more observant of you will be scratching your head with bewilderment now. The computer is now in a subnet all of its own, as dictated by the subnet mask, but is using an IP in an entirely different subnet as its gateway. It seems to use a system of sending ARPWikipedia: The Address Resolution Protocol (ARP) is a communications protocol used for resolution of Internet layer addresses into link layer addresses, a critical function in the Internet protocol suite. ARP wa... replies frequently, to ensure that the computer always knows the MAC address of the 192.168.1.1 host – since it won’t ARP for it itself. This didn’t seem to work with my BSD based router, which plain refused to add a gateway which was not on the same subnet. I don’t really blame it. It seems this modem was designed for Windows.

Anyway, the plot thickened further. To allow bridging, the modem uses a route which routes all packets out of the PPP interface. This route is only added after the second DHCP lease has been successfully issued. It does not appear to be possible, inside its interface or via telnet, to add this route manually. As such, it was possible to con the modem into working as a full bridge by using a Windows computer to get a DHCP lease and then connecting the modem to a network of devices which used IPs in the routed subnet. This was a poor solution as the DHCP lease expired every 10 or so hours, thus this process needed to be repeated frequently to get Internet connectivity back. Further to that, if you turned off the DHCP server, it was impossible to connect to the Internet using the modem in PPPoA mode.

As a side note, if you set the MTU of this modem’s PPPoA connection to 1500, it resets itself to factory settings. Useful, eh?

In the end, I opted to buy a  Thomson Speedtouch 546 which works wonderfully.

Maximum transmission unit (MTU) explained

Maximum transmission unit (MTU) explained

The maximum transmission unit (MTU) is a term used in data networking and refers to the maximum size of a single data unit that can be transmitted across a specified medium. For example, the MTU of Ethernet, the most widely used protocol on the Internet, is 1500 bytes. That is to say that a single Ethernet frame cannot be larger than 1500 bytes.

The MTU represents a balance between efficiency through reduction of protocol overheads and the reduction of work if an error occurred. Thus, if the MTU is set too low, more data packets will have to be sent to represent a single bit of data. Each comes with its own headers and thus extra overhead. However, if the MTU is set too high and a transmission error occurs, the whole packet will have to be re-transmitted. It is also the case that larger packets are more likely to encounter errors – thus worsening the problem.

So how do networks of different MTUs communicate? In an IPv4 network, the mediums will simply fragment the data into multiple packets. For example, if the network was something like this:

Computer —– Ethernet Jumbo Frames (8000 bytes) —–> Router —– Ethernet v2 (1500 bytes) —–> ADSL Modem —– PPPoA (1492 bytes) —–> ISP Router —– Ethernet v2 (1500 bytes) —–> Server

This represents a network comprising of a number of different MTUs. The first computer is on a network which permits Ethernet Jumbo Frames at an MTU of 8000 bytes. It, thus, sends packets of a maximum size of 8000 bytes. Let say one of these packets is 6000 bytes in size. It will hit the first router which must send the packet to the ADSL Modem at an MTU of 1500 bytes. It will, thus, split the packet into 1500 byte chunks. This will likely be 5 packets, once the additional protocol data has been applied to each packet.

The ADSL modem is then restricted by an MTU of 1492 bytes to transmit data over the phone lines to the ISP’s router. It further fragments each packet, probably into 2 (making 10 total), to allow this transmission. The ISP’s router receives this packet and, although the next hop allows a higher MTU, it will not typically attempt to re-combine packets to get maximum efficiency.

So, the bottleneck of this network is the PPPoA communication over the phone lines. It could be eliminated by allowing a 1500 byte MTU. This is not something that any single party can do, rather both sides of the connection must agree to the MTU setting.  BT’s 21CN network permits an MTU of 1500 bytes, however many ADSL modems are configured by default to use 1492. Upping this to 1500 will prevent certain fragmentation and thus increase throughput.

An IPv4 packet can set a flag to tell routers not to fragment it. If this is set and the packet is larger than a given MTU, the packet will not be sent on – rather a failure message will be sent.

In IPv6, the MTU of the entire transmission is determined using discovery protocols, by the sending host. This means that the host will never send a packet that is too large to transmit over any given part of the path between source and destination and it will thus never be fragmented. So, in our example above, the computer should never send a packet more than 1492 bytes. If it does, the packet will be dropped.

Using BE Unlimited with another modem

I’m canceling my BE contract and need to return the BE Box to them. I’m getting a VDSL2+Wikipedia: Very-high-bit-rate digital subscriber line (VDSL)[1] and Very-high-bit-rate digital subscriber line 2 (VDSL2)[2] are digital subscriber line (DSL) technologies providing data transmission faster than ... connection with an ADSL2+Wikipedia: ITU G.992.5 (also referred to as ADSL2+, G.dmt.bis+, and G.adslplus[1]) is an International Telecommunication Union standard for asymmetric digital subscriber line (ADSL) broadband Internet access. Th... backup, for which I needed a standard ADSL2+ modemWikipedia: A modem (modulator-demodulator) is a network hardware that modulates one or more carrier wave signals to encode digital information for transmission and demodulates signals to decode the transmitted i... for. Because it was going cheap on eBay, I went with the  D-Link DSL-320B. This is actually a really good modem in such that it has a decent web interface supporting many different types of connection as well as telnetWikipedia: Telnet is a protocol used on the Internet or local area networks to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is intersper... access to a powerful command line to do things like static routes.

To configure a modem such as this on BE Unlimited, you need the following settings:

Type: 1483 Bridged IP LLC
VPI: 0
VCI: 101

Note that this is NOT PPPoATMWikipedia: In computer networking, the Point-to-Point Protocol over ATM (PPPoA) is a layer 2 data-link protocol typically used to connect domestic broadband modems to ISPs via phone lines. or PPPoEWikipedia: The Point-to-Point Protocol over Ethernet (PPPoE) is a network protocol for encapsulating PPP frames inside Ethernet frames. It appeared in 1999, in the context of the boom of DSL as the solution for ... and, as such, doesn’t require a username/password.

Following this, you can then assign your router your issued static IP address(es), or set its WAN interface to use DHCP, if you have a dynamic IP.

My DSL-320B reports the cable status as being “Up” but the ADSL status as being “disconnected”. I assume that this is because it has not dialed a connection. It works fine, despite this.

My sync rates with the new modem are about what they were before:

Downstream Line Rate (Kbps) :    17301
Upstream Line Rate (Kbps) :    2342

My speedtest.net results show higher upstream than before, however this may just be the way the cookie crumbled with the speed test:

 

 

 

 

 

VLANs and 802.1Q VLAN Tagging explained

VLANs and 802.1Q VLAN Tagging explained

VLANs are a feature of almost all managed network switchesWikipedia: A network switch (also called switching hub, bridging hub, officially MAC bridge[1]) is a computer networking device that connects devices together on a computer network by using packet switching to r.... A managed switch will allow you to assign ports to VLAN groups. Devices in one VLAN will not be able to directly communicate with devices in another VLAN. In simple terms, creating VLANs is a bit like splitting a switch into multiple smaller switches.

Why would I buy an expensive managed switch when I could just buy multiple cheap unmanaged switches, I hear you ask. Well, a port can be assigned to multiple VLANs. If you wanted to, for example, break 192.168.0.1/24 (254 usable IP addresses) into 2 groups of 192.168.0.1-192.168.0.100 and 192.168.0.101-192.168.0.254 you could create 2 VLANs, one for devices in each IP range. You could then have an administrative terminal connected to a switch port which is in both VLANs. This administrative terminal can then access devices in both IP ranges.

So what is 802.1Q VLAN tagging? Well, it allows a single port to access multiple VLANs, even if devices in each VLAN are in a different IP subnet. For example, if your network had two departments one which used 192.168.0.1/24 and the other which used 10.1.1.1/24, you could create two VLANs as described above. You could then create a 802.1Q VLAN tagged port on the switch and connect a device such as an administrative computer or a router into it. You would then configure the administrative computer or router to assign it 2 IP addresses (for example 192.168.0.100 and 10.1.1.100) and associate each IP with the correct VLAN. Every packet of data that is sent from the router to the switch would tell the switch which VLAN it is for (and visa versa).

Here is an example usecase for 802.1Q VLANs:

A switch has 3 VLANs on it…

  1. Ports 1-4 :: Internet facing devices such as the modem and servers
  2. Ports 5-14 :: Devices in the finance department
  3. Ports 14-20 :: Devices in the HR department

In ports 1-4 (VLAN1) we have connected the modem and a Linux server. These have public IP addresses in the 13.14.15.16/28 range. In ports 5-14 we have connected PCs in the finance department which have private IP addresses in the 192.168.1.0/24 range. In ports 14-20 we have devices in the HR department which have private IP addresses in the 10.0.1.0/24 range.

Port 21 is 802.1Q VLAN tagged with access to all 3 VLANs. Into this port, we have connected a router. This router has an IP address for each VLAN (192.168.1.1, 10.0.1.1 and 13.14.15.17). The router routes packets between the three VLANs to give private IPs access to the Internet, using NAT, as well as routing packets between the two private subnets to give the HR department access to files in the finance department and visa versa.

Controlling the image and title displayed on Facebook for a ‘like’

Controlling the image and title displayed on Facebook for a ‘like’

If you have a ‘like’ button on your website, you can control most of what gets displayed on the wall of the user who ‘liked’ the site. The two most common things that one would want to control are the title and the image. You can control these with a set of meta-tags that you place in the <head></head> of your site.

An example of these is as follows:

  1. <meta property="og:title" content="Phil&#039;s Blog | Thoughts of a derptastic developer"/>
  2. <meta property="og:type" content="article"/>
  3. <meta property="og:url" content="http://phil.lavin.me.uk/2012/01/controlling-the-image-and-title-displayed-on-facebook-for-a-like/"/>
  4. <meta property="og:image" content="http://phil.lavin.me.uk/wp-content/uploads/2012/01/facebook-logo.png"/>
  5. <meta property="og:locale" content="en_GB" />
  6. <meta property="fb:admins" content="p.lavin"/>

It should all be self explanatory, except for ob:type. You can find a type that suits your content on Facebook’s type list.

Once you have put these tags on your site, you can check the tags validate by running a link to your site through the Facebook Debugger. Running a page through this tool also has the advantage that it clears the page from Facebook’s cache. This is useful if you tried to like the page before you added these tags and the previous title and image have been cached by Facebook.

You can see it in action if you ‘like’ this article using the button below. You will see the article’s thumbnail is pulled across to Facebook.