Connecting to NBN HFC with a linux router

Update 2021-03-04: for a modern setup with dual-stack IPv4/IPv6 and systemd, see this post.

Internode recently migrated me from an ADSL connection to an NBN HFC connection. Here’s how I configured the connection using my own Debian GNU/Linux router instead of the TP-Link VR1600v internode supplies…

NBN Co supplies an Arris CM8200 NTD, which is a modem that bridges local ethernet to the ISP via DOCSIS over the coaxial cable.

Additionally, Internode’s configuration requires PPPoE encapsulation with 802.1q VLAN tagging.

I’m using physical interface eth1, so in /etc/network/interfaces I have:

# See interfaces(5)
auto eth1
iface eth1 inet static
    address 192.168.1.2/24

# VLAN ID 2 for Internode's NBN HFC.
auto eth1.2
iface eth1.2 inet manual

auto nbn
iface nbn inet ppp
    pre-up /bin/ip link set eth1.2 up
    provider nbn

Continue reading “Connecting to NBN HFC with a linux router”

Window titles in screen and urxvt, from vim

I previously posted about generating title escapes for screen and rxvt-unicode from zsh. I’ve since worked on getting a consistent title from vim, too. It’s become complex enough that I’m spinning it out into a new post.

To set both titles from vim, use its termcap-title options to push the title to screen using the iconstring. When not running under screen, the right titlestring escapes will be inferred from terminfo.

set title
auto BufEnter * let &titlestring = s:MyTitle()

if &term =~ 'screen\(\.\(xterm\|rxvt\)\(-\(256\)\?color\)\?\)\?'
  " Set the screen title using the vim "iconstring"."
  set t_IS=^[k
  set t_IE=^[\
  set icon
  auto BufEnter * let &iconstring = &titlestring
  " Set the xterm title using the vim "titlestring"."
  set t_ts=^[]2;
  set t_fs=^G
endif

where the underlined characters are actual escapes input with ^V, not with literal carets.

As for generating a fancy title string like vim: there are some gotchas. The biggest is that vim does not preserve logical directory names, so getcwd() will resolve symlinks, leading to a different location string than generated by zsh’s %~. Rather than call pwd -L, we might as well unify the expansion syntax and call zsh. Of course, it’s nice to have a fallback, too:

Continue reading “Window titles in screen and urxvt, from vim”

Disabling hyphen substitution in Adium

By default Adium replaces two hyphens with an em-dash in text you type or paste. This leads to subtly confusing behaviour when pasting commands:

foo --bar

becomes “foo —bar”, which can look very similar to foo --bar if your contact is using a terminal that supports variable-width glyphs for exotic character points.

It’s a quick fix: stop double-hyphens being transformed to a long dash by right clicking the Adium input field, and unticking Substitutions > Smart Dashes from the menu.