加入 DN42 实验网络

P.S. 注册流程参考了 Lan Tian 的文章:DN42 实验网络介绍及注册教程(2022-06 更新) | Lan Tian @ Blog

本文仅作个人记录使用,内容不是特别详尽,建议根据 原文步骤 及 官方Wiki 进行操作。

What’s DN42 ?

dn42 is a big dynamic VPN, which employs Internet technologies (BGP, whois database, DNS, etc). Participants connect to each other using network tunnels (GRE, OpenVPN, WireGuard, Tinc, IPsec) and exchange routes thanks to the Border Gateway Protocol. Network addresses are assigned in the 172.20.0.0/14 range and private AS numbers are used (see registry) as well as IPv6 addresses from the ULA-Range (fd00::/8) - see FAQ.

A number of services are provided on the network: see internal (only available from within dn42). Also, dn42 is interconnected with other networks, such as ChaosVPN or some Freifunk networks.

Via Home (dn42.dev)

DN42是一个大型的 VPN 网络,能够模拟一个真实的网络环境,我们可以在DN42网络上尝试各类网络技术并不用担心破坏公网环境。

简而言之,DN42:

  • 不适合单纯想要保护隐私、规避网络审查的用户
  • 不适合在网内消耗大量流量,例如用于解锁流媒体服务的用户
  • 适合想要研究网络技术,练习服务器、路由器等网络设备配置,甚至后续在真实互联网建立 AS 的用户
  • 适合拥有真实 AS,但担心自己配置错误广播出错误路由、干掉半个互联网,希望有个地方测试的用户。

Via Lan Tian @ Blog

在注册之前,你需要拥有以下环境/条件:

  • Linux 环境(非必须,但如果使用 Windows 的话容易遇坑),并懂得 Linux 操作系统的基本操作,如果一定要用 Windows ,请使用 WSL2
  • Git 基本命令及操作流程
  • 一定的网络基础
  • 一定的英语阅读能力
  • 充足的耐心

Get Start

