通向面包的小路蜿蜒于劳动的沼泽之中,通向衣裳的小路从一块无花的土地中穿过,无论是通向面包的路还是通向衣裳的路,都是一段艰辛的历程。——福斯
这个问题是由于chrome
禁用了部分端口:
https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc
这里的:
// The general list of blocked ports. Will be blocked unless a specific // protocol overrides it. (Ex: ftp can use port 21) // When adding a port to the list, consider also adding it to kAllowablePorts, // below. const int kRestrictedPorts[] = { 1, // tcpmux 7, // echo 9, // discard 11, // systat 13, // daytime 15, // netstat 17, // qotd 19, // chargen 20, // ftp data 21, // ftp access 22, // ssh 23, // telnet 25, // smtp 37, // time 42, // name 43, // nicname 53, // domain 69, // tftp 77, // priv-rjs 79, // finger 87, // ttylink 95, // supdup 101, // hostriame 102, // iso-tsap 103, // gppitnp 104, // acr-nema 109, // pop2 110, // pop3 111, // sunrpc 113, // auth 115, // sftp 117, // uucp-path 119, // nntp 123, // NTP 135, // loc-srv /epmap 137, // netbios 139, // netbios 143, // imap2 161, // snmp 179, // BGP 389, // ldap 427, // SLP (Also used by Apple Filing Protocol) 465, // smtp+ssl 512, // print / exec 513, // login 514, // shell 515, // printer 526, // tempo 530, // courier 531, // chat 532, // netnews 540, // uucp 548, // AFP (Apple Filing Protocol) 554, // rtsp 556, // remotefs 563, // nntp+ssl 587, // smtp (rfc6409) 601, // syslog-conn (rfc3195) 636, // ldap+ssl 989, // ftps-data 990, // ftps 993, // ldap+ssl 995, // pop3+ssl 1719, // h323gatestat 1720, // h323hostcall 1723, // pptp 2049, // nfs 3659, // apple-sasl / PasswordServer 4045, // lockd 5060, // sip 5061, // sips 6000, // X11 6566, // sane-port 6665, // Alternate IRC [Apple addition] 6666, // Alternate IRC [Apple addition] 6667, // Standard IRC [Apple addition] 6668, // Alternate IRC [Apple addition] 6669, // Alternate IRC [Apple addition] 6697, // IRC + TLS 10080, // Amanda };
端口都是用不了的
参考:https://jazzy.id.au/2012/08/23/why_does_chrome_consider_some_ports_unsafe.html
主要是防止黑客,例如smtp(25/465/587)
端口,即便这些smtp
服务被防火墙保护,但黑客也能通过smtp
背后的浏览器,对服务端发送一封脚本邮件进行攻击
如果非要使用,可以按照这篇博客进行配置:
https://www.applenice.net/2019/06/04/ERR-UNSAFE-PORT-On-Browser/
那么,当使用6666端口的时候发生了什么,查了一下
ERR_UNSAFE_PORT
,出现该问题的原因主要是因为6666-6669这几个端口是IRC协议使用的缺省端口,存在很大的安全风险,出于安全考虑,Chrome、Firefox都禁止了对6666端口的访问。那么如果一定要使用6666端口呢?
我使用的系统是Windows 10,使用Chrome版本为
74.0.3729.169
,方法如下:复制
Google Chrome的图标->右键->属性->目标
在目标值后面追加:
复制
--explicitly-allowed-ports=6666
如果有多个值的话,用逗号隔开即可,关闭浏览器,重启启动,此时访问http://192.168.1.2:6666/ 就可以下载相应的文件了。
使用Firefox的话,可以通过如下方式解决:
在Firefox地址栏输入
about:config
,右键->新建一个字符串键network.security.ports.banned.override
,值的内容填端口号6666,需要放行多个端口的话使用逗号隔开。出于安全考虑,还是应该更换端口,不可能其他机器都如此设置,增大安全风险。
另外,Chrome认为有风险进行阻断的端口在Chromium源码中已经列出,使用时要注意规避:
https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc