mac使用隧道协议

 因本次项目,需要使用隧道协议访问运维页面,windows系统使用xshell就可以打隧道,但mac电脑没有xshell,只能使用finalshell工具使用隧道模式,如下:

 但是基于mac系统和centos系统类似。不能使用1024以下端口,隧道监听本地端口为8080.

修改电脑/etc/hosts/ 为:

127.0.0.1        www.xxxxxx.com:8080

即可正常访问,如果不想加入端口,请往下看:

在mac电脑上

打开sudo vim /etc/pf.anchors/eclipse.tomcat.forwarding 文件:

加入:

rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 8080 (隧道协议转发的端口)
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 443 -> 127.0.0.1 port 8443 (如无https协议可以注释掉)

打开:sudo vim /etc/pf-tomcat.conf

加入:

rdr-anchor "forwarding"
load anchor "forwarding"from "/etc/pf.anchors/eclipse.tomcat.forwarding"

启动服务

sudo pfctl -ef /etc/pf-tomcat.conf

关闭:

sudo pfctl -d

修改完成,修改/etc/hosts/文件

127.0.0.1     www.xxxxx.com

保存退出,即可正常访问域名。

猜你喜欢

转载自www.cnblogs.com/lsolation/p/12965855.html