RG100A-AA 中大校园网上网及远程配置

  由于无线网卡用得不爽,wifi经常断,所以想整个路由器,造福群众。在朋友介绍下购得一台已经刷好 Openwrt 的上海贝尔RG100A-AA路由器,根据下面的简单步骤,就能连接上校园网。

一、准备工作

  1.一电脑,系统windows和Linux都行。windows要有可以远程linux的软件(putty、Xshell)

  2.两网线,一根连路由器(lan4)和墙上网络端口,一根连路由器(lan1/2/3)和电脑

二、配置network

  1. 先远程进入路由器:本人是在windows操作的,使用的是Xshell,连的是路由器发出的wifi(OpenWrt-DreamBox),命令:ssh root@192.168.1.1。

  2. 复制下面的文本,并覆盖到/etc/config/network,重启网络服务,可能会断开ssh连接。

  建议:先将该network文件以及下列步骤中的cp.ipk 和nj.ipk拷进u盘,再将u盘插到路由器上,再进入挂载点/mnt/sda1拷贝进路由器。

config 'interface' 'loopback'
    option 'ifname' 'lo'
    option 'proto' 'static'
    option 'ipaddr' '127.0.0.1'
    option 'netmask' '255.0.0.0'

config 'switch' 'eth1'
    option 'reset' '1'
    option 'enable_vlan' '1'

config 'switch_vlan'
    option 'device' 'eth1'
    option 'vlan' '0'
    option 'ports' '0 1 2 5*'

config 'switch_vlan'
    option 'device' 'eth1'
    option 'vlan' '1'
    option 'ports' '3 5*'

config 'interface' 'lan'
    option 'type' 'bridge'
    option 'ifname' 'eth1.0'
    option 'proto' 'static'
    option 'netmask' '255.255.255.0'
    option 'nat' '1'
    option 'ipaddr' '192.168.1.1'

config 'interface' 'wan'
    option 'ifname' 'eth1.1'
    option 'proto' 'dhcp' 

三、安装njit-client

  1.安装libcap:libcap是njit-client 的依赖包,下载 cp.ipk并传输到路由器内,使用opkg install cp.ipk安装。

  2.安装njit-client:下载 nj.ipk,传输到路由器内,使用opkg install nj.ipk 安装。可在这里下载。(感谢@灵动grace提供)

四、测试连接校园网

  网线接lan4,在ssh终端中输入:

njit-client inode账号 inode密码 eth1.1 & 

  看是否能正常拨号,并测试网页是否能打开。

五、设置开机自启动校园网连接

  打开/etc/rc.local,修改如下

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

(njit-client inode账号 inode密码 eth1.1) & 
exit
0

理论上,到这里你就能正常的上网了^0^,以上内容参考自大神的博客:Gracece Blog.

当然电脑少不了远程嘛,要怎么从实验室、教学楼、图书馆远程宿舍电脑呢?继续看下去....

六、路由器端口映射

      Attention: 小伙伴,请把你电脑的防火墙关了~~

  为了从外面远程宿舍电脑,需对路由器端口进行映射。在浏览器中输入:http://192.168.1.1/可进入路由器管理页面,初始用户为root,密码admin。

  进入“网络”->“端口映射”,添加一下几条记录:其中外部端口是远程时使用的端口(可自己设定),内部端口是本机端口,22为linux远程端口,3389为windows远程端口。

  从其他地方远程宿舍电脑时,若为linux,命令为: ssh IP地址:9999;  windows请打开远程桌面连接,输入:IP地址:4000。(此处的IP地址为路由器ip,进入路由器输命令ifconfig,eth1.1 对应IP为路由器IP)。

  基本内容到此结束!感谢小伙伴Grace、Gavin、Gccon支持。

原文地址:https://www.cnblogs.com/chenbjin/p/3458705.html