Skip to content
Apr 14 14

American Netflix on any device without VPN or site-wide DNS changes – using pfSsense

by Finn Espen Gundersen
Netflix Mad Men

It seems like everyone is finding ways to watch American Netflix content. While it is easy with one of many plugins on the computer, it gets harder on devices such as iPad or PS3 and even more so on Chromecast with its hard-coded google DNS. Some people will also want a solution for the home router, covering all devices at once.

The most common fix is to get a VPN. Usable from the computer, iPad, Chromecast or a sufficiently advanced router, a VPN routes your traffic through a server in the US. The main drawback is speed. Most VPN providers are over-subscribed and, in general, it will be hard to get Super HD streaming – at least with any stability and on more than one device. You will also want to separate your other browsing traffic from the VPN to avoid the speed loss, and avoid having all websites think you are from the US. All in all, a solution with drawbacks.

Another common fix is to get a custom DNS provider such as unblock-us.com or unotelly.com. After the extremely easy sign-up you just change your DNS server settings to point to theirs. The custom DNS will return the addresses to their own US-based servers (reverse proxies) for all Netflix-related lookups. All other traffic flows normally.

This avoids the speed loss of a VPN as the actual streaming goes directly from Netflix’s servers to your home. It also does not affect your other web traffic. Usually a cheaper service than a VPN, this seems like the perfect solution. It does, however, have a slight security implication: the DNS provider can see all your lookups and could in theory log or divert some of it.

What we want is to divert only relevant lookups to the proxy provider’s DNS. This is accomplished in pfSense by adding a domain override in the DNS Forwarder. For some reason the web gui for the domain override does not allow wildcards, even though the underlying dnsmasq service does. We accomplish our task by adding the following to Services | DNS Forwarder | Advanced and making sure the box “Query DNS servers sequentially” is checked:

server=/netflix.com/208.122.23.23
server=/netflix.net/208.122.23.23
server=/rhapsody.com/208.122.23.23
server=/pandora.com/208.122.23.23
server=/hulu.com/208.122.23.23

The IP address is for the DNS server of unblock-us. Only the first two lines are necessary for Netflix, the others are for Rhapsody, Pandora and Hulu.

For the unbehaving Chromecast, with its hard-coded Google DNS, we are forced to add a NAT rule to reroute all DNS requests. In Firewall | NAT | Port Forward, add a new rule with these settings:

RDR: Unchecked
Interface: LAN
Protocol: UDP/TCP
Source: IP of your Chromecast
Source port: any
Destination: any
Destination port: DNS (53)
Redirect target IP: the DNS server of unblock-us or similar service
Redirect target port: DNS (53)

Chromecast pfSense NAT

All in all this is a perfect solution. Switching regions can be done either in the DNS provider’s web interface, or by disabling the pfSense settings.

Apr 6 14

Altibox med egen ruter med pfSense

by Finn Espen Gundersen

De fleste som har Altibox fiber-bredbånd og vil bruke egen ruter hjemme setter Altibox-ruteren i bridge-mode. Men det er unødvendig å ha den som et ekstra ledd mellom deg og internett. Du kan like gjerne kople din egen ruter eller server rett på linjen.

Denne trengs ikke

Denne trengs ikke

Om du ikke har vært Altiboxkunde alt for lenge så har du en mediekonverter foran ruteren som leveres av Altibox. Da kopler du deg direkte i mediekonverteren. Har du ikke en mediekonverter er jobben litt mer innfløkt fordi du må direkte på fiberen med f.eks egen mediekonverter.

Mediakonverter

En PC med to nettverkskort, hvorav kortet som skal være WAN støtter VLAN (det gjør de fleste) er alt som trengs. Jeg bruker en HP Microserver med et ekstra nettverkskort og pfSsense. HP Microserver sitt innebygde nettverkskort støtter VLAN. Boksen har heller ingen problemer med de høye båndbreddene man kan få hos Altibox. Vil du bare teste så fungerer det helt fint å starte pfSense fra USB-pinne uten å installere.

Internett leveres på VLAN 102 og den offentlige IP-adressen kommer med DHCP. TV leveres på VLAN 101. Takk til første poster i denne posten for disse opplysningene. Det er mulig rettskriving ikke er posterens beste side, men han vet hva han snakker om.

Når pfSense starter spør den først etter evt VLAN. Svar ja og oppgi VLAN-tag 102 på WAN-kortet. Om WAN-kortet heter bge0 skal deretter WAN bindes til bge0_vlan102. LAN bindes til det andre kortet.  Videre innstillinger kan gjøres i pfSense webinterface på http://192.168.1.1/.

pfSense Altibox

pfSense setter som default opp ruting og NAT mellom WAN og LAN og henter adressen på WAN-kortet via DHCP automatisk. Det er overraskende lite jobb å få dette til, jeg hadde satt av godt med tid til frustrasjon, men opplevde ingen. Ingen endringer på Altibox sine selvbetjeningssider er nødvendig. Det er heller ikke nødvendig å sette MAC-adressen på WAN-kortet til samme MAC som Altibox-ruteren. Alt bare virker.

