A-A+

公司内部办公网IP端口映射到互联网

2023年07月11日 10:40 学习笔记 暂无评论 共2226字 (阅读310 views次)

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】

今天有一个需求,就是办公网的电脑要映射一些端口到互联网。比较巧合的是,公司内有一个小机房,部分端口已经被占用。测试环境与公司的办公环境是打通的。因为测试环境IP段和公有云也是打通的。这样就可以在公有云中购买一台服务器,然后购买一个面向互联网的IP,然后做流量转发即可。

首先在测试环境开通一台面向互联网开放指定端口的公有云服务器。然后在此服务器做如下配置:

 

1 2023-07-11 10:38:17
2 2023-07-10 17:27:42 hostnamectl set-hostname hjzx-zhuanfa
3 2023-07-10 17:28:20 exit
4 2023-07-10 17:28:58 telnet 172.11.35.3 6001
5 2023-07-10 17:29:09 systemctl start firewalld
6 2023-07-10 17:29:10 firewall-cmd --add-masquerade --permanent
7 2023-07-10 17:29:17 firewall-cmd --add-forward-port=port=6001:proto=tcp:toport=6001:toaddr=172.11.35.3 --permanent
8 2023-07-10 17:29:18 firewall-cmd --add-forward-port=port=16021:proto=tcp:toport=16021:toaddr=172.11.35.3 --permanent
9 2023-07-10 17:30:29 for i in {16055..16199};do firewall-cmd --add-forward-port=port=$i:proto=tcp:toport=$i:toaddr=172.11.35.3 --permanent;done
10 2023-07-10 17:31:55 for i in {6400..6499};do firewall-cmd --add-forward-port=port=$i:proto=tcp:toport=$i:toaddr=172.11.35.3 --permanent;done
11 2023-07-10 17:32:39 systemctl staus firewalld
12 2023-07-10 17:32:42 systemctl status firewalld
13 2023-07-10 17:32:45 systemctl status firewalld -l
14 2023-07-10 17:32:55 firewall-cmd list
15 2023-07-10 17:33:01 netstat -netlp
16 2023-07-10 17:33:02 ping 172.21.35.3
17 2023-07-10 17:33:13 firewall --list
18 2023-07-10 17:33:20 firewall -cmd list
19 2023-07-10 17:33:22 history
20 2023-07-10 17:33:30 firewall --list
21 2023-07-10 17:33:32 firewall-cmd --list-all
22 2023-07-10 17:33:46 firewall-cmd --reload
23 2023-07-10 17:33:48 firewall-cmd --list-all
24 2023-07-10 17:33:53 firewall -cmd list
25 2023-07-10 17:33:57 firewall --cmd list
26 2023-07-10 17:34:36 firewall -cmd --list
27 2023-07-10 17:34:42 firewall -cmd --listall
28 2023-07-10 17:34:44 firewall -cmd --list all
29 2023-07-10 17:34:50 firewall --cmd --list all
30 2023-07-10 17:34:53 firewall --cmd list all
31 2023-07-10 17:34:56 firewall -cmd list all
32 2023-07-10 17:35:06 firewall -cmd list all
33 2023-07-10 17:35:14 firewall-cmd --list-all
34 2023-07-10 17:35:18 history
35 2023-07-10 17:35:29 firewall -cmd --list all
36 2023-07-10 17:35:31 firewall -cmd --list-all
37 2023-07-10 17:35:41 firewall-cmd --list-all\
38 2023-07-10 17:35:43 ip a
39 2023-07-10 17:37:47 firewall -cmd --list-allfirewall-cmd --list-all
40 2023-07-10 17:37:49 firewall-cmd --list-all
41 2023-07-10 17:39:51 history
42 2023-07-10 17:44:07 iftop
43 2023-07-10 17:47:21 df -h
44 2023-07-10 17:47:23 iftop
45 2023-07-10 17:47:31 iftop
46 2023-07-10 18:00:22 exit

布施恩德可便相知重

微信扫一扫打赏

支付宝扫一扫打赏

×

给我留言