2013-05-13
LUG展板文案草稿

GNU (GNU’s Not Unix) 计划

由 Richard Stallman 在1983年9月27日公开发起的,目标是创建一套完全自由的操作系统。GNU 项目贡献了很多一流的软件,包括 GCC、Emacs 等。

Read More

2013-05-12
多线接入主机上的诡异NAT

昨天,mirrors.ustc.edu.cn 遇到了一件诡异的事情。mirrors 有三条接入线路,IP分别是 202.38.95.110,202.141.160.110,202.141.176.110。mirrors-lab 是 mirrors 上的一台 LXC 虚拟机,有三个IP:10.8.95.2,10.8.140.2,10.8.10.2。

在 mirrors 主机上,配置了 iptables 将主机上的 50000~51000 端口直接映射到虚拟机内:

1
2
3
-A PREROUTING -p tcp -d 202.38.95.110 -m multiport --dports 50000:50100 -j DNAT --to 10.8.95.2
-A PREROUTING -p tcp -d 202.141.160.110 -m multiport --dports 50000:50100 -j DNAT --to 10.8.10.2
-A PREROUTING -p tcp -d 202.141.176.110 -m multiport --dports 50000:50100 -j DNAT --to 10.8.140.2

在虚拟机的 50000 端口运行了 rsync daemon,但只有 rsync://202.38.95.110:50000 能够访问,另外两个IP都是超时。诡异的是,我们在 mirrors 虚拟机和主机上用 tcpdump 抓包,看起来 SYN 已经收到,ACK 包也已经送出。tcpdump 抓入站包是在 netfilter 之前,我们抓的是物理网卡 eth0,入站包在被抓到时应该还没到 iptables,出站包在被抓到时已经通过了 iptables。更诡异的是,在与 mirrors 同属于一个网段的 blog 服务器上,三个IP访问都是正常的。为什么回复包发不出局域网呢?

Read More

2013-03-19
关于开源软件镜像联盟(技术篇)

请先阅读:关于开源软件镜像联盟(非技术篇),谢谢

一、DNS or 301?

Update: 之前我对DNS的CNAME理解错误,现在更正。参考文献:https://tools.ietf.org/html/rfc3568

DNS方案(如果说得不对欢迎拍砖):

  1. 每个镜像分配一个二级域名,以便分别调度;NS记录设置为主站

  2. 用户从运营商DNS查询IP

  3. 主站根据来源IP(运营商DNS的IP)返回一个或多个镜像节点的IP地址

  4. 运营商DNS把这个IP返回给用户,同时缓存一定期限

  5. 用户与镜像节点建立连接,进行下载
    301方案:

  6. 域名A记录解析到主站

  7. 用户与主站建立连接,发起HTTP请求

  8. 主站根据用户来源IP返回HTTP 301状态,跳转到一个镜像节点

  9. 用户与这个镜像节点建立连接,进行下载

Read More

2013-03-19
关于开源软件镜像联盟(非技术篇)

Terminology: (好蛋疼啊,感觉挺别扭的)

  • 镜像:Ubuntu, CPAN, PyPi之类的
  • 镜像站:一个高校的开源镜像站,每个镜像站做了若干镜像
  • (镜像)节点:同时做了一个镜像的各镜像站

镜像联盟维护者:

仿照Debian的开发模式,镜像联盟维护者可以分为Mirrors Maintainer和Mirrors Developer。Mirrors Developer是拥有镜像联盟主站维护权限和决策投票权的核心开发人员;参与镜像联盟开发、镜像维护的均可申请成为Mirrors Maintainer。

Read More

2012-11-26
世界,你好!

欢迎使用USTC Blog。USTC Blog在千呼万唤之后,终于上线了!这是一个值得庆贺的时刻,但也意味着我们今后几天将与bug和feature进行持续斗争。

YY一下,什么时候blog能到下面这张图的访问量呢?

上图是mirrors.ustc.edu.cn的流量图

Read More

2012-11-26
Projects

This page has moved to 01.me/research. Redirecting…

Read More

2012-11-26
Freeshell: Elastic and Efficient Container Cloud

Container is an emerging lightweight virtualization technology, and a way to encapsulate software dependencies and simplify deployment. When we started to build Freeshell in 2012, Docker was premature and the dominant container technology was OpenVZ. So we built Freeshell, an elastic and efficient container cloud with OpenVZ. Freeshell attracted 2,000+ users in USTC campus. Our carefully tuned system consolidated 1,000+ active containers into 8 servers.

