Point-to-point intranet penetration

This Example will demonstrate how to use peer-to-peer (P2P). Connect to access the intranet service, and traffic will not be transferred through the server.

Frp provides a new type of Agent xtcpUsed to achieve internal network penetration when a large amount of data needs to be transmitted and traffic is not desired to pass through the server.

Similar tostcp, Use xtcpFRPC needs to be deployed on both ends to establish a direct connection.

It should be noted thatxtcpis not applicable to all types of NAT If the penetration fails, you can try usingstcpAgent.

Steps

  1. Configuration needs to be exposed to frpc.toml on machines outside the network File

    In frpc.toml Add the following content to the file to ensure that the correct server address, port, and shared key are set up (secretKey), as well as the IP address and port of the local service:

    serverAddr = "x.x.x.x"
        serverPort = 7000
        # If the default STUN server is not available, you can Configuration a new STUN server
        # natHoleStunServer = "xxx"
        
        [[proxies]]
        name = "p2p_ssh"
        type = "xtcp"
        # Only users whose shared key (secretKey) is consistent with the server can access the service.
        secretKey = "abcdefg"
        localIP = "127.0.0.1"
        localPort = 22
        
  2. Deploy frpc on machines that want to access internal network services

    In frpc.toml Add the following content to the file to ensure that the correct server address and port are set and the shared key is shared (secretKey) and the name of the P2P Agent to be accessed:

    serverAddr = "x.x.x.x"
        serverPort = 7000
        # If the default STUN server is not available, you can configure a new STUN server
        # natHoleStunServer = "xxx"
        
        [[visitors]]
        name = "p2p_ssh_visitor"
        type = "xtcp"
        # Name of the P2P Agent to be accessed
        serverName = "p2p_ssh"
        secretKey = "abcdefg"
        # Bind a local port to access the SSH service
        bindAddr = "127.0.0.1"
        bindPort = 6000
        # If you need to keep the tunnel open automatically, set it to true
        # keepTunnelOpen = false
        
  3. Access the private network machine through SSH

    The Use SSH command accesses the private network machine, assuming that the user name is test

    ssh -oPort=6000 test@127.0.0.1
        
Last modified November 15, 2023: fix 404 (#71) (626ce4d)