用啥ngrok,用ssh解决大局域网反向端口转发问题

用啥ngrok,用ssh解决大局域网反向端口转发问题

自从家里换了联通光纤后,联通就在我家宽带出口前搭了一个路由器,我家也彻底沦为192.168.1.0/24段的局域网了,带来的问题就是在外网无法访问家里的路由器。这对于刷了LEDE,有时候需要从外网直接管理使用路由器的我,觉得难受极了。周末有空,干脆解决这个问题。

在这之前,了解过一个ngrok项目,用于将局域网内的某一个地址的端口,映射到公网。但是研究了一下该软件,发现其在LEDE的源中,并不包含,我又是个懒的去编译的程序员,因此想看看有没有其他办法。

研究一下,发现其实程序员必备的SSH就有这个功能。SSH一共支持三种端口转发:

  • 本地端口转发:就是客户端方的某个端口和服务器某个端口相连,这样访问客户端该端口,就相当于访问服务器端某个端口
  • 远程端口转发:还是把客户端方的某个端口和服务器某个端口相连,只不过反向的,访问服务器端某个端口,就相当于访问到了客户端该端口
  • 动态转发:SOCKS5代理模式,不多说了

更具体一些,可以参见这篇文章:https://blog.twofei.com/528/

回到我的需求,我是希望访问VPS的某个端口,就相当于访问路由器的指定端口。比如我访问VPS的2222,就相当于访问路由器的22端口。所以是第二种:远程端口转发

SSH做起来非常简单,首先,修改VPS端/etc/ssh/sshd_config加入GatewayPorts yes。据说,不这样外网无法访问转发的端口,未验证。然后路由器一条命令搞定:

ssh -f -NR "*:2222:localhost:22" user@vps    

这样子,访问VPS的2222端口,就直接访问到了路由器

进化一:持久

用ssh命令有个问题,因为各种因素,它可能会莫名挂掉,网络不好啦,网络干扰啦,网络xxx啦,总归都是网络问题。因此,我们得祭出神奇autossh。在LEDE的包中,默认就有,安装之,爱死LEDE。在这之前,自己搞定SSH的密钥登录哦,否则autossh起来,也会卡在输入密码。 autossh在LEDE的配置文件是/etc/config/autossh,配置一下

config autossh 'ssh'        option gatetime '0'      option monitorport '20000'      option poll '600'      option ssh '-p 22 -NR *:2222:localhost:22 user@vps'  

然后开启autossh

进化二:隐藏

在我家的运营商,我发现了一个问题,如果你ssh启动一段时间后,到目的地址的网络丢包就开始大量出现。思来想去,把ssh塞到ssr-tunnel中不就完事了。

先建立一个到VPS的22端口的ssr-tunnel隧道

ssr-tunnel -c /var/etc/shadowsocksr.json -l 2222 -L VPS:22 -f /tmp/ssr-tunnel.pid >> /tmp/ssr-tunnel.log    

这样,访问本机的2222端口,就相当于走ssr流量访问远端的22端口。把autossh的配置稍微改一下,让其访问本机2222端口

config autossh 'ssh'        option gatetime '0'      option monitorport '20000'      option poll '600'      option ssh '-p 2222 -NR *:2222:localhost:22 vpsuser@localhost'  

为了让ssr-tunnel隧道保持运行,需要搞个监控。不需要很复杂,放到crontab里就可以了

ps | grep [s]sr-tunnel || `ssr-tunnel -c /var/etc/shadowsocksr.json -l 2222 -L vps:22 -f /tmp/ssr-tunnel.pid >> /tmp/ssr-tunnel.log`    
进化三:多射

映射了第一个端口,你就想再来一个。什么aria2映射出来,就可以做外网离线下载。其实也蛮简单的,因为autossh支持多端口映射

config autossh 'ssh'        option gatetime '0'      option monitorport '20000'      option poll '600'      option ssh '-p 2222 -NR *:2222:localhost:22 -NR *:6800:localhost:6800 vpsuser@localhost'  

这样就把aria2的6800也映射出来了

就这样,结束了

转载请注明出处:https://story.tonylee.name/2017/07/27/yong-sha-ngrok-yong-sshjie-jue-da-ju-yu-wang-fan-xiang-duan-kou-zhuan-fa-wen-ti/

Please enable JavaScript to view the <a href=”https://disqus.com/?ref_noscript“>comments powered by Disqus.</a>

