这个程序用来在命令行下控制天翼网关路由器的一些常用配置。
$ ./gpon-client
A GPON (Tiānyì Gateway) client used to modify router configurations.
Usage: ./gpon-client command [sub-command] [<arguments>...]
All Available Command List:
reboot
portmaps list
portmaps create <name> <protocol> <outer-port> <inner-ip> <inner-port>
portmaps delete <name>
portmaps enable <name>
portmaps disable <name>
请先在命令行下导出几个环境变量。
# 路由器IP地址,默认 192.168.1.1
$ export IP=192.168.1.1
# 路由器用户名,默认 useradmin
$ export USERNAME=useradmin
# 路由器密码,无默认
$ export PASSWORD=
$ PASSWORD=XXOO ./gpon-client reboot
$ ./gpon-client portmaps list
ID Name Protocol OuterPort InnerIP InnerPort Enable
-----------------------------------------------------------------------------------
1 test BOTH 4321 192.168.1.6 1234 1
2 nginx TCP 8888 192.168.1.6 8888 1
3 ssh TCP 10022 192.168.1.6 22 1
4 bt BOTH 8999 192.168.1.6 8999 1
5 https TCP 443 192.168.1.6 443 1
$ ./gpon-client portmaps create nginx BOTH 443 192.168.1.6 443
$ ./gpon-client portmaps delete nginx
$ ./gpon-client portmaps enable nginx
$ ./gpon-client portmaps disable nginx
Copyright (C) 2019 movsb