Giter Club home page Giter Club logo

zjunet's Introduction

zjunet

查看中文README

Command Line Scripts for ZJU (VPN / WLAN / DNS)

Features

  • ZJU VPN (l2tp)

  • ZJUWLAN

  • Router support

  • Overlap network dialing (with load balance)

  • Overlap bandwidth of ZJUWLAN and ZJU VPN (1 WLAN + N VPN, Using ZJUWLAN)

  • Automatic DNS setting (in case DNS do not work)

Requirements

  • xl2tpd

  • dig (Different package on different platform)

Installation

If you meet any problem during or after the installation, check Troubleshooting section below in this documentation.

Debian / Ubuntu (deb)

  1. Configure ZJU mirrors from manual. Ubuntu/Debian
  2. Run these command.
curl https://mirrors.zju.edu.cn/openzjunet/zjumirrors.pgp | sudo tee /etc/apt/trusted.gpg.d/zjumirrors.asc
curl https://mirrors.zju.edu.cn/openzjunet/zjunet.list | sudo tee /etc/apt/sources.list.d/zjunet.list
sudo apt-get update
sudo apt-get install zjunet
  1. The installation has completed.
  2. If you are setting up a server, we suggest you run zjunet wlan disable to disable WLAN capability.

Fedora / CentOS (rpm)

  1. Configure ZJU mirrors from manual. Fedora/CentOS

  2. Configure EPEL of ZJU mirrors (Taking CentOS installation as an example)

    1. Run yum install epel-release to install EPEL.
    2. Edit /etc/yum.repos.d/epel.repo , uncomment lines begin with #baseurl= (Remove leading # sign) and comment lines begin with mirrorlist= (Prepend # sign)
    3. Edit /etc/yum.repos.d/epel.repo , replace https://download.fedoraproject.org/pub with https://mirrors.zju.edu.cn .
  3. Run these command.

curl https://mirrors.zju.edu.cn/openzjunet/zjumirrors.pgp | sudo tee /etc/pki/rpm-gpg/RPM-GPG-KEY-ZJUMIRRORS
curl https://mirrors.zju.edu.cn/openzjunet/zjunet.repo | sudo tee /etc/yum.repos.d/zjunet.repo
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-ZJUMIRRORS
sudo yum install zjunet
  1. The installation has completed.
  2. If you are setting up a server, we suggest you run zjunet wlan disable to disable WLAN capability.

OpenWrt (opk)

Download .opk package from Release Page (onto your router), Run opkg install ./zjunet_<version>_all.opk.

Arch Linux (AUR)

Simply run yay zjunet to build the package from AUR and install it.

Keep in mind that a fresh install without internet connection is almost impossible. Please complete installation before connecting to the intranet.

Other Linux (Build from source code)

xl2tpd -v; dig -v # Check installation of dependencies. There should be 3 version numbers.
# Under proper directory
git clone https://github.com/QSCTech/zjunet.git
cd zjunet
sudo ./install.sh
# If update is necessary, run `git pull` and `sudo ./install.sh`
# If you are setting up a server, we suggest you run `zjunet wlan disable` to disable WLAN capability.

ATTENTION Requirement check will NOT be done running ./install.sh. Please run xl2tpd -v and dig -v to verify the installation.

Troubleshooting

Packet lose

This is a known issue. When overlapping VPN and ZJUWLAN, network packet may be lost. (because of nexthop in routing table).

Contributions to this issue are welcomed. (Maybe using iptables)

ppp0 may disappears on OpenWrt

Set lcp-echo-failure larger in /etc/ppp/options.

See also #39

Other problems?

Please send mail to [email protected] if you have any other problem.

Contribute to this project

QSCers may Push directly without sending Pull Requests。

Please write an Issue if you have worries. Contact maintainer directly if necessary.

PRs from non-QSCers are also welcomed.

Packaging Instruction

(Not finished yet)

Debian

sudo apt-get install build-essential autoconf automake autotools-dev dh-make \
  debhelper devscripts fakeroot xutils lintian pbuilder rpm
cd build
./build.sh
See Also

OpenWrt

See Also

Links

zjunet's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zjunet's Issues

路由表错误