本文操作均在 Ubuntu 22.04 LTS 下进行。

  1. 首先在官方Gitea https://git.dn42.dev 注册账户,DN42的Whois信息采用 Git仓库 管理,所有的信息均存储在其中(类比APNIC 、RIPE 的 whois)。

  2. 注册完成后,fork 仓库:https://git.dn42.dev/dn42/registry,并将**fork完的仓库 **clone至本地。(由于 Windows 的路径规范与Linux不同,若这里使用 Windows 系统可能无法成功克隆仓库。)

  3. 在本地创建一系列必要文件:

    1. 创建 data/mntner/PGDN-MNT下文中类似 PGDN-MNT 的等信息以及IPv4、IPv6段已被我所使用,请务必修改为自己的!

      该文件用于指定 maintainer,类似于管理员的概念,以下是我注册时所创建的内容,做个参考:

      1
      2
      3
      4
      5
      6
      7
      mntner:             PGDN-MNT
      admin-c: PGDN-DN42
      tech-c: PGDN-DN42
      mnt-by: PGDN-MNT
      source: DN42
      auth: pgp-fingerprint 814E88BF454C2524462C959E2E800966FF4DDDA7
      remarks: PGDN DN42 MNT

      各项的具体含义请参考 Lan Tian @ Blog ,这里不做赘述。

      auth:你的个人认证信息,可选 SSH KEY 或者 GPG KEY。

      讲一下添加GPG的流程:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      # 1. 生成新的key
      # 按照提示生成key即可,注意密码要长度大于 4096 bit(默认为3072)
      # 生成过程中需要提供一个安全密码,务必记住,后续提交commit签名需要使用
      gpg --full-generate-key

      # 2. 生成key之后,查看密钥信息:
      gpg --list-secret-keys --keyid-format=long

      # 如下示例:
      # 2E800966FF4DDDA7 为 uid hash
      # 814E88BF454C2524462C959E2E800966FF4DDDA7 为全40位gpg密钥
      #------------------------
      #sec rsa4096/2E800966FF4DDDA7 2022-07-24 [SC]
      # 814E88BF454C2524462C959E2E800966FF4DDDA7
      #uid [ultimate] iRaee (iRaee DN42 Repo GPG) <[email protected]>
      #ssb rsa4096/692FEC70A9A6B207 2022-07-24 [E]

      # 3. 为 git 添加 gpg签名密钥
      git config --global user.signingkey 2E800966FF4DDDA7

      # 4. 更新bash环境:
      [ -f ~/.bashrc ] && echo 'export GPG_TTY=$(tty)' >> ~/.bashrc
      export GPG_TTY=$(tty)

      # 5. 将 GPG 公钥上传至公共查询服务器:
      gpg --keyserver hkp://keyserver.ubuntu.com --send-key 2E800966FF4DDDA7

      # 6. 在 https://git.dn42.dev 添加 GPG 公钥(如果做了第五步,这一步似乎是非必须的,但还是推荐添加一份,这里不做说明)
    2. 创建 data/person/PGDN-DN42 ,该文件代表我们的个人信息。

      注意上一步中的 admin-ctech-c 字段需要与其对应。

      1
      2
      3
      4
      5
      person:             PGDN
      e-mail: [email protected]
      nic-hdl: PGDN-DN42
      mnt-by: PGDN-MNT
      source: DN42
    3. 创建 data/aut-num/AS4242421741,选择你的ASN,可以在 https://explorer.burble.com/#/ 这里找到还未被使用的ASN、IPv4、IPv6。

      1
      2
      3
      4
      5
      6
      7
      aut-num:            AS4242421741
      as-name: PGDN-AS
      descr: Peer with me at [email protected]
      admin-c: PGDN-DN42
      tech-c: PGDN-DN42
      mnt-by: PGDN-MNT
      source: DN42
    4. 创建 data/inetnum/172.23.104.192_26,挑选心仪的IP,可以在 https://explorer.burble.com/#/ 这里找到还未被使用的ASN、IPv4、IPv6。

      这里注意下文件名格式为: <ip_subnet>_<cidr>

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      inetnum:            172.23.104.192 - 172.23.104.255
      netname: PGDN-NET-172-23-104-192-26
      remarks: Peer with me at [email protected]
      descr: Peer with me at [email protected]
      country: US
      admin-c: PGDN-DN42
      tech-c: PGDN-DN42
      mnt-by: PGDN-MNT
      status: ASSIGNED
      cidr: 172.23.104.192/26
      source: DN42
    5. 创建 data/route/172.23.104.192_26, ipv4 route object,申明合法的 origin as。

      1
      2
      3
      4
      5
      route:              172.23.104.192/26
      descr: Peer with me at [email protected]
      origin: AS4242421741
      mnt-by: PGDN-MNT
      source: DN42
    6. 创建 *data/inet6num/fdde:6353:c2e9::_48*,挑选ipv6。如果不想使用ipv6可以不添加。可以在 https://explorer.burble.com/#/ 这里找到还未被使用的ASN、IPv4、IPv6。

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      inet6num:           fdde:6353:c2e9:0000:0000:0000:0000:0000 - fdde:6353:c2e9:ffff:ffff:ffff:ffff:ffff
      netname: PGDN-IPV6
      descr: Peer with me at [email protected]
      country: US
      admin-c: PGDN-DN42
      tech-c: PGDN-DN42
      mnt-by: PGDN-MNT
      status: ASSIGNED
      cidr: fdde:6353:c2e9::/48
      source: DN42
    7. 创建 data/route6/fdde:6353:c2e9::_48,ipv6 route object,和 v4 的作用相同。

      1
      2
      3
      4
      5
      route6:             fdde:6353:c2e9::/48
      descr: Peer with me at [email protected]
      origin: AS4242421741
      mnt-by: PGDN-MNT
      source: DN42
  4. 到此为止我们创建了所有必要文件,接下来将其提交至仓库:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # 添加新增文件至git暂存区
    git add .

    # 使用 gpg commit
    # 如果你先前 commit 了多次,你需要把所有变更合并到一次 commit 里,直接运行 Registry 根目录下的 ./squash-my-commits 脚本即可。
    git commit -S -m "<message>"

    # 由于你操作期间 Registry 可能有来自其他人的变更,你需要获取一下 Registry 的更新

    # 将修改上传到 Git 服务器
    git push -f
  5. 来到官方repo:https://git.dn42.dev/dn42/registry ,创建 pull request,等待dn42的维护人员merge你的仓库即可。若创建的文件有误,管理员会回复你的 Pull Request,根据他们的要求修改即可。发 Pull Request 请用英文!

    不出意外很快就会被自动审查程序approve,然后等待merge即可。根据观察,似乎都在每天的0点(UTC时间)更新。

我的 request 很快就被通过了


加入 DN42 实验网络
http://example.com/2022/07/24/加入 DN42 实验网络/
作者
Rae
发布于
2022年7月24日
许可协议