Brook Transparent Proxy Gateway on Intel macOS

https://www.txthinking.com
Created at: 06 Apr 2022
Updated at: 06 Apr 2022
cloud@txthinking.com

Brook

https://github.com/txthinking/brook

Install multipass

Version >= 1.9.0

  1. Download .pkg file, https://github.com/canonical/multipass/releases
  2. Install
  3. Run. An icon will appear in the system tray. Just run it, no need to manipulate it. Let's continue to use the terminal with the system to operate

Set deiver

sudo multipass set local.driver=qemu

Set bridged network

Get network list

multipass networks

Output like this

Name     Type         Description
bridge0  bridge       Network bridge with en2, en3, en4, en5
en0      ethernet     Ethernet
en1      wifi         Wi-Fi
en2      thunderbolt  Thunderbolt 1
en3      thunderbolt  Thunderbolt 2
en4      thunderbolt  Thunderbolt 3
en5      thunderbolt  Thunderbolt 4

Choose the Ethernet nameļ¼Œhere is en0, Of course your macOS needs to be connected to the network cable, the wireless network card may not work well

Set bridged network

sudo multipass set local.bridged-network=en0

Launch an instance

Set name mybrook

multipass launch --name mybrook --bridged

Download brook_linux_amd64 file and joker_linux_amd64 file

https://github.com/txthinking/brook/releases/latest/download/brook_linux_amd64

https://github.com/txthinking/joker/releases/latest/download/joker_linux_amd64

Copy brook_linux_amd64 and joker_linux_amd64 to mybrook : /tmp/

multipass transfer brook_linux_amd64 mybrook:/tmp/brook
multipass transfer joker_linux_amd64 mybrook:/tmp/joker

Enter mybrook

multipass shell mybrook

let's go

Change to root

sudo su

copy joker and brook command

mv /tmp/joker /usr/bin/joker
chmod +x /usr/bin/joker
mv /tmp/brook /usr/bin/brook
chmod +x /usr/bin/brook

Stop systemd-resolved occupying port 53

systemctl stop systemd-resolved
systemctl disable systemd-resolved
echo nameserver 8.8.8.8 > /etc/resolv.conf

Start brook tproxy, more parameters and rules --help

joker brook tproxy --link 'brook://...' --dnsListen :53

Check if the startup is successful

joker list

If not running, take a look at the error log

joker log `joker last`

exit root user

exit

exit mybrook

exit

Get gateway IP

multipass info mybrook

The IP on the same network segment as your host is the gateway created

Set the gateway and DNS of other devices to this IP.