# 使用 Homebrew, apk, MacPorts, Nix 安装 vpn-slice

查看 vpn-slice 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:vpn-slice
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install vpn-slice
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install vpn-slice
```

  证据: MacPorts ports tree: net/vpn-slice/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add vpn-slice
```

  证据: Alpine Linux edge package indexes: vpn-slice from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Nix (92%):

```sh
nix profile install nixpkgs#vpn-slice
```

  证据: nixpkgs package indexes: pkgs/by-name/vp/vpn-slice/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:vpn-slice
- **软件包管理器:** Homebrew
- **版本:** 0.16.1
- **来源摘要:** Vpnc-script replacement for easy and secure split-tunnel VPN setup
- **主页:** <https://github.com/dlenski/vpn-slice>
- **仓库:** <https://github.com/dlenski/vpn-slice>
- **最后更新:** 2026-07-10T10:09:48-04:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- vpn-slice (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.16.1
## 项目历史与用法

vpn-slice is a Python replacement for the vpnc-script hook used by OpenConnect and VPNC. Its purpose is split-tunnel VPN setup: route only selected hosts or subnets through the VPN while leaving ordinary network traffic on the normal interface.

### 项目历史

The project grew out of a long-standing OpenConnect/VPNC architecture in which the VPN client handles the tunnel connection but delegates operating-system routing and DNS changes to an external script, traditionally called vpnc-script.

vpn-slice's README presents it as a deliberate alternative to corporate-VPN behavior that reroutes all traffic through the tunnel. It credits an earlier split-tunnelling tutorial for the basic approach, sshuttle's host-discovery options for inspiration, and a community pull request for cleaner OS-dependent separation and macOS support.

### 采用历史

The OpenConnect project documents vpn-slice as an alternative script written by one of the OpenConnect developers, focused on limiting VPN-routed traffic to a specific subset. That gives vpn-slice a recognized niche among OpenConnect users who need client-side split tunneling even when the VPN server or corporate client defaults to full-tunnel routing.

Package listings in ecosystems such as PyPI, MacPorts, Alpine, and FreeBSD ports reflect practical adoption by users who combine OpenConnect with scripting-friendly network setup. Its adoption is niche, but the niche is clear: developers and administrators forced to use restrictive VPNs while preserving local Internet routing.

### 使用方式

Users invoke vpn-slice as the OpenConnect or VPNC script hook and pass the hosts, domains, or subnets that should be reachable through the tunnel. The tool can resolve named hosts using VPN DNS servers, write temporary host entries, and avoid broad resolver changes outside the VPN slice.

The tool is not intended for privacy VPN use cases where all traffic should go through the tunnel. Its README explicitly frames the use case as minimizing exposure to monitored or filtering corporate VPN networks.

### 为什么软件包爱好者会关心

vpn-slice is the kind of small Unix networking tool package managers preserve well: one command that fills a very specific gap between a general VPN client and local routing policy.

Its value is highest for people who already know OpenConnect, vpnc-script, route tables, and DNS side effects; for those users it replaces a fragile personal shell-script wrapper with a maintained upstream tool.

### 时间线

- 2010s: vpn-slice emerges as a Python vpnc-script replacement for OpenConnect/VPNC split tunneling.
- 2019: Public questions around OpenConnect plus vpn-slice show use in Nix and macOS workflows.
- 2020s: OpenConnect documentation lists vpn-slice as a recognized alternative script for limited-subset routing.

### Related projects

- vpn-slice is directly related to OpenConnect, VPNC, and vpnc-script.
- The upstream README also relates it conceptually to sshuttle, whose automatic host lookup behavior influenced vpn-slice's own host handling.

### 来源

- <https://github.com/dlenski/vpn-slice>
- <https://pkgs.alpinelinux.org/package/edge/community/x86/vpn-slice>
- <https://ports.macports.org/port/vpn-slice/summary/>
- <https://pypi.org/project/vpn-slice/>
- <https://www.infradead.org/openconnect/vpnc-script.html>


## 安全说明

generalized runtime or code generation signal.

- **Geiger 风险:** yellow / 中
- generalized runtime or code generation signal

## 其他软件包管理器记录

- Nix - vpn-slice: normalized package name match | nixpkgs package indexes: pkgs/by-name/vp/vpn-slice/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - vpn-slice - 0.16.1-r5: normalized package name match | Alpine Linux edge package indexes: vpn-slice from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | vpnc-script replacement for easy and secure split-tunnel VPN setup | https://github.com/dlenski/vpn-slice
- apk - vpn-slice-pyc - 0.16.1-r5: normalized package name match | Alpine Linux edge package indexes: vpn-slice-pyc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Precompiled Python bytecode for vpn-slice | https://github.com/dlenski/vpn-slice
- MacPorts - vpn-slice: normalized package name match | MacPorts ports tree: net/vpn-slice/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/vpn-slice.yml](https://github.com/mxcl/pkgdb/blob/main/combined/vpn-slice.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
