北郵的校園網(wǎng)是需要登錄網(wǎng)關(guān)的股耽,有圖形化界面的話女轿,直接用瀏覽器打開 10.3.8.211 即可丹鸿。但是當 Linux 機器還沒有圖形界面時贪染,需要用命令行來登錄網(wǎng)關(guān)缓呛。因為登錄和登出網(wǎng)關(guān)分別對應(yīng) POST 和 GET 請求。所以用 curl 命令即可解決杭隙。
登錄
student_id 替換成學號哟绊,password 替換成網(wǎng)關(guān)密碼。
curl 'http://10.3.8.211' --data "DDDDD=student_id&upass=password&0MKKey="
校園網(wǎng)的新網(wǎng)關(guān) http://ngw.bupt.edu.cn 的登陸方法的稍有不同痰憎。我選用的運營商是中國聯(lián)通票髓。
curl 'http://10.3.8.217/login' --data 'user=student_id&pass=password&line=CUC-BRAS'
如果是中國移動攀涵,那就把參數(shù)中的 line 改成 CMCC-BRAS。
退出
curl http://10.3.8.211/F.htm
新網(wǎng)關(guān)的退出洽沟。
curl -L http://10.3.8.217/logout
開機自啟
在 /etc/profile.d
文件夾中新建文件 login-bupt-network.sh
以故,這樣每次開機就會自動執(zhí)行 profile.d 文件夾所有的 shell 腳本。
curl 'http://10.3.8.211' --data "DDDDD=student_id&upass=password&0MKKey=" > /dev/null 2>&1