WireGuard connect

Submitted by lepton on Tue, 05/26/2020 - 15:39

wg genkey | tee server.key | wg pubkey > server.pub


PEER_A_PUB=key_string
PEER_Endpoint="endpoint ip:9902" #maybe empty
PEER_A_IP=10.1.0.2
MY_IP=10.1.0.1/24
MY_PORT=9901
ip link del wg0 ip link add dev wg0 type wireguard
ip addr add $MY_IP dev wg0
wg set wg0 listen-port $MY_PORT private-key /etc/wireguard/server.key
wg set wg0 peer $PEER_A_PUB $PEER_Endpoint allowed-ips $PEER_A_IP/32
ip link set wg0 up

in dir /etc/wireguard

How to clear the /Library/StageExtensions folder

Submitted by lepton on Wed, 04/22/2020 - 14:33

This command will clear all the /Library/StageExtensions folder.

# sudo kextcache --clear-staging

 

only clear some file

# sudo rm -rf /Library/Extensions/somefile

# sudo kextcache -invalidate /

# ls /Library/StagedExtensions/

 

or

#sudo kextcache  -prune-staging //Prunes the kernel extension staging area by removing all kernel extensions no longer present in their original location.

启用BBR拥塞算法

Submitted by lepton on Fri, 11/22/2019 - 12:11

Tags

检查内核版本

通过uname -r命令检查内核版本是否大于4.9

# uname -r

启用BBR拥塞算法

  • 加载内核模块

# modprobe tcp_bbr

# echo "tcp_bbr" >> /etc/modules-load.d/modules.conf

  • 修改内核参数

# echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf

Public STUN server list

Submitted by lepton on Wed, 11/20/2019 - 13:13

very old  https://gist.github.com/mondain/b0ec1cf5f60ae726202e

some fix https://gist.github.com/zziuni/3741933

23.21.150.121:3478

iphone-stun.strato-iphone.de:3478

numb.viagenie.ca:3478

s1.taraba.net:3478

s2.taraba.net:3478

stun.12connect.com:3478

stun.12voip.com:3478

stun.1und1.de:3478

stun.2talk.co.nz:3478

stun.2talk.com:3478

stun.3clogic.com:3478

stun.3cx.com:3478

stun.a-mm.tv:3478

stun.aa.net.uk:3478

stun.acrobits.cz:3478

stun.actionvoip.com:3478

ssh connect over ssh tunnel

Submitted by lepton on Fri, 11/08/2019 - 11:47

Tags

ssh -o ProxyCommand="ssh -W %h:%p root@jump.example.org" root@target.example.org

or write it to ssh config file

Host xxx

HostName target.example.org

User root

IdentityFile ~/.ssh/id_rsa

ProxyCommand ssh -W %h:%p root@jumphost.example.org

 

 

another

ssh -L local_Port:target.example.org:22 root@jumphost.example.org

write it to ssh config file using LocalForward

Connect Another Net Using IP Tunnel

Submitted by lepton on Fri, 10/18/2019 - 12:28

//computer one ip from ifconfig 192.168.1.2  public ip 2.2.2.2  
ip tunnel del ipip0
ip tunnel add ipip0 mode ipip remote 1.1.1.1 local 192.168.1.2
ip addr add 10.0.0.101/24 dev ipip0
ip link set ipip0 up

 

//computer two ip from ifconfig 192.168.100.2  public ip  1.1.1.1
ip tunnel del ipip0
ip tunnel add ipip0 mode ipip remote 2.2.2.2 local 192.168.100.2
ip addr add 10.0.0.102/24 dev ipip0
ip link set ipip0 up

 

//iptables