禁用dns解析,加快git ssh连接操作速度
侧边栏壁纸
  • 累计撰写 50 篇文章
  • 累计收到 0 条评论

禁用dns解析,加快git ssh连接操作速度

admin
2025-03-26 / 0 评论 / 12 阅读 / 正在检测是否收录...

指定git ssh走openvpn通道,通过禁用dns解析来加快连接速度。

这是我的配置

$ cat ~/.ssh/config 
Host github.com
    HostName github.com
    User JyPony
    IdentityFile ~/.ssh/id_rsa

Host bitbucket.org
    HostName bitbucket.org
    User JyPony
    IdentityFile ~/.ssh/bitbuck_id_rsa

Host bitbucket.orgtest
    HostName bitbucket.org
    User JyPony
    IdentityFile ~/.ssh/test_id_rsa

Host gitee.com
    HostName gitee.com
    User JyPony
    IdentityFile ~/.ssh/gitee_id_rsa

Host f-gitlab-l-g.jypony.com
    # 自建私有仓库
    HostName f-gitlab-l-g.jypony.com
    User JyPony
    IdentityFile ~/.ssh/gitlab_id_rsa
    Protocol 2
    # 禁用dns解析之后,速度变快
    GSSAPIAuthentication no
    HostKeyAlgorithms +ssh-rsa

openvpn的配置

$ cat /etc/openvpn/hk.conf 
client
dev tun
proto udp
remote vpn.jypony.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
<ca>
-----BEGIN CERTIFICATE-----
XXXXXXXXXXX
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
XXXXXXXXXXX
-----END OpenVPN Static key V1-----
</tls-auth>
tun-mtu 1500
reneg-sec 0
comp-lzo
auth-nocache
verb 3
auth-user-pass /etc/openvpn/credentials.txt
route 10.0.0.0 255.0.0.0
# 以下是指定一个ip范围才走openvpn,xxx替换为自己需要指定的ip, 我这里配置的是git自建仓库的ip
route xxx.xxx.xxx.0 255.255.255.0
route-nopull
0

评论 (0)

取消