简要流程
- san.conf配置文件
- make_ca.sh
- make_cert.sh
因为docker for mac/windows 不支持 –net=host,跑在docker下很不方便穿透宿主机。
都放在 /Users/apple/Workspace/docker-frpc 下,此处以这个目录为例,请自行修改自己的对应的目录地址
sudo vim ~/Library/LaunchAgents/frpc.plist
文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>frpc</string>
<key>ProgramArguments</key>
<array>
<string>/Users/apple/Workspace/docker-frpc/frpc</string>
<string>-c</string>
<string>/Users/apple/Workspace/docker-frpc/frpc.ini</string>
</array>
<key>KeepAlive</key>
<true></true>
<key>RunAtLoad</key>
<true></true>
</dict>
</plist>
sudo chown root ~/Library/LaunchAgents/frpc.plist
sudo launchctl load -w ~/Library/LaunchAgents/frpc.plist
sudo launchctl unload -w ~/Library/LaunchAgents/frpc.plist
将cpu频率调为1200.wifi功率增加到400mw。ac68u全面超越什么穿墙王之类。
在telnet或者ssh里,可以用鼠标复制命令,用鼠标右键点击ssh或者telnet窗口,就可以全部粘贴进去了。
telnet或者ssh下复制如下命令:
两排命令一起复制,粘贴进去后回车
nvram set asuscfeclkfreq=1200,666 && nvram set asuscfecommit=1
nvram set clkfreq=1200,666 && nvram commit && reboot
主要出现在安装了docker 后。
sudo systemctl status dhcpcd
可以看到
标红的 route socket overflowed - learning interface state
然后一堆 veth开头的网卡问题。
这里,我们打开 /etc/dhcpcd.conf 文件,添加下面部分:
denyinterfaces veth*
保存并重启。解决问题。
wifi 连接命令:iwconfig wlan0 essid “wifi名称” key 密码 此方式有一定缺陷,目前已知只能连接WEP方式或者无密码的wifi
#查看所有无线网络,一般是wlan0 sudo iwconfig #启动无线网卡接口服务 sudo ip link set wlan0 up #扫描无线网络,默认使用所有网卡搜索 sudo iwlist scanning | more #使用特定网卡搜索网络 sudo iwlist wlan0 scan | more sudo iwlist eth0 scan #连接到特定网络 iwconfig wlan0 essid "MyHome" #如果网络是加密的,密码是0123456789,那么就输入命令 iwconfig wlan0 essid "MyHome" key 0123-4567-89 #如果正常的话,输入 iwconfig wlan0 就可以看到连接正常的各项参数了。 #启用无线网卡 ifconfig wlan0 up #如果是用DHCP获取IP的,那么用dhclient或dhcpcd获取ip dhclient wlan0 或 dhcpcd wlan0
通过ssh方式登录你的路由器
输入如下命令:
sed -i 's/\tdetect_package/\t# detect_package/g' /koolshare/scripts/ks_tar_install.sh
最近使用了最新版的ubuntu 20.04运行一些服务,然后发现服务器经常出现网络不通的情况,主要是一些域名无法解析。
检查/etc/resolv.conf,发现之前修改的nameserver总是会被修改为127.0.0.53,无论怎么改都 会被替换回来。
查看/etc/resolv.conf这个文件的注释,发现开头就写着这么一行:
这说明这个文件是被systemd-resolved这个服务托管的。
通过netstat -tnpl| grep systemd-resolved查看到这个服务是监听在53号端口上。
查了下,这个服务的配置文件为/etc/systemd/resolved.conf,大致内容如下
[Resolve] DNS=1.1.1.1 1.0.0.1 #FallbackDNS= #Domains= LLMNR=no #MulticastDNS=no #DNSSEC=no #Cache=yes #DNSStubListener=yes
如果我们要想让/etc/resolve.conf文件里的配置生效,需要添加到systemd-resolved的这个配置文件里DNS配置项(如上面的示例,已经完成修改),然后重启systemd-resolved服务即可。
sudo systemctl restart systemd-resolved
# 替换brew.git: cd "(brew --repo)" # 中国科大: git remote set-url origin https://mirrors.ustc.edu.cn/brew.git # 清华大学: git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git # 替换homebrew-core.git: cd "(brew --repo)/Library/Taps/homebrew/homebrew-core" # 中国科大: git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git # 清华大学: git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git # 替换homebrew-bottles: # 中国科大: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.zsh_profile # 清华大学: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.zsh_profile # 应用生效: $ brew update
# 重置brew.git: cd "(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git # 重置homebrew-core.git: cd "(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git
同时按着option+command+F5,是F5不是5,把勾选的 “启用鼠标键”去掉就好了。
wsl2每次启动后,ip都是变化的,我们也没法进行固定,因此除了宿主机,其他机器无法对其进行直接访问。于是我们就需要将其端口和windows端口进行绑定/转发。
使用 docker desktop for windows ,然后 enable wsl2 , 然后绑定你的 wsl2服务。
然后 bash进入 linux子系统, docker run xxx -p 1234:1234 xxx 就可以了。
这样外部就可以访问 宿主ip+1234端口 对这个服务进行访问了。
如果有些东西,用docker反而麻烦一些,因此不愿意使用docker来运行,就需要用到这里了。
编写powershell脚本:forward.ps1
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){ `
$remoteport = $matches[0]; `
} else{ `
echo "The Script Exited, the ip address of WSL 2 cannot be found"; `
exit; `
}
#[Ports]
#All the ports you want to forward separated by coma
$ports=@(80,443,22);
#[Static ip]
#You can change the addr to your ip config to listen to a specific address
$addr='0.0.0.0';
$ports_a = $ports -join ",";
#Remove Firewall Exception Rules
iex "Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' ";
#adding Exception Rules for inbound and outbound Rules
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort $ports_a -Action Allow -Protocol TCP";
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort $ports_a -Action Allow -Protocol TCP";
for( $i = 0; $i -lt $ports.length; $i++ ){ `
$port = $ports[$i]; `
iex "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr"; `
iex "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport"; `
}
请自行 替换 命令中的 $ports=@(80,443,22) 为你所需要的端口们。我这里只转发 80、443、22这3个端口。