frp
下载安装:
[root@13 ~]# tar -zxvf frp_0.33.0_linux_amd64.tar.gz
frp_0.33.0_linux_amd64/
frp_0.33.0_linux_amd64/frps_full.ini
frp_0.33.0_linux_amd64/frps.ini
frp_0.33.0_linux_amd64/frpc
frp_0.33.0_linux_amd64/frpc_full.ini
frp_0.33.0_linux_amd64/frps
frp_0.33.0_linux_amd64/LICENSE
frp_0.33.0_linux_amd64/frpc.ini
frp_0.33.0_linux_amd64/systemd/
frp_0.33.0_linux_amd64/systemd/frpc@.service
frp_0.33.0_linux_amd64/systemd/frpc.service
frp_0.33.0_linux_amd64/systemd/frps.service
frp_0.33.0_linux_amd64/systemd/frps@.service
[root@13 ~]# ls
7.17history.txt mongodb-linux-x86_64-rhel70-3.6.3
anaconda-ks.cfg mongodb-linux-x86_64-rhel70-3.6.3.tgz
apache-tomcat-10.1.25.tar.gz nohup.out
apache-tomcat-9.0.91.tar.gz perl5
a.txt Python-3.12.4
b.txt Python-3.12.4.tgz
code redis-7.2.5.tar.gz
def.txt soft
echo.txt src
folder Start.java
frp_0.33.0_linux_amd64 stu.jar
frp_0.33.0_linux_amd64.tar.gz stus
inotify.sh todolist.jar
jdk-17.0.9_linux-x64_bin.tar.gz vuehtml000
minute.txt
[root@13 ~]#
[root@13 ~]# tree frp_0.33.0_linux_amd64
frp_0.33.0_linux_amd64
├── frpc
├── frpc_full.ini
├── frpc.ini
├── frps
├── frps_full.ini
├── frps.ini
├── LICENSE
└── systemd
├── frpc.service
├── frpc@.service
├── frps.service
└── frps@.service
1 directory, 11 files
[root@13 ~]#
查看文件:
[root@13 ~]# cd frp/
[root@13 frp]# ls
frpc frpc.ini frps_full.ini LICENSE
frpc_full.ini frps frps.ini systemd
[root@13 frp]# vim frpc.ini
[common]
server_addr = 127.0.0.1
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
代理:
[root@13 frp]# vim frpc.ini
[root@13 frp]# cat frpc.ini
[common]
server_addr = 123.249.27.70
server_port = 7000
token=knee@588588
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6038
[root@13 frp]# ./frpc -c frpc.ini
2024/07/19 10:19:33 [I] [service.go:282] [917e1115d972e68c] login to server success, get run id [917e1115d972e68c], server udp port [0]
2024/07/19 10:19:33 [I] [proxy_manager.go:144] [917e1115d972e68c] proxy added: [ssh]
2024/07/19 10:19:33 [I] [control.go:179] [917e1115d972e68c] [ssh] start proxy success
用14主机代理13主机:
14主机:
[root@14 ~]# rz -E
rz waiting to receive.
[root@14 ~]# tsr -zxvf frp_0.33.0_linux_amd64.tar.gz
-bash: tsr: 未找到命令
[root@14 ~]# tar -zxvf frp_0.33.0_linux_amd64.tar.gz
frp_0.33.0_linux_amd64/
frp_0.33.0_linux_amd64/frps_full.ini
frp_0.33.0_linux_amd64/frps.ini
frp_0.33.0_linux_amd64/frpc
frp_0.33.0_linux_amd64/frpc_full.ini
frp_0.33.0_linux_amd64/frps
frp_0.33.0_linux_amd64/LICENSE
frp_0.33.0_linux_amd64/frpc.ini
frp_0.33.0_linux_amd64/systemd/
frp_0.33.0_linux_amd64/systemd/frpc@.service
frp_0.33.0_linux_amd64/systemd/frpc.service
frp_0.33.0_linux_amd64/systemd/frps.service
frp_0.33.0_linux_amd64/systemd/frps@.service
[root@14 ~]# cp -r frp_0.33.0_linux_amd64/ frp/
[root@14 ~]# ls
anaconda-ks.cfg mongodb-linux-x86_64-rhel70-3.6.3
apache-tomcat-10.1.25.tar.gz mongodb-linux-x86_64-rhel70-3.6.3.tgz
apache-tomcat-9.0.91.tar.gz perl5
a.txt Python-3.12.4
b.txt Python-3.12.4.tgz
def.txt redis-7.2.5.tar.gz
echo.txt soft
frp src
frp_0.33.0_linux_amd64 Start.java
frp_0.33.0_linux_amd64.tar.gz stu.jar
jdk-17.0.9_linux-x64_bin.tar.gz stus
minute.txt todolist.jar
[root@14 ~]# vim frp/frps.ini
[root@14 ~]# cat frp/frps.ini
[common]
bind_port = 7000
dashboard_user=aaa
dashboard_pwd=aaa
dashboard_port=7500
[root@14 ~]#
打开7500、7000、6000-6100端口
[root@14 ~]# firewall-cmd --zone=public --add-port=7000/tcp --permanent
success
[root@14 ~]# firewall-cmd --zone=public --add-port=7500/tcp --permanent
success
[root@14 ~]# firewall-cmd --zone=public --add-port=6000-6100/tcp --permanent
success
[root@14 ~]# cd frp
[root@14 frp]# ls
frpc frpc.ini frps_full.ini LICENSE
frpc_full.ini frps frps.ini systemd
[root@14 frp]# ./frps -c frps.ini
2024/07/19 11:24:37 [I] [service.go:178] frps tcp listen on 0.0.0.0:7000
2024/07/19 11:24:37 [I] [service.go:277] Dashboard listen on 0.0.0.0:7500
2024/07/19 11:24:37 [I] [root.go:209] start frps success
2024/07/19 11:27:16 [I] [dashboard_api.go:65] Http request: [/api/serverinfo]
2024/07/19 11:27:16 [I] [dashboard_api.go:58] Http response [/api/serverinfo]: code [200]
2024/07/19 11:27:41 [I] [service.go:432] [691c2dfe325a3f8a] client login info: ip [192.168.2.13:46516] version [0.33.0] hostname [] os [linux] arch [amd64]
2024/07/19 11:27:41 [I] [tcp.go:63] [691c2dfe325a3f8a] [ssh] tcp proxy listen port [6038]
2024/07/19 11:27:41 [I] [control.go:445] [691c2dfe325a3f8a] new proxy [ssh] success
2024/07/19 11:27:47 [I] [dashboard_api.go:65] Http request: [/api/serverinfo]
2024/07/19 11:27:47 [I] [dashboard_api.go:58] Http response [/api/serverinfo]: code [200]
2024/07/19 11:27:55 [I] [dashboard_api.go:180] Http request: [/api/proxy/tcp]
2024/07/19 11:27:55 [I] [dashboard_api.go:174] Http response [/api/proxy/tcp]: code [200]
2024/07/19 11:31:23 [I] [dashboard_api.go:65] Http request: [/api/serverinfo]
2024/07/19 11:31:23 [I] [dashboard_api.go:58] Http response [/api/serverinfo]: code [200]
[root@14 ~]# setenforce 0
[root@14 ~]# systemctl stop firewalld.service
[root@14 ~]#
真机访问192.168.2.14:7500 (用户名aaa 密码 aaa)
13主机:
[root@13 frp]# vim frpc.ini
[root@13 frp]# cat frpc.ini
[common]
server_addr = 192.168.2.14
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6038
[root@13 frp]#
[root@13 frp]# ./frpc -c frpc.ini
2024/07/19 11:22:30 [W] [service.go:101] login to server failed: dial tcp 192.168.2.14:7000: connect: no route to host
dial tcp 192.168.2.14:7000: connect: no route to host
[root@13 frp]# ./frpc -c frpc.ini
2024/07/19 11:26:16 [W] [service.go:101] login to server failed: dial tcp 192.168.2.14:7000: connect: no route to host
dial tcp 192.168.2.14:7000: connect: no route to host
[root@13 frp]# ./frpc -c frpc.ini
2024/07/19 11:27:41 [I] [service.go:282] [691c2dfe325a3f8a] login to server success, get run id [691c2dfe325a3f8a], server udp port [0]
2024/07/19 11:27:41 [I] [proxy_manager.go:144] [691c2dfe325a3f8a] proxy added: [ssh]
2024/07/19 11:27:41 [I] [control.go:179] [691c2dfe325a3f8a] [ssh] start proxy success
14主机代理13主机:
FTP服务概述:
查看是否安装ftp服务:
[root@13 ~]# rpm -qa | grep ftp
vsftpd-3.0.2-22.el7.x86_64
[root@13 ~]# yum list installed |grep ftp
vsftpd.x86_64 3.0.2-22.el7 @mnt
[root@13 ~]#
查看相关文件:
[root@13 ~]# rpm -ql vsftpd
查看是否启动及端口:
[root@13 ~]# systemctl status vsftpd
[root@13 ~]# netstat -lpunt | grep ftp
tcp6 0 0 :::21 :::* LISTEN 54181/vsftpd
[root@13 ~]#
下载ftp lftp:
[root@13 ~]# yum -y install lftp
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 lftp.x86_64.0.4.4.8-14.el7_9 将被 安装
--> 解决依赖关系完成
依赖关系解决
=============================================================================
Package 架构 版本 源 大小
=============================================================================
正在安装:
lftp x86_64 4.4.8-14.el7_9 updates 752 k
事务概要
=============================================================================
安装 1 软件包
总下载量:752 k
安装大小:2.4 M
Downloading packages:
lftp-4.4.8-14.el7_9.x86_64.rpm | 752 kB 00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : lftp-4.4.8-14.el7_9.x86_64 1/1
验证中 : lftp-4.4.8-14.el7_9.x86_64 1/1
已安装:
lftp.x86_64 0:4.4.8-14.el7_9
完毕!
[root@13 ~]# yum -y install ftp
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 ftp.x86_64.0.0.17-67.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=============================================================================
Package 架构 版本 源 大小
=============================================================================
正在安装:
ftp x86_64 0.17-67.el7 base 61 k
事务概要
=============================================================================
安装 1 软件包
总下载量:61 k
安装大小:96 k
Downloading packages:
ftp-0.17-67.el7.x86_64.rpm | 61 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : ftp-0.17-67.el7.x86_64 1/1
验证中 : ftp-0.17-67.el7.x86_64 1/1
已安装:
ftp.x86_64 0:0.17-67.el7
完毕!
[root@13 ~]#
[root@13 ~]# ftp 192.168.2.13
Connected to 192.168.2.13 (192.168.2.13).
220 (vsFTPd 3.0.2)
Name (192.168.2.13:root):
530 Permission denied.
Login failed.
ftp>
ftp> quit
221 Goodbye.
[root@13 ~]#
查看vsftpd的配置文件:
[root@13 ~]# vim /etc/vsftpd/vsftpd.conf
创建用户,加密码:
[root@13 ~]# useradd kehu
[root@13 ~]# echo kehu | passwd --stdin kehu
更改用户 kehu 的密码 。
passwd:所有的身份验证令牌已经成功更新。
[root@13 ~]#
修改配置文件,不允许匿名登录:
[root@13 ~]# vim /etc/vsftpd/vsftpd.conf
12 YES==>NO
[root@13 ~]# systemctl restart vsftpd
14主机安装ftp lftp:
[root@14 ~]# yum -y install ftp lftp
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
mnt | 3.6 kB 00:00
updates | 2.9 kB 00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 ftp.x86_64.0.0.17-67.el7 将被 安装
---> 软件包 lftp.x86_64.0.4.4.8-14.el7_9 将被 安装
--> 解决依赖关系完成
依赖关系解决
=============================================================================
Package 架构 版本 源 大小
=============================================================================
正在安装:
ftp x86_64 0.17-67.el7 base 61 k
lftp x86_64 4.4.8-14.el7_9 updates 752 k
事务概要
=============================================================================
安装 2 软件包
总下载量:812 k
安装大小:2.5 M
Downloading packages:
(1/2): ftp-0.17-67.el7.x86_64.rpm | 61 kB 00:00
(2/2): lftp-4.4.8-14.el7_9.x86_64.rpm | 752 kB 00:03
-----------------------------------------------------------------------------
总计 212 kB/s | 812 kB 00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : lftp-4.4.8-14.el7_9.x86_64 1/2
正在安装 : ftp-0.17-67.el7.x86_64 2/2
验证中 : ftp-0.17-67.el7.x86_64 1/2
验证中 : lftp-4.4.8-14.el7_9.x86_64 2/2
已安装:
ftp.x86_64 0:0.17-67.el7 lftp.x86_64 0:4.4.8-14.el7_9
完毕!
[root@14 ~]#
[root@14 ~]# ftp 192.168.2.13
Connected to 192.168.2.13 (192.168.2.13).
220 (vsFTPd 3.0.2)
Name (192.168.2.13:root): kehu
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,2,13,135,132).
150 Here comes the directory listing.
-rw-r--r-- 1 1012 1013 19 Jul 11 02:27 notice.text
226 Directory send OK.
ftp> quit
221 Goodbye.
[root@14 ~]#
指定用户访问路径、限定目录:
[root@13 ~]# vim /etc/vsftpd/vsftpd.conf
local_root=/data/kehu
100 去#
[root@13 ~]# mkdir -p /data/kehu
[root@13 ~]# systemctl restart vsftpd
[root@13 ~]#
[root@13 ~]# cd /data/kehu/
[root@13 kehu]# dd if=/dev/zero of=bigfire0 bs=3M count=1
记录了1+0 的读入
记录了1+0 的写出
3145728字节(3.1 MB)已复制,0.00360698 秒,872 MB/秒
[root@13 kehu]# dd if=/dev/zero of=bigfire1 bs=3M count=1
记录了1+0 的读入
记录了1+0 的写出
3145728字节(3.1 MB)已复制,0.00331698 秒,948 MB/秒
[root@13 kehu]# dd if=/dev/zero of=bigfire2 bs=3M count=1
记录了1+0 的读入
记录了1+0 的写出
3145728字节(3.1 MB)已复制,0.00371008 秒,848 MB/秒
[root@13 kehu]# systemctl restart vsftpd
[root@13 kehu]#
14主机实现:
[root@14 ~]# ftp 192.168.2.13
Connected to 192.168.2.13 (192.168.2.13).
220 (vsFTPd 3.0.2)
Name (192.168.2.13:root): kehu
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,2,13,33,227).
150 Here comes the directory listing.
226 Directory send OK.
ftp> ls
227 Entering Passive Mode (192,168,2,13,124,102).
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 3145728 Jul 19 07:58 bigfire0
-rw-r--r-- 1 0 0 3145728 Jul 19 08:07 bigfire1
-rw-r--r-- 1 0 0 3145728 Jul 19 08:07 bigfire2
226 Directory send OK.