用啥ngrok,用ssh解决大局域网反向端口转发问题

局域网下,免设置路由的全局透明代理

by FISHERMAN

如果你不想光为了透明代理而单独买一个可刷OpenWRT固件的路由器, 同时你在局域网内有至少一台linux机器(可虚拟机),那以下内容可以帮助你在不需要设置路由的情况下实现透明代理(当然本质上就是把那台机器当成路由来用)。

首先你需要一台linux机器,ubuntu/debian/centos等均可,能编译ss-libev,使用iptables(于是不能centos7,我不会调教那个firewall)。你可以使用真实机器(如树莓派)或虚拟机。如果使用虚拟机,网络类型需要设置为桥接到物理网络,如果是VMware,不要对“复制物理网络连接状态”打钩。我建议使用虚拟机或性能不差的真实机器,这样网速不会受到性能上的限制。

接下来,安装操作系统、安装编译依赖包、git clone ss-libev、configure、make等这里就不说了,网上说明有很多(虽然大多数是过时了)。

编译好后,如果你clone的是ssr的libev版本: https://github.com/shadowsocksr-backup/shadowsocksr-libev,里面自带了一个ssrlink.py,可以通过此脚本快速生成一个客户端使用的配置文件,例如执行:

python ssrlink.py ssr://MTkyLjE2OC4xLjI6MTA4MDphdXRoX2FlczEyOF9tZDU6YWVzLTEyOC1jZmI6dGxzMS4yX3RpY2tldF9hdXRoOk1USXpORFUyLz9vYmZzcGFyYW09ZEdWemRDNWpiMjAmZ3JvdXA9ZEdWemRB > config.json
即可生成一个配置好了的config.json

东西都准备好了,现在开始配置。首先是开启ipv4转发,编辑/etc/sysctl.conf,解除net.ipv4.ip_forward = 1的注释,或直接添加这么一行,保存文件,并执行sysctl -p使修改立即生效。然后,设置IP为静态的,例如你的路由器地址为192.168.0.1,那么你可以设置为192.168.0.2,具体设置方法参考linux文档。设置好以后,在需要全局代理的机器上,把网关地址改为192.168.0.2,测试能不能正常上网(现在还没有通过代理),如果不能,那检查防火墙配置,或尝试重启它再测试。能正常上网后再进行后面的配置。

然后,创建一个ipt.sh文件,文件内容如下:

#!/bin/bash

subnet=”192.168.0.0/16″           # your subnet config
localaddr=”192.168.0.2″           # this server ip (must be subnet ip)
boardcastaddr=”192.168.0.255″
listenport=1080                   # local listen port (tcp)
    udplistenport=0               # set it if not the same udp port
NAT_OUTPUT=0                      # if 0: do not need to set server ip
if [ $NAT_OUTPUT -eq 1 ]; then
    serverip=”100.86.100.10″          # ss server ip (tcp)
    serverip_udp=””                   # ss server ip (for udp), keep empty if the same
fi

iptables -t nat -D PREROUTING -p tcp -j SHADOWSOCKS
if [ $NAT_OUTPUT -eq 1 ]; then
    iptables -t nat -D OUTPUT -p tcp -j SHADOWSOCKS
fi
iptables -t nat -F SHADOWSOCKS
iptables -t nat -X SHADOWSOCKS

iptables -t mangle -D PREROUTING -p udp -j SHADOWSOCKS
iptables -t mangle -F SHADOWSOCKS
iptables -t mangle -X SHADOWSOCKS

ip rule del fwmark 0x01/0x01 table 100
ip route del local 0.0.0.0/0 dev lo table 100

if [ $udplistenport -eq 0 ]; then
    udplistenport=`expr $listenport`
fi

iptables -t nat -N SHADOWSOCKS
iptables -t nat -I PREROUTING -p tcp -j SHADOWSOCKS
if [ $NAT_OUTPUT -eq 1 ]; then
    iptables -t nat -I OUTPUT -p tcp -j SHADOWSOCKS
fi

ip rule add fwmark 0x01/0x01 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N SHADOWSOCKS
iptables -t mangle -A SHADOWSOCKS -d ${boardcastaddr} -j RETURN
iptables -t mangle -A SHADOWSOCKS -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A SHADOWSOCKS -p udp –dport 137 -j RETURN
iptables -t mangle -A SHADOWSOCKS -p udp –dport 138 -j RETURN
iptables -t mangle -A SHADOWSOCKS -p udp -d ${localaddr} -j RETURN
iptables -t mangle -A SHADOWSOCKS -p udp -s ${localaddr} -j RETURN
iptables -t mangle -A SHADOWSOCKS -p udp -s ${subnet} -j TPROXY –on-port ${udplistenport} –tproxy-mark 0x01/0x01
iptables -t mangle -I PREROUTING -p udp -j SHADOWSOCKS