Freeshell offers multiple pre-created OS images, including Debian, Ubuntu, CentOS, Archlinux and more Linux distributions. To consolidate disk storage of multiple containers, we store the file system of each container as the delta of the base image, and AUFS provides transparency to applications.

Read More

2012-11-26
LUG VPN: A Smart Global VPN Network from Everywhere to Everywhere

Although Internet is designed to be end-to-end, not all IP addresses are reachable from everywhere due to NAT, firewall, organizational policies and other network middleboxes. Additionally, direct routing is possibly not the best path due to ISP QoS policies and limited interconnect bandwidth between some ASes. Furthermore, TCP Cubic congestion control performs notably bad on long fat pipes with occasional packet loss.

Since 2013, we design, deploy and operate a global VPN network to enable USTC students to efficiently access every host across the Internet from any network location. LUG VPN has over one thousand users, serving about one terabyte of network traffic every day via tens of servers in global datacenters.

Different from traditional VPNs where the user connects to a gateway server and the server directly accesses the Internet, LUG VPN forwards traffic among gateway servers and finds an optimal server to access the destination host. Consequently, there are two or three hops from a VPN user to the destination host: from the user to an access gateway server, from the access gateway to an egress gateway (this hop is optional), and from the egress gateway to the destination host. By adding an additional hop, LUG VPN has the freedom to optimize the tunnel between access gateway and egress gateway to bypass firewalls and improve QoS.

To use a best egress gateway from an access gateway to a destination, we use GeoIP based strategy. First, we run a recursive DNS server on each access gateway to resolve users’ DNS requests, so that if a multi-homed website uses GeoIP based authoritative DNS server, it can return IP addresses close to the access gateway. Second, a GeoIP based routing table is configured on each access gateway to route IP packets (including DNS packets) directly to the destination or via a tunnel to an egress gateway. To make the routing decision for every pair of geographic regions, we use periodic probing to find the latency and bandwidth for each route, i.e. pass through an egress gateway or direct route. In addition, we have some rules to exclude certain routes in order to bypass content-based firewalls as well as comply with copyright restrictions. Among all candidate routes, we first find the best route with lowest latency and highest bandwidth, then find other candidate routes whose latency and bandwidth are close to the best route. To load balance traffic among egress gateways, we use weighted round robin to route connections via all candidate routes.

To ensure efficient forwarding between access and egress gateways, we create multiple tunnels between each pair of gateways using different tunneling technologies. Some are standard tunneling protocols (e.g. GRE). Others disguise the tunnel as another protocol (e.g. HTTPS) to bypass protocol filters and improve QoS priority in ISP network. If one tunneling technology is blocked, the system automatically switches to another. To reduce TCP handshake latency, we terminate TCP connections at both access and egress gateways, so that each TCP connection is broken into three relayed TCP connections. For the tunnel connection between access and egress gateways, we deploy multiple WAN optimization techniques, including loss-agnostic congestion control, FEC (forward error correction) on lossy links and compression.

The user can access the VPN by connecting to any of the public gateway servers via multiple protocols, including IPSec, OpenVPN, PPTP, L2TP, ShadowSocks, Socks5, IP over DNS and HTTP(S) proxy. In order to enable the user to access a nearby gateway server, the user specifies a domain name, and our authoritative DNS server resolves it to the IP address of a closest gateway server based on the GeoIP location of the user’s IP. Using DNS also adds another layer of indirection for the system to automatically remove access gateways that fail or overload.

To authenticate users, we deploy a LDAP system that integrates with the access gateways and develop a Web-based application system. To recover from failures automatically, the servers monitor each other via periodic tunnel ping probing and exchange results. If more than half of peer servers find a server fails, the peer servers issue a remote reboot command via management API (for cloud servers) or IPMI (for bare-metal servers). To enable users to only route a range of destination hosts via VPN, we offer multiple configuration options in the software.

LUG VPN offers good reachability and performance in multiple usage scenarios. First, users with limited Internet access can access all sites. Second, users outside the campus can access the campus Intranet. Third, users outside the campus can access scholarly articles that is only available for campus IP addresses. Fourth, with WAN optimization, users experience much better throughput and latency, especially for international traffic. Additionally, users use LUG VPN to interconnect devices behind NAT and firewall.

Read More
RSS
▲