Har du kommet så langt som dette så får du til ruting av TV-signalet selv. Når du først er i gang, så gå for Altibox IPv6 i tillegg.

Altibox burde dokumentere denne fremgangsmåten på egne sider. Det gir ikke mer supportkostnader enn for bridge-mode-brukerne (“eget ansvar, plugg tilbake ruteren vår før vi hjelper deg”), men ville gitt Altibox som brand mye geek-cred. Og det er slike som velger bredbånd for venner og slektninger.

 

Dec 29 13

Keep iPad/iPhone iOS keyboard up between input fields

by Finn Espen Gundersen
Keeping it up: no longer a problem

The iPad and iPhone has more than a few quirks web developers need to handle. One of them is being quite insistent on when to show and hide the on-screen keyboard. The default iPad behaviour, in all iOS versions, is to drop the keyboard between input fields, and to deny programmatically showing the keyboard on focus changes. It is only shown when the user taps an input field.

While this is adequate for most situations, it can be really frustrating in cases of several fixed-width input fields in a row.

Here is how to circumvent this behaviour and give your site’s user interface a more natural flow. This solution works for wide and short input fields alike, flawlessly moving the user from zipcode to phone number, or from character to character between multiple single-letter input boxes. Compare entering words on lexical word finder (without this technique) to entering words on this wordfeud help site (with this technique).

We rely on two tricks to make this work. First, we keep the user in the same input box all the time, just changing the position and appearance as we move along. Second, to keep the code changes small and localized, we take advantage of the fact that we can change the id of an element.

In this way, even as we are moving the same input field along, we are changing it’s id (and size, location etc as well) — to avoid having to change the existing program logic of the page. The entire time, all input fields will have the correct id’s, even though we have been moving the same field along all the time. We also do not introduce any extra fields to put above the real/existing ones (a trick seen in some other solutions).

This has the additional advantages of always leaving the page in a consistent state should the user choose to unfocus and do something else in the middle of filling out the form, as well as being supported in all browsers – avoiding an iOS-only workaround.

The code snippet with a live functioning demo is hosted on jsFiddle.net and should be fairly self-explanatory. It shows both the regular and iOS-friendly version.

Most of the magic lies in replacing the common step nextfield.focus(); to move from one input field to the next, with the function moveon_ipad(fromfield, nextfieldid) and realising that there is no previous field to blur (i.e. removing any blur-specific code when moving along, although it stays in for the event when the user clicks elsewhere).

In the demo, each field has a different background colour to allow you to see how the field moves along in the iOS-friendly version while they all stay put in the plain version. In practice, the background colours would be the same (or one of the properties the moveon_ipad function swaps), so the user would not notice any difference.

While the live demo uses jQuery1.9.1, the code is very short and easily adaptable. The demo also uses absolute positioning to ease the movement, but this is not a requirement.

Dec 22 13

Karamellpudding Sous-Vide

by Finn Espen Gundersen
Karamellpuding sous vide

Det er vinter og tid for karamellpudding. I år lages den sous vide. Det er foreløpig vanskelig å finne konkrete fremgangsmåter på web, men fortvil ikke, etter litt prøving og feiling er oppskriften her — og resultatet blir perfekt hver gang. Oppskriften fungerer også fint for vanlig ovn.


For 5 personer trengs:

3dl sukker til karamell (blir mer enn nok)

————

1dl sukker til pudding

6dl melk

3dl fløte

1 vaniljestang

————

8 egg

Men det kommer som regel flere, og alle liker karamellpudding, så jeg lager dobbelt opp. Karamellpuddingen lages like gjerne av laktoseredusert melk og laktosefri fløte.

Karamell er varmt og karamellpudding krever flere omganger med oppvarming og nedkjøling. Dette er en kjempeanledning til å skaffe litt utradisjonelle kjøkkeneredskaper som sveisehansker og IR-termometer.

Gloves and temperature device

Steg 1: Karamell

Mens man før trodde sukker smeltet, så har man nå funnet ut at smeltende sukker har en prosess som ligner mer på nedbrytning og som foregår i området 160-185°C. Rask oppvarming gir et høyere smeltepunkt enn sakte oppvarming. Dette kan vi utnytte for å få perfekt karamell. Ved for høy temperatur blir karamellen mørk, brent og bitter. Bruk svakere varme, god tid og få den lysere brun og tyktflytende. Noen små klumper av sukker gjør ikke noe, de løses likevel opp senere i prosessen, men sjekk at det ikke er store klumper av sukker igjen i blandingen.

Smeared caramel