if [ $NAT_OUTPUT -eq 0 ]; then
    iptables -t nat -A SHADOWSOCKS -d ${localaddr} -j RETURN
    iptables -t nat -A SHADOWSOCKS -s ${localaddr} -j RETURN
else
    iptables -t nat -A SHADOWSOCKS -d ${serverip} -j RETURN
    iptables -t nat -A SHADOWSOCKS -s ${serverip} -j RETURN
    if [ -z $serverip_udp ]; then
        iptables -t nat -A SHADOWSOCKS -d ${serverip} -j RETURN
    
    iptables -t nat -A SHADOWSOCKS -s ${serverip} -j RETURN
    fi
fi

iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d ${subnet} -j RETURN

iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT –to-ports ${listenport}

注意你应该按你的本地设定修改前四行的配置,一般你也只需要修改前四行的配置项就行了,然后保存并执行。执行后,它可以重定向你所有的出网TCP和UDP包。

最后,运行ss-redir:./ss-redir -c config.json -u
此时便应该是全局,可以愉快地玩耍了

注意的一点:UDP包如果不能成功转发,可能是被GFW拦截,那么这时只能更换服务器了。而这可能导致DNS查询失败,可以先把DNS设置为路由的DNS地址以便于排查问题。

ipt.sh参数说明:
listenport 应该与你的ss配置文件所配置的local_port一致
localaddr 你的这台linux机器的静态IP地址

subnet 你的局域网网络地址段
boardcastaddr 你的局域网的广播地址(地址段中最大的地址,由网络掩码决定)

其它说明:如果你不需要全局代理,你可以在ipt.sh中模仿以下指令
iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
在此后面添加你不需要代理的地址段即可.

Shared via Inoreader

局域网下,免设置路由的全局透明代理

How to Speed Up Chrome with 5 Easy Tricks

by Robert Zak

Make Tech Easier / 0029-08-01 08:28

Chrome is the most popular web browser in the world, and a big part of that is thanks to the fact that it’s one of the quickest. The fact that it spreads itself out across multiple processes on your PC means it takes advantage of your computer’s memory to speed up your browsing in ways that something like Firefox doesn’t (for now).

But that doesn’t mean you can’t crank even more speed out of Chrome if you fancy it. Here are the five best ways to speed up the already-speedy browser.

1. Suspend Tabs You’re Not Using

Over the years the amount of tabs we simultaneously leave open has ballooned into the double figures. With higher-resolution monitors capable of displaying more info on-screen, and the option of multiple desktops these days, why not

The reason why not is because tabs that continue to run in the background continue to hog your system resources. Instead of just closing those excess tabs, though, you can enable a Chrome flag that suspends tabs you’re not using, then re-enables them when you click them, saving on memory.

To enable this, go to chrome://flags, then hit “Ctrl + F” and search for “tab discarding.” When you see it, click the drop-down box, select “Enabled,” and restart Chrome.

speed-up-chrome-chrome-flags

speed-up-chrome-chrome-flags

You can read more about our favorite Chrome flags here.

2. Compress Sites as They Load

If you’re using a PC, there’s a good chance you’re in a position where you don’t need to worry too much about how much data you’re using each month. But data-saving can also have the desirable effect of speeding up Chrome.

Google offers its very own Data Saver extension for Chrome that works in much the same way as the built-in feature in the Android version of Chrome. It compresses most websites (aside from encrypted HTTPS ones) as it loads them, meaning there’s less info to load and therefore the page loads faster. Simple.

speed-up-chrome-data-saver

speed-up-chrome-data-saver

3. Use an Ad-Blocker

Not all ads are bad, and you should certainly suffer through them and switch off any ad-blockers on sites that you respect and enjoy reading. But let’s face it, in 90% of the situations, you’ll want to avoid them.

This isn’t just for the reason that they’re ugly, annoying, and sometimes have the cheek to take up your entire screen, but they force your browser to load more elements which puts strain on your PC.

