Skip to content

About

System-wide, automatic college proxy for MNNIT Allahabad (Linux) - mihomo TUN powered. One command setup for Arch & Ubuntu with per-hostel static IP, proxy failover and LAN auto start/stop.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

mnnit-proxy

tests

System-wide college proxy for MNNIT Allahabad - works for ALL apps, no per-app setup.

Powered by mihomo (TUN mode) - like Proxifier on Windows, but for Linux.
Supports Arch, Fedora/RHEL-family and Debian/Ubuntu (x86_64 / arm64).

Quick start

On campus (LAN plugged in)

curl -fsSL https://raw.githubusercontent.com/CC-MNNIT/mnnit-proxy/main/install.sh | sudo bash

If GitHub is blocked on campus, use the proxy to fetch the script:

curl -x http://edcguest:edcguest@172.31.100.25:3128 -fsSL \
  https://raw.githubusercontent.com/CC-MNNIT/mnnit-proxy/main/install.sh | sudo bash

What happens

  1. You pick your hostel from a list
  2. It prints the official PDF link with room-wise IPs - open it on your phone
  3. Enter your room IP → installer sets up everything
  4. After success, every app on your laptop goes through the college proxy automatically

On laptops with more than one Ethernet adapter, pass --interface en... if the installer cannot identify the campus cable unambiguously.

After install

  • mnnit-proxy-update - change hostel/IP, restore DHCP, toggle LAN auto-watch
  • Re-run install.sh - shows a menu (install / update / diagnose / uninstall)

What won't work

Feature Why Alternative
ping ICMP can't pass HTTP proxy curl https://google.com
traceroute same -
Discord voice / online games UDP required TCP-only proxy
Torrents / P2P UDP + inbound blocked -
QUIC (HTTP/3) uses UDP Browser auto-falls back to TCP

Everything else (browsers, git, curl, npm, pip, SSH, apt, pacman, etc.) works in ALL apps.

Seeing a Meta network device? That's normal - it's mihomo's TUN interface doing the proxying (same idea as tailscale0). Don't delete or edit it; it appears/disappears with the proxy.

Hostel IP allotment PDFs

Hostel PDF Link
New Boys A Block PDF
New Boys B Block PDF
New Boys C Block PDF
SVBH PDF
PG Hostel PDF
Patel Hostel PDF
Tilak Hostel PDF
Malviya Hostel PDF
Tandon Hostel PDF
Tagore Hostel PDF
Raman Hostel PDF
KN Girls Hostel PDF
SN Girls Hostel PDF
DJ Girls Hostel PDF
International Hostel PDF
Colony & Quarters PDF

Full list: MNNIT Computer Centre - IP Address Scheme

Manual setup

