Установка:
|
|
bash <(curl -fsSL https://get.hy2.sh/) hysteria version |
Проверить конфиг:
|
|
hysteria server -c /etc/hysteria/config.yaml |
Проверка туннеля:
|
|
curl --socks5 127.0.0.1:1081 https://ifconfig.me |
hysteria-server
|
|
nano /etc/hysteria/config.yaml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
listen: :443 acme: domains: - vpn.example.com email: admin@example.com #Если у тебя пока нет домена и ты подключаешься по IP: #tls: # cert: /etc/hysteria/server.crt # key: /etc/hysteria/server.key auth: type: password password: 123456789012345678901234567890 #по желанию обфускация Salamander меняет вид QUIC-пакетов и использует дополнительный пароль. #obfs: # type: salamander # salamander: # password: VeryStrongObfsPassword123 masquerade: # type: proxy # proxy: # url: https://ubuntu.com/ # rewriteHost: true type: string listenHTTP: :80 listenHTTPS: :443 forceHTTPS: true string: content: "<h1>It works</h1>" headers: content-type: text/html |
Создать самоподписанный сертификат если есть секция tls:
|
|
mkdir -p /etc/hysteria openssl req -x509 -newkey rsa:2048 \ -nodes \ -keyout /etc/hysteria/server.key \ -out /etc/hysteria/server.crt \ -days 3650 \ -subj "/CN=test" |
|
|
hysteria server -c /etc/hysteria/config.yaml |
|
|
systemctl restart hysteria-server journalctl -u hysteria-server -n 50 --no-pager |
hysteria-server1-service
|
|
nano /etc/systemd/system/hysteria-server.service |
|
|
[Unit] Description=Hysteria Server After=network-online.target Wants=network-online.target StartLimitIntervalSec=0 [Service] Type=simple ExecStart=/usr/local/bin/hysteria server -c /etc/hysteria/config.yaml Restart=always RestartSec=2 LimitNOFILE=1048576 [Install] WantedBy=multi-user.target |
|
|
systemctl reset-failed hysteria-server systemctl daemon-reload systemctl enable hysteria-server systemctl start hysteria-server systemctl status hysteria-server |
hysteria-client1
|
|
nano /etc/hysteria/config1.yaml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
server: ваш_IP_сервера:443 auth: 123456789012345678901234567890 #если сервер с ACME → TLS НЕ нужен здесь #если self-signed → нужен insecure: true #tls: # insecure: true #по желанию обфускация Salamander меняет вид QUIC-пакетов и использует дополнительный пароль. #obfs: # type: salamander # salamander: # password: VeryStrongObfsPassword123 socks5: listen: 127.0.0.1:1081 # users: # - user: test # password: 123456 |
|
|
hysteria client -c /etc/hysteria/config1.yaml |
hysteria-client1-service
|
|
nano /etc/systemd/system/hysteria-client1.service |
|
|
[Unit] Description=Hysteria 2 Client1 After=network.target Wants=network.target # чтобы не падал при обрыве сети StartLimitIntervalSec=0 [Service] ExecStart=/usr/local/bin/hysteria client -c /etc/hysteria/config1.yaml Restart=always RestartSec=2 LimitNOFILE=1048576 [Install] WantedBy=multi-user.target |
|
|
systemctl reset-failed hysteria-client1 systemctl daemon-reload systemctl enable hysteria-client1 systemctl start hysteria-client1 systemctl status hysteria-client1 |
|
|
systemctl restart hysteria-client1 journalctl -u hysteria-client1 -n 50 --no-pager |