Sign inSign up

dnomd343/tproxy

By dnomd343

Updated about 4 years ago

基于虚拟旁路由的透明代理工具

Image
2

4.0K

dnomd343/tproxy repository overview

源码地址:Github

开启网卡混杂模式
ip link set eth0 promisc on
创建Docker的macvlan网络
docker network create -d macvlan \
--subnet=192.168.2.0/24 \
--gateway=192.168.2.1 \
-o parent=eth0 macvlan
查看网络是否创建成功
docker network ls
配置自定义脚本
mkdir /etc/scutweb
cd /etc/scutweb
vim custom.sh
指定容器网络信息
ip addr flush dev eth0
ip addr add 192.168.2.2/24 brd 192.168.2.255 dev eth0
ip route add default via 192.168.2.1
设置代理接口
vim /etc/scutweb/outbounds.json
vim /etc/scutweb/routing.json
开启透明代理容器
docker run --restart always \
--name scutweb \
--network macvlan \
--privileged -d \
--volume /etc/scutweb/:/etc/xray/expose/ \
--volume /etc/timezone:/etc/timezone:ro \
--volume /etc/localtime:/etc/localtime:ro \
dnomd343/tproxy
查看容器运行状态
docker ps -a
编辑宿主机网络配置
vim /etc/network/interfaces

补充如下配置

auto eth0
iface eth0 inet manual

auto macvlan
iface macvlan inet static
  address 192.168.2.34
  netmask 255.255.255.0
  gateway 192.168.2.2
  dns-nameservers 192.168.2.3
  pre-up ip link add macvlan link eth0 type macvlan mode bridge
  post-down ip link del macvlan link eth0 type macvlan mode bridge
重启宿主机
reboot

Tag summary

Content type

Image

Digest

sha256:ac241a6f1

Size

13.7 MB

Last updated

about 4 years ago

docker pull dnomd343/tproxy