NZ SPARK FIBRE OPENWRT

What? Why?

I was cutting over from Cable (Vodafone) to Fibre (Spark) broadband, and spent far too long this morning sifting the Internet for how to set up my OpenWrt router. This page is mainly for my own benefit (so I can reconstruct what I did the next time I need to do it), but I thought I'd publish it in case it helps anyone else. The following is what I needed to do for OpenWrt version 21.02.0, but hopefully it's useful for other versions as well.

If you've done any poking around on this topic, you'll likely have hit upon the criticality of the 'VLAN / VID' "10" setting to make this all work. My problem was I had bugger-all idea of how to get this set up in OpenWrt. Here's what it took to get it up-and-running...

Before We Start

Ensure your ONT is up-and-running (Power / GPON / LAN1). Ensure your OpenWrt router is plugged in to LAN1.

Login to LuCI on your OpenWrt router and capture your current set-up (in case you need to roll-back) via screenshots of:

Ideally you are comfortable SSHing into you router, and can keep an eye on the contents of /etc/config/network as we work - whilst not 100% necessary, it's the easiest way to verify that all our changes are in place.

Other reference material: Chorus ONT: Model Type 300; Set up a non-Spark modem.

Let's Go!

On the 'Network - Switch' screen we want to swap out the default VLAN ID "2" for a VLAN ID "10". This seemed to be as simple as changing the "2" to a "10", but after 'Save & Apply' and re-checking the contents of /etc/config/network I could see that "config switch_vlan" section was only partially updated ("option vlan" was set to '10', as expected, but "option vid" remained set to '2', the old value). After setting 'WAN' to "tagged" + 'Save & Apply' /etc/config/network now seemed to be fully correct.

OpenWrt Switch

Next we need to update the 'Network - Interfaces: WAN' (via 'Edit') to set up PPPoE (as per Set up a non-Spark modem), including selecting our new "eth0.10" device on the 'Device' list. Note that you won't see the "(wan, wan6)" bit after "eth0.10" until after you 'Save & Apply' this + the next change.

OpenWrt WAN

I also updated the 'Network - Interfaces: WAN6' settings to select our new "eth0.10" device, but otherwise left this bit alone as I'm on even shakier ground when it comes to IPv6.

After 'Save & Apply' my Spark connection came up and my 'Network - Interfaces' looked like this:

OpenWrt Interface

Summary Of Changes To /etc/config/network

Old New
config interface 'wan'
	option device 'eth0.2'
	option proto 'static'
	option ipaddr 'XXX.XXX.XXX.XXX'
	option netmask '255.255.255.0'
	option gateway 'XXX.XXX.XXX.XXX'
	list dns '1.1.1.1'
	list dns '1.0.0.1'
config interface 'wan'
	option proto 'pppoe'
	option device 'eth0.10'
	option username 'user@spark.co.nz'
	option password 'password'
	option ipv6 'auto'
	option peerdns '0'
	list dns '1.1.1.1'
	list dns '1.0.0.1'
config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '5 0t'
config switch_vlan
	option device 'switch0'
	option vlan '10'
	option vid '10'
	option ports '0t 5t'

Extra For Experts

You don't have to use Spark's DNS servers - simply edit the settings about halfway down the 'Network - Interfaces: WAN - Advanced Settings' tab.

OpenWrt DNS