If the installer doesn't work for your distro or network:

  1. Install mihomo (Arch: paru -S mihomo; Ubuntu/Fedora/RHEL: download binary from GitHub releases)
  2. Copy config.template.yaml to /etc/mihomo/config.yaml and fill in proxy IPs
  3. Set static IP via nmcli (see hostels.tsv for your hostel's gateway/subnet)
  4. sudo systemctl enable --now mihomo

Troubleshooting

Run sudo bash install.sh --diagnose first - it prints service state, config validity, interface/gateway info and per-proxy reachability.

"No NetworkManager connection profile found" NetworkManager has no Ethernet profile (common on fresh Ubuntu where the cable was never plugged in). v1.3.0 creates a dedicated mnnit-campus-<interface> profile and remembers its UUID; it no longer overwrites an unrelated wired profile.

"NetworkManager not found" (Ubuntu Server / minimal) The installer checks your network backend up front:

  • NetworkManager active → full auto (static IP + LAN watcher)
  • netplan present (no NM) → it writes /etc/netplan/99-mnnit-proxy.yaml with your room IP, applies it and verifies. The LAN watcher is unavailable (it depends on NM), so mihomo auto-starts at boot instead - stop it off-campus with sudo systemctl stop mihomo
  • neither → it prints a complete copy-paste block with your values filled in

If an existing netplan file already manages your interface, the installer never touches it - it prints the values to add manually instead.

Missing requirements (curl/python3/iproute2/systemd/coreutils) are checked before anything else and the installer exits with the exact install command for your distro.

Arch/AUR: unexpected EOF from aur.archlinux.org

Some campus proxies accept CONNECT aur.archlinux.org:443 but stall on CONNECT <resolved-IP>:443. v1.3.0 enables HTTP/TLS domain sniffing so TUN traffic retains its hostname. Verify with paru -Si paru; the mihomo log should show aur.archlinux.org:443, not only its IP address.

Works with the cable unplugged but fails when Wi-Fi is also enabled

NetworkManager may add a temporary +20000 metric penalty to the campus route. v1.3.0 pins mihomo's outbound to the selected Ethernet interface and installs a specific 172.31.0.0/16 campus route; it never rewrites saved Wi-Fi profiles. The default TUN stack is gvisor for broad kernel/firewall compatibility. Use --tun-stack system if the kernel stack is known to work better on your host.

IPv6 warning: the current campus setup proxies IPv4 TUN traffic. If a simultaneously connected Wi-Fi network supplies an IPv6 default route, disable Wi-Fi/IPv6 while using the campus proxy; diagnostics flag this condition rather than reporting a false all-clear.

Arch (AUR): "permission denied" reading /etc/mihomo/config.yaml

The AUR mihomo package runs the daemon as a dedicated mihomo user. Installs from v1.2.0 or earlier left the config root:root 600, so the service could not read it. v1.2.1+ fixes ownership automatically during install and on every config change. Manual fix for existing installs:

sudo chown root:mihomo /etc/mihomo/config.yaml
sudo chmod 640 /etc/mihomo/config.yaml
sudo chown mihomo:mihomo /etc/mihomo   # mihomo writes cache.db here

Uninstall

sudo bash install.sh --uninstall

All flags (install.sh)

Flag Behavior
--hostel "Name" --ip IP --yes Fully unattended install (skips all prompts)
--force Proceed even if IP is outside the documented range
--gateway IP Override the derived gateway (e.g. SVBH floor-wise subnets)
--skip-ip Don't touch nmcli/network settings (CI, self-managed)
--no-tun Proxy port only, no TUN device (CI/VM friendly)
--no-lan-watch Don't install the LAN auto start/stop watcher
--interface IFACE Pin campus routing and mihomo outbound to this Ethernet interface
--tun-stack STACK Select gvisor (default), system, mixed, or mips
--uninstall Remove everything, restore DHCP
--diagnose Run diagnostics

update.sh actions: --action change-ip --hostel N --ip IP --yes · --action dhcp · --action status · --action watch

Tests

bash tests/unit-tests.sh          # syntax, shellcheck, function tests (no root)
sudo bash tests/integration-test.sh   # full unattended install + proxy e2e (Debian/Ubuntu)
bash tests/docker-ubuntu.sh       # same, inside a systemd-enabled Ubuntu container
bash tests/docker-fedora.sh       # same, inside a systemd-enabled Fedora container
bash tests/run-tests.sh arch      # Arch binary-install path (root/container)

CI runs the same tests on every push: Ubuntu 22.04 + 24.04 (tinyproxy stands in for the college proxy with the same Basic-auth mechanics), a Fedora container for the RHEL-family path, plus an Arch container for the binary-install path.

Structure

├── install.sh                  # Complete installer with menu
├── update.sh                   # Fast path: change hostel/IP, restore DHCP
├── config.template.yaml        # Mihomo config template
├── hostels.tsv                 # Hostel data (subnets, gateways, proxies, PDF links)
├── dispatcher/
│   └── 90-mihomo-lan          # NetworkManager dispatcher for LAN auto-watch
└── LICENSE

How it works

mihomo creates a TUN virtual network interface. auto-route makes IPv4 traffic go through it. HTTP Host/TLS SNI sniffing preserves destination hostnames for campus proxy CONNECT requests. mihomo then checks the rules:

  • Private IPs (10/8, 172.16/12, 192.168/16) → DIRECT (bypasses proxy, stays on campus LAN)
  • Everything else → through the college proxy (fallback over 3 proxies)

The route-exclude-address blocks in the TUN config prevent mihomo's own proxy connections from looping back into the TUN. The managed wired profile also has a specific 172.31.0.0/16 route, so campus proxy and DNS traffic cannot accidentally leave over Wi-Fi.

The LAN auto-watch script (90-mihomo-lan) monitors carrier plus a campus address (172.31.*): when you plug into campus LAN, mihomo starts; when you unplug, it stops - so hotspot at home just works.

Downloaded mihomo binaries are accepted only after their SHA-256 digest matches GitHub's release metadata (or the hard-coded digest for the pinned fallback).

About

System-wide, automatic college proxy for MNNIT Allahabad (Linux) - mihomo TUN powered. One command setup for Arch & Ubuntu with per-hostel static IP, proxy failover and LAN auto start/stop.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages