rg_refresh
Execute a VLAN "flop" to allow the AT&T Residential Gateway (RG) to perform
802.1x authentication via the Optical Network Terminal (ONT) before falling
back to the subscriber's "own" router/gateway hardware. The RG is toggled off
and on as needed via a remote-controlled power outlet (see below).
For more information about this procedure, please see brianlan's original
document on DSL Reports.
Requirements
-
Netgear gigabit-speed "Smart Managed Plus" switch. The following models
are known to work:
Please submit a PR if you confirm another working model.
-
MQTT broker (like this one)
-
"Smart" outlet that can be remotely-controlled (i.e. set "on" or "off") via a
message published to a MQTT bus. For example:
-
Host (for the script) with:
- Ruby interpreter
- Access to the Netgear management console via HTTP
- Access to the MQTT broker via TCP/IP
N.B. With a SmartThings- or other cloud-based solution, an Internet
connection is required to perform the VLAN flop, so if the operation fails
(or is attempted after your router has already lost its DHCP lease), your
network may get stuck in an inconsistent state. To recover, run the script
and toggle the RG power manually as indicated.
Installation
Follow the guide to establish the initial network environment, which
includes copying information from the RG to your own router. You should perform
the VLAN flop one time through by hand to make sure everything is set up and
working correctly. Jot down your VLAN IDs and port assignments for later.
Next, pick a server where the script will run and install it:
$ gem install rg_refresh
Create a configuration file and write it somewhere sensible, e.g.
/etc/rg_refresh.yml
, using the following template:
---
:netgear:
:address: 'http://a.b.c.d'
:password: password
:vlans:
:rg: 2
:my_router: 3
:ports_vlans:
:reauth: [.rg, .rg, .my_router]
:bypass: [.my_router, .rg, .my_router]
:mqtt:
:client:
:host: localhost
:port: 1883
:topic: smartthings/RG/switch
:messages:
:reauth: 'on'
:bypass: 'off'
Run the script to make sure it works correctly, passing in the path to the
configuration file created above. For example:
$ rg_refresh -c /etc/rg_refresh.yml
Finally, schedule the script to run once a week or so, during off-hours,
and/or when your router loses its DHCP lease.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run
rake test
to run the tests. You can also run bin/console
for an interactive
prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To
release a new version, update the version number in version.rb
, and then run
bundle exec rake release
, which will create a git tag for the version, push
git commits and tags, and push the .gem
file to
rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at
https://github.com/mwpastore/rg_refresh.
License
The gem is available as open source under the terms of the MIT
License.