You probably don’t need an invitation to do this, but use an ad blocker. Adblock Plus is a classic, and Ghostery is nice as well if you want to fine-tune what kind of ads you are and aren’t happy to see.

4. Turn on Hardware Acceleration

The graphics card in your computer – whether a rudimentary integrated one or the latest nVidia beast – is an invaluable part of keeping your browsing zippy. In Chrome you can use “hardware acceleration” to utilize your graphics card power for more graphically intensive browser processes.

You can enable hardware acceleration by going to your Chrome Settings and clicking the menu icon at the top left -> Advanced -> System. Next, click the slider next to “Use hardware acceleration when available” to switch it on.

If you’re interested, you can have a look at what aspects of Chrome hardware acceleration is affected by going to chrome://gpu/

speed-up-chrome-hardware-acceleration

speed-up-chrome-hardware-acceleration

5. Use Chrome Task Manager to Disable Unnecessary Processes

Chrome has a built-in task manager made for seeing all those tabs and processes running on it. Simply click the menu icon at the top-right of your Chrome window, More Tools, then Task Manager. (Alternatively, you can press “Shift + Esc” when Chrome is open.)

Here you’ll be able to see which tabs and extensions are using the most memory (Click the Memory column to put them in order of how much memory they’re using.) and subsequently slowing down your browser. If you see a process that’s using up abnormal amounts of memory or CPU, then select it and click “End process.”

speed-up-chrome-task-manager

speed-up-chrome-task-manager

Conclusion

Implementing just one of these settings might not have a profound impact on your browser, but add them together and you’ll start to see the benefits. If you follow these tips, then you’re clearly someone who cares about the speed of your browser anyway and probably already do your due diligence in not having too many extensions, tabs and so on straining Chrome.

Have any of your own tips to speed up Chrome? Share them!

Shared via Inoreader

How to Speed Up Chrome with 5 Easy Tricks

How to Play Music from the Linux Command Line

by Nick Congleton

Make Tech Easier / 0029-07-31 23:55

Playing music from the command line isn’t the right option for everyone. MPD is a command-line option for music playback that requires manual configuration. Some people will love that. It’ll drive others insane. It all depends on how you prefer to use your Linux PC.

MPD and NCMPCPP are a lightweight super combo for playing music with loads of fine-grained control direct from the command line (NCMPCPP is ncurses-based, so technically a text-based user interface).

MPD is also a service that can be accessed by a multitude of other programs that you can use to do some cool customization. It’s also accessible over the network, so you can control it with a compatible client on your phone. In this tutorial we’ll look at how to play music from the Linux terminal with MPD and NCMPCPP.

Install MPD and NCMPCPP

Both programs are available in the repositories of most distributions. If you’re on Ubuntu, they’re definitely there. Install them with apt.

sudo apt install mpd ncmpcpp  

Configure MPD

The default MPD configuration can be found at “/etc/mpd.conf.” You can create per-user configurations, but assuming this is a computer you alone own, you don’t really need to. Just edit the file in your favorite editor withsudo.

sudo vim /etc/mpd.conf  

When you first open the configuration file, you might be intimidated. There are a ton of options there and even more documentation. That’s actually a good thing. You can use the file itself as a reference. Even still, there actually aren’t that many lines that you need to edit to get the MPD service working the way you need it to.

Directories

First, look for the music_directory option. That’s the directory where MPD will look for your music library. Set the option equal to the directory where your music is.

music_directory "/home/user/Music"  

Next, do the same thing with the playlist_directory. This is where MPD (and NCMPCPP) will store and look for playlists.

playlist_directory "/home/user/Music/playlists"  

Options

There are a few options to change in the next section. First, find the user and group options. The defaults here are actually good. If you want to change them, you can.

user    "mpd"  #group    "nogroup"  

The next bit deals with how you’re going to connect to MPD. You want to uncomment the bind_to_address line that’s set to a Unix socket and the port line. It should look like the example below.

bind_to_address    "/run/mpd/socket"  port    "6600"  

Depending on the client, MPD might just start playing the second your computer starts up. If you don’t want that, uncomment and set this line:

restore_paused "yes"  

You’re also probably going to want MPD to automatically detect and add new music that’s added to the music directory. To do so, uncomment the line here:

auto_update    "yes"  

Output

MPD Configuration

MPD Configuration

This next part handles where MPD will output your music. Usually, you’re going to want to use either ALSA or PulseAudio to play everything. If you want to take advantage of a visualizer, you’ll need to set up a FIFO interface too.

