17 กันยายน 2563

ngrok,serveo.net

ngrok,serveo.net,telebit.cloud,Localtunnel



     บริการที่ทำให้ local host สามารถเข้าถึงได้จาก internet แบบ https
    เสมือนเป็น ddns+port forward สามารถใช้กับปลายทางที่สามารถเขียนค่าให้เข้าถึงลงได้
    เช่น web server กรณีอื่นๆอาจไม่ได้ เช่น NAS

    ngrok

    จำเป็นต้องลง ngrok client ใน OS ปลายทาง เช่น linux,windows และต้องรัน ngrok ไว้ตลอดเวลา
หากออกจาก ssh หรือหน้าจอสั่งทำงาน จะหลุดทันที และต้องสั่งทำงานใหม่ ทำให้ได้รับ url ใหม่และต้องแก้ไฟล์ config ที่เกี่ยว url ใหม่ทุกครั้ง

    1.สมัครสมาชิก  ngrok.io
    2.download ไฟล์ติดตั้งออกมา
    3.ขยายไฟล์   unzip /root/ngrok.zip
    4.เชื่อมต่อบัญชี  ./ngrok authtoken <your_auth_token>
<your_auth_token> ได้จากหน้าจอ your authen ngrok.io
    5.สั่ง ngrok ทำงานด้วยคำสั่ง      ./ngrok http 8o
    หากต้องการรันตลอดลองใช้คำสั่ง  ./ngrok http 80 > /dev/null &
    port 80 สามารถเปลี่ยนเป็น port อื่นๆได
    หากรันใน windows สามารถ monitor ได้    http://127.0.0.1:4040

    serveo.net
    
    ไม่มี client  โดยหลักคือ ร้องขอให้ serveo.net สร้าง url ให้แล้วส่งการติดต่อกลับเข้ามาที่ local host mี่เปิด port รอรับ คล้ายๆ ngrok แบบไม่ต้องเป็นสมาชิก
    รูปแบบการใช้
    แบบร้องขอ url อัตโนมัติ
    ssh -R 80:localhost:4444 serveo.net
    จะได้รับ url มาในลักษณะ       https://[anyurl].serveo.net
    หมายถึงให้ส่งการติดต่อจาก port  80จาก url ที่แสดง มายัง Local host port 4444

    แบบร้องขอ url ระบุชื่อที่ต้องการ
    ssh -R world:80:localhost:5555 serveo.net
    จะได้รับ url มาในลักษณะ       https://world.serveo.net    
    หมายถึงให้ส่งการติดต่อจาก port  80จาก url world.serveo.net มายัง Local host port 5555

    ทั้งนี้หากเปิด tool ssh เมื่อใดจะขาดการเชื่อต่อทันที หากต้องการให้เชื่อมต่อใหม่อัตโนมัติเมื่อหลุด
    autossh -M 0 -R world:80:localhost:5555 serveo.net

telebit.cloud

        1.ติดตั้ง client
            curl https://get.telebit.io/ | bash

        2.ยืนยันการลงทะเบียนเครื่องคอมพิวเตอร์ผ่านอีเมล์ เช็คอีเมล์ ทำตามขั้นตอน
        3.ใช้งานได้
For Local Development

 $ ~/telebit http 3000
  Forwarding https://jondoe.telebit.io => localhost:3000

  $ curl -fsSL https://jondoe.telebit.io/

For Sharing Files

  $ ~/telebit http ./project.zip
  > Serving ./project.zip as https://jondoe.telebit.io

  $ curl -fsSL https://jondoe.telebit.io/

For Access with SSH

 $ ~/telebit ssh auto
 > Forwarding jondoe.telebit.io -p 5050 => localhost:22
 > Forwarding ssh+https (openssl proxy) => localhost:22

  $ ssh -p 5050 jondoe.telebit.io
  $ ssh -o ProxyCommand="sclient %h" jondoe.telebit.io

For Debugging with TCP

 $ ~/telebit tcp 9000
 > Forwarding jondoe.telebit.io -p 5050 => localhost:9000

  $ netcat jondoe.telebit.io 5050


Localtunnel

Quickstart

Install Localtunnel globally (requires NodeJS) to make it accessible anywhere:

npm install -g localtunnel

Start a webserver on some local port (eg http://localhost:8000) and use the command line interface to request a tunnel to your local server:

lt --port 8000

You will receive a url, for example https://gqgh.localtunnel.me, that you can share with anyone for as long as your local instance of lt remains active. Any requests will be routed to your local service at the specified port.