背景
我们网络环境的特殊性,尤其是跨越运营商时;80端口是很敏感而被封锁着的。那么如何把OpenWrt(路由器系统)的默认端口从默认的80端口改到其他的端口呢?SSH局域网内配置修改步骤如下。
步骤
- 使用SSH连接到OpenWrt
-
1. Terminal 运行 ssh [email protected] 如果提示错误: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is SHA256:62NIyqmMPzrJKil2jKX74MqnU/6xASo0SWfArXejsPQ. Please contact your system administrator. Add correct host key in /Users/***/.ssh/known_hosts to get rid of this message. Offending RSA key in /Users/***/.ssh/known_hosts:12 Host key for 192.168.6.1 has changed and you have requested strict checking. Host key verification failed. 就需要我们把/Users/***/.ssh 目录下的“known_hosts”删除,重试一下即可。 2. 输入root用户的密码,登录到状态,类似信息: BusyBox v1.25.1 () built-in shell (ash) _________ / /\ _ ___ ___ ___ / LE / \ | | | __| \| __| / DE / \ | |__| _|| |) | _| /________/ LE \ |____|___|___/|___| lede-project.org \ \ DE / \ LE \ / ----------------------------------------------------------- \ DE \ / Reboot (17.01-SNAPSHOT, r4046-beaa2ecc10) \________\/ -----------------------------------------------------------
- 登录后,修改配置文件
-
1. cd /etc/config 2. cat uhttpd【可选步骤, 查看现有文件内容】 3. vi uhttpd 4. (i 命令)修改成下面这样从80,改为8080(举个例子) config uhttpd 'main' list listen_http '0.0.0.0:8080' list listen_http '[::]:8080' list listen_https '0.0.0.0:443' list listen_https '[::]:443' ..... 5. 修改完成后保存(:wq) 6. 重启uhttpd(或重启路由器) /etc/init.d/uhttpd restart