Bruk en sleiv til å smøre karamellen rundt i formen. Her bør det gå fort, for karamellen stivner raskt. Sveisehanskene sørger for at ingen brenner seg selv om karamellen er varmere enn kokende vann. Man kan ordne seg litt bedre tid ved å forvarme formen. Få karamellen opp langs kantene, men det er ikke viktig akkurat hvor langt opp den kommer.

Siden jeg lager dobbelt opp blir det to brødformer.

Steg 2: Pudding

Kok opp sukker, melk, fløte og vanlijestang i en gryte. Som alltid ved oppkok av melkeblanding så brenner det seg fort så rør ofte. Automatisk sauserører gjør jobben og avlaster kokken.

Automatisk rører

Etter et kort oppkok må blandingen avkjøles. Mens man venter passer det å røre sammen eggene.

Eggs

Blandingen må være under 60°C før eggene helles i for å unngå at eggene koagulerer.

IR device

Steg 3: Blandings

Mixture and caramel

Så er det bare å helle i formen.

The pour

Og plassere i maskinen. Plast på toppen gjør at det ikke regner på puddingen fra taket av maskinen.

In the sous vide basin

Melkeblandingen hever koaguleringspunktet helt til 79°C. Vi må derfor over 79°C for å få blandingen til å stivne. Jeg bruker 83°C i 2t 10min. Det betyr ikke så mye om vannbadet er forvarmet eller ikke siden ingenting stivner før 79 grader likevel, men tiden regnes fra maskinen når riktig temperatur.

Sous vide temperature

Går man for ovn plasseres formen i vannbad også der, men da 125°C i 2,5t. En fordel med sous vide er at man unngår den snerkete toppen (som blir bunnen ved servering) på den ferdige puddingen.

Selv om det ser elegant ut med form som flyter i maskinen, så lønner det seg å tilpasse vannmengden slik at formene står selv. Når puddingen stivner kan det nemlig hende det ikke skjer like raskt over alt. Dermed kan formen ende med å stå høyere i den ene enden underveis i prosessen og vips tar den inn vann og synker. Er du heldig skjer det ikke for tidlig og man kan bare helle av vannet.

For at formene skal kunne stå, men maskinen likevel ha nok vann, plasseres noen avstandsstykker i bunnen. Til overs IKEA-vinkler fungerer fint. Uten nok vann i maskinen vil den ikke klare å holde temperaturen jevn.

Den ferdige puddingen avkjøles og settes i kjøleskap ca ett døgn — gjerne lenger. Løsne sidene fra formen før servering, hell av karamellsaus i mugge, og snu formen raskt på et fat.

Karamellpuding sous vide

Serveres med pisket krem! Nyt den!

Nov 11 13

Quick Overview: Intel Next Unit of Computing

by Finn Espen Gundersen

Intel is pushing a new form factor, the Next Unit of Computing (NUC), and it is looking good. I recently got two of these and have some pictures and experiences to share.

The NUCs have some exciting properties and a couple of gotchas, read on and avoid my mistakes.

NUC box

First of all the box itself has a small surprise. When it opens it plays the Intel jingle from some embedded electronics with a light-sensor and a speaker. Oh, the humanity.

Inside the box is the power supply, the surprisingly small unit itself and a solid metal bracket (and six screws for this). The bracket is a VESA mount used for hanging the NUC on the back of a monitor. This is a very clever way to get the unit out of the way and put all those monitor VESA mounts to good use.

What is not inside the box is:

- Power cable (from wall to power supply)
- RAM
- Disk

Also, while having two WLAN antennas inside, the unit does not contain a motherboard with onboard WLAN.

WLAN and mSATA are mounted above each other.

WLAN and mSATA are mounted above each other.

Note that due to the crammed space inside, the parts are as small as possible. If you want to get a suitable WLAN adapter, make sure to get a PCI Express half mini adapter such as the Intel Centrino Advanced-N 6205 (top left).

And most importantly, the disk is an mSATA (lower left), an until-now quite unusual form factor and currently only available as SSD. My usual webshop does not yet even have a category for mSATAs, they are hidden amongst ordinary SSD SATA drives, which caused me to actually order the wrong drive the first time around. The brick-and-mortar stores in my city does not yet stock mSATAs at all.

WLAN, mSATA and RAM mounted.

WLAN, mSATA and RAM mounted.

This particular NUC boasts an impressive amount of display IO for the small size. Two mini display ports in addition to HDMI is not commonplace. Apart from this there is ethernet and three USBs (two shown here and one available on the other side).

NUC IO closeup and VESA mount

NUC IO closeup and VESA mount

All NUCs restrain themselvs to Intel onboard graphics. While models with HD5000 are on their way this month, only models with HD4000 are actually in stock right now.

NUC mounted on monitor with the VESA mount

NUC mounted on monitor with the VESA mount

I really like the monitor mount. The NUC is not screwed in place, merely hinged on to the metal bracket, but fits snugly. The end result is a stationary computer without the usual space-consuming tower to hide.