ALSA

If you’re using ALSA, you don’t need to do anything. It’s configured by default. You can change any of the #optional values if you have something specific in mind.

audio_output {      type        "alsa"      name        "My ALSA Device"  #   device      "hw:0,0"    # optional  #   mixer_type      "hardware"      # optional  #   mixer_device    "default"   # optional  #   mixer_control   "PCM"       # optional  #   mixer_index "0"     # optional  }  

PulseAudio

Pulse is actually configured; it’s just commented out. Head down to the Pulse section and comment out the lines you need. There are a lot of additional options for Pulse, but they aren’t strictly necessary just to play music.

audio_output {      type        "pulse"      name        "My Pulse Output"  #   server      "remote_server"     # optional  #   sink        "remote_server_sink"    # optional  }  

FIFO

If you’re interested in using a visualizer (NCMPCPP has one built in.), you need to set up FIFO. There isn’t any pre-configured FIFO output in the default configuration. You can make your own, though. Base it off of this:

audio_output {      type                    "fifo"      name                    "fifo_mpd"      path                    "/tmp/mpd.fifo"      format                  "44100:16:2"  }  

That’s it. You can look around some more, but now you have everything that you need.

Add MPD To Audio

MPD needs to be part of the audio user group. Add it.

sudo gpasswd -a mpd audio  

Configure NCMPCPP

With MPD out of the way, you can turn your attention to NCMPCPP. Don’t worry, there isn’t nearly as much to do.

Begin by copying the default NCMPCPP configuration.

mkdir ~/.ncmpcpp  sudo gunzip /usr/share/doc/ncmpcpp/config.gz  sudo cp /usr/share/doc/ncmpcpp/config /home/user/.ncmpcpp/config  sudo chown -R user:user /home/user/.ncmpcpp/config  

Connect To MPD

NCMPCPP Configuration

NCMPCPP Configuration

You need to connect NCMPCPP to MPD. The lines concerning that connection are commented out. Uncomment them.

mpd_host = localhost  mpd_port = 6600  mpd_connection_timeout = 5  

Point NCMPCPP at your music directory. too.

mpd_music_dir = /home/user/Music  mpd_crossfade_time = 2  

Visualizer

First, set the pat to the “.fifo” file that you configured for
MPD.

visualizer_fifo_path = /tmp/mpd.fifo  

Also, set the name of the visualizer to match what you set for FIFO in MPD

visualizer_output_name = fifo_mpd  

Next, take care of some options to make sure that your visualizer stays in sync and looks good.

visualizer_in_stereo = yes  # You might want to play with increasing this value  visualizer_sample_multiplier = 1  visualizer_sync_interval = 30  

This last set of options is purely stylistic. They determine how your visualizer will look. Uncomment the lines and take a look at the available options. Pick what you like best.

## Available values: spectrum, wave, wave_filled, ellipse.  ##  visualizer_type = wave  #  visualizer_look = ●▮  #  #visualizer_color = blue, cyan, green, yellow, magenta, red  #  ## Alternative subset of 256 colors for terminals that support it.  ##  visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161  

Using NCMPCPP

NCMPCPP Playlist

NCMPCPP Playlist

Open a terminal and type in ncmpcpp. The player will open to a blank playlist. NCMPCPP has different panes. Each pane displays something different. They’re all mapped to the number keys, so the playlist you see is on pane 1 and is mapped to the 1 key.

The rest of the panes are as follows:

  • File Browser
  • Search
  • Music Library
  • Playlist Editor/Management
  • Tag Editor (be careful)
  • Outputs
  • Visualizer

Navigate around with the arrow keys. The Library pane lets you move deeper from “Artist” to “Album” and into individual songs with the left and right arrows.

Common Hotkeys

There are way too many hotkeys and controls to cover here. If you want to read them all, this is an excellent resource.

Here are some of the most basic ones, though.

  • Space – Add to playlist
  • Enter – Play
  • > – Next Song
  • < – Previous Song
  • s – Stop
  • p – Pause
  • o – Move to current song
  • z – Toggle Random (shuffle)
  • x – Toggle Crossfade
  • l – Display lyrics
  • S – Save laylist

Take a look around and experiment. You can’t master either of these programs in a day. As with the command line itself, the more experienced and comfortable you get, the more you’ll get out of them.

Shared via Inoreader

How to Play Music from the Linux Command Line

FRP 内网穿透一键脚本 | 适用于Linux服务端

by Lop

热闹网 / 0029-08-01 00:51

FRP 是一个类似 ngrok 的内网穿透工具,它并不像 ngrok 一样有漂亮的官网。但用户体验感丝毫不差,甚至个人感觉比ngrok更方便,更具优势。FRP 支持 TCP/UDP/HTTP/HTTPS 的内网转发。极大的方便了我们进行WEB调试,甚至可以愉快的在家里托管自己的博客。

 

上图是对 FRP 最好的诠释,身处NAT网络环境中的 Server1 & Server2 & Server3 并没有公网IP,所以客户端并不能直接访问,但是通过FRP服务器的转发就可以愉快的进行内网穿透,达到访问它们的目的。

以下脚本转载自Clang 在 koolshare 发布的一键脚本 (备份程序到 FTP服务器)

服务端安装(默认v0.13.0版本)

支持:Centos | Debian | Ubuntu (32bit / 64bit)

 

     wget --no-check-certificate http://ftp.al/install-frps.sh -O ./install-frps.sh     chmod 700 ./install-frps.sh     ./install-frps.sh install     

 

服务器中运行一键程序后,脚本将会自动识别机器的IP地址。同时会提示你选择服务器进行下载。

1 代表通过FTP服务器进行安装
2 代表通过Github服务器进行安装

 

接下来会提示输入以下自定义内容:

Please input frps bind_port [1-65535](Default Server Port: 7000):
#输入frp提供服务的端口,用于服务器端和客户端通信
Please input frps dashboard_port [1-65535](Default dashboard_port: 7500):
#输入frp的控制台服务端口,用于查看frp工作状态
Please input frps vhost_http_port [1-65535](Default vhost_http_port: 80):
#输入frp进行http穿透的http服务端口
Please input frps vhost_https_port [1-65535](Default vhost_https_port: 443):
#输入frp进行https穿透的https服务端口
Please input privilege_token (Default: NZKY0cB4H7q6p0hmubOPrpfGF3qIHnWP):
#输入frp服务器和客户端通信的密码,默认是随机生成的
Please input frps max_pool_count [1-200](Default max_pool_count: 50):
#设置每个代理可以创建的连接池上限,默认50
Enter your choice (1, 2, 3, 4 or exit. default [1]):
#设置日志等级,4个选项,默认是info
Please input frps log_max_days [1-30]
(Default log_max_days: 3 day):
#设置日志保留天数,范围是1到30天,默认保留3天。
Enter your choice (1, 2 or exit. default [1]):
#设置是否开启日志记录,默认开启,开启后日志等级及保留天数生效,否则等级和保留天数无效

 

如果您是第一次安装,建议所有选项均默认配置,也就是直接按回车,程序就会使用默认配置进行安装。

大概不到2分钟,就会安装成功,不会像ngrok那样配置好久。

下面是服务端的相关命令

     /etc/init.d/frps start   #启动frps服务端     /etc/init.d/frps stop    #停止frps服务端     /etc/init.d/frps restart #重启frps服务端     /etc/init.d/frps status  #显示frps状态     /etc/init.d/frps config  #配置frps服务端     /etc/init.d/frps version #显示frps版本     

 

启动成功后,本地访问 http://ip:7500  即可看到WEB控制台。到此安装服务端成功!

Windows 客户端

32位下载地址

64位下载地址

下载解压后,将 frpc.ini 替换为和你服务器相关的配置即可

     [common]     server_addr = #你的服务器IP     server_port = 7000     log_file = ./frpc.log     log_level = info     log_max_days = 3     privilege_token = 12345678 #这里的值需要与服务器保持一致     pool_count = 5     tcp_mux = true     user = your_name     login_fail_exit = true     protocol = tcp     [HTTP_mode]     privilege_mode = true     type = http     local_ip = 127.0.0.1     local_port = 80     custom_domains = #你的域名 | 需A记录指向服务器IP     

 

最后运行 frpc.exe 即可开启客户端,同时您的本地Server 也可以通过域名访问了。

注意:请不要直接点击 frpc.exe 否则会出现frp客户端闪退。原因是因为该程序并未指向配置文件

请通过cmd命令进入frpc.exe所在的目录,然后运行:

     frpc.exe -c frpc.ini     

 

更多内容请参照Github中的frp项目

 

Shared via Inoreader

FRP 内网穿透一键脚本 | 适用于Linux服务端