zjunet all
Logout: 3120100260
Logout: success.
Login: 3120100260
Login: success.
[INFO] Logout: 3120100260
00 OK
Modem hangup
Connect time 0.7 minutes.
Sent 91248 bytes, received 163275 bytes.
Connection terminated.
[INFO] Setting up ip route.
default via 10.189.240.1 dev wlan0 
10.189.240.0/20 dev wlan0  proto kernel  scope link  src 10.189.244.238  metric 9 
[INFO] Login using 3120100260
01 Session 'zju-l2tp-3120100260' not up
00 OK
Using interface ppp0
Connect: ppp0 <--> /dev/pts/27
CHAP authentication succeeded
CHAP authentication succeeded
local  IP address 222.205.3.184
remote IP address 10.5.1.5
Bring up ppp, done.
[INFO] Setting up ip route.
default dev ppp0 
10.5.1.0/24 via 10.189.240.1 dev wlan0 
10.5.1.5 dev ppp0  proto kernel  scope link  src 222.205.3.184 
10.10.0.0/24 via 10.189.240.1 dev wlan0 
10.50.200.245 via 10.189.240.1 dev wlan0 
10.189.240.0/20 dev wlan0  proto kernel  scope link  src 10.189.244.238  metric 9 

路由器上第一次运行创建路径错误

root@OpenWrt:~/zjunet# ./install.sh
./install.sh: line 6: can't create /usr/local/bin/zjunet: nonexistent directory
./install.sh: line 7: can't create /usr/local/bin/zjunet: nonexistent directory
chmod: /usr/local/bin/zjunet: No such file or directory

ppp0 will disappear

xl2tpd version:  xl2tpd-1.3.6
Linux OpenWrt 3.3.8 #74 Sun Jun 23 12:52:20 CST 2013 mips GNU/Linux

dns备选方案更改

10.76.8.111
10.202.68.222

删除,并换为

10.202.68.43

因为原111已失效(硬盘挂,重装);222已不被使用(可能不属于我们;且可能被配置了iptables;状态未知)

Openwrt's $path

root@OpenWrt:~/zjunet# echo $PATH
/bin:/sbin:/usr/bin:/usr/sbin

wlan web adress question

I can't use your wlan script and I think the url may be wrong.
That's the url I get :
logout:
RESPONSE=$(curl "https://net.zju.edu.cn/cgi-bin/srun_portal" -H "Content-Type: application/x-www-form-urlencoded" -d "action=logout" -s | iconv -c -f gbk -t gbk)
login:
RESPONSE=$(curl "https://net.zju.edu.cn/cgi-bin/srun_portal" -H "Content-Type: application/x-www-form-urlencoded" -d "action=login&username=${USERNAME}&password=${PASSWORD}&ac_id=3&type=1&is_ldap=1&local_auth=1" -s | iconv -c -f gbk -t utf8)

Now available on QSC's linux repo

HERE:

http://dl.zjuqsc.com/linux/

(deb and rpm)

Usage:

wget -qO - https://dl.zjuqsc.com/linux/qsc.public.key | sudo apt-key add -
sudo wget https://dl.zjuqsc.com/linux/debian/qsc.list -O /etc/apt/sources.list.d/qsc.list
sudo apt-get update
sudo apt-get install zjunet

...

see README.md for detailed info

install.sh

cp *.sh -> /usr/local/lib
echo link > /usr/local/bin/zjunet

The availibilty of xl2tpd-control

It is a small wrap-up script (or bin?) around the control file (e.g. /var/run/xl2tpd/l2tp-control). Originally, xl2tpd is controlled by writing commands into the control file, the way kernel often uses in /proc/ and /sys/. Some distributions provide this handy tool, but others not.

If we echo strings to the control file directly, we can remove the dependency on xl2tpd-control.

关于 xl2tpd 的 restart

似乎必须要 restart 一次才能让新的配置生效的样子,
然后如果 restart 的话,control file就会丢失了。
所以应该在启动时,写入配置文件后,全局做一次 restart 吧?

用户管理

  • zjunet user add
  • zjunet user list
  • zjunet user delete
  • zjunet user edit

Static route list

A more comprehensive list can be found in my previous script: https://gist.github.com/Hexcles/5687169#file-vpn-sh-L31-L41

The main differences are:

  1. 58.* some classroom computers (especially East 6,7)
  2. 210.* the public CERNET IP of most ZJU servers, which can be reached directly in the Intranet. (Most of them do have a 10.* IP, but sometimes school DNS just returns the public ones.)

P.S. In ZJG dorm, only DNS and L2TP gateway servers can be reached directly: https://gist.github.com/Hexcles/6562821#file-vpn-dorm-sh-L35-L36

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.