ehang-io / nps

一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
https://ehang.io/nps/documents
GNU General Public License v3.0
29.75k stars 5.37k forks source link

重启后只监听ipv6端口不监听ipv4端口 #1158

Open NovaShen0724 opened 1 year ago

NovaShen0724 commented 1 year ago

在一次重启后,我发现nps无法访问,查看端口占用发现ipv4的端口空着但是nps并未使用,反而使用ipv6的端口监听 而我的服务器又没有ipv6地址,导致只能内网访问,求教!感谢! 端口查询结果

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      1470/nginx: master
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      1139/dovecot
tcp        0      0 0.0.0.0:7010            0.0.0.0:*               LISTEN      1470/nginx: master
tcp        0      0 0.0.0.0:1443            0.0.0.0:*               LISTEN      27542/nginx: master
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      1139/dovecot
tcp        0      0 127.0.0.1:10024         0.0.0.0:*               LISTEN      1933/amavisd (maste
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      4245/docker-proxy
tcp        0      0 0.0.0.0:8777            0.0.0.0:*               LISTEN      1470/nginx: master
tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      1359/master
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2186/mysqld
tcp        0      0 0.0.0.0:8010            0.0.0.0:*               LISTEN      1470/nginx: master
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      1359/master
tcp        0      0 127.0.0.1:9005          0.0.0.0:*               LISTEN      1098/php-fpm: maste
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      1139/dovecot
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN      1312/spamd.pid -d -
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      1139/dovecot
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      1359/master
tcp        0      0 0.0.0.0:180             0.0.0.0:*               LISTEN      27542/nginx: master
tcp        0      0 0.0.0.0:8020            0.0.0.0:*               LISTEN      1470/nginx: master
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1433/sshd
tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN      4441/docker-proxy
tcp        0      0 0.0.0.0:7000            0.0.0.0:*               LISTEN      1470/nginx: master
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1359/master
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN      1139/dovecot
tcp6       0      0 :::1443                 :::*                    LISTEN      27542/nginx: master
tcp6       0      0 :::10280                :::*                    LISTEN      23823/nps
tcp6       0      0 :::27017                :::*                    LISTEN      4250/docker-proxy
tcp6       0      0 :::10222                :::*                    LISTEN      23823/nps
tcp6       0      0 ::1:783                 :::*                    LISTEN      1312/spamd.pid -d -
tcp6       0      0 :::80                   :::*                    LISTEN      23823/nps
tcp6       0      0 :::8080                 :::*                    LISTEN      23823/nps
tcp6       0      0 :::180                  :::*                    LISTEN      27542/nginx: master
tcp6       0      0 :::22                   :::*                    LISTEN      1433/sshd
tcp6       0      0 :::8024                 :::*                    LISTEN      23823/nps
tcp6       0      0 :::3000                 :::*                    LISTEN      4446/docker-proxy
tcp6       0      0 :::443                  :::*                    LISTEN      23823/nps
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1030/dhclient
udp        0      0 10.0.12.2:123           0.0.0.0:*                           675/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           675/ntpd

nps配置文件

appname = nps
#Boot mode(dev|pro)
runmode = dev

#HTTP(S) proxy port, no startup if empty
http_proxy_ip=127.0.0.1:8080
http_proxy_port=80
https_proxy_port=443
https_just_proxy=true
#default https certificate setting
https_default_cert_file=conf/server.pem
https_default_key_file=conf/server.key

##bridge
bridge_type=tcp
bridge_port=8024
bridge_ip=0.0.0.0

# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=123

#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1

# log level LevelEmergency->0  LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log

#Whether to restrict IP access, true or false or ignore
#ip_limit=true

#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000

#web
web_host=a.o.com
web_username=admin
web_password=zxcvbnm?2
web_port = 8080
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=conf/server.pem
web_key_file=conf/server.key
# if web under proxy use sub path. like http://host/nps need this.
#web_base_url=/nps

#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
#Remove comments if needed
#auth_key=test
auth_crypt_key =1234567812345678

#allow_ports=9001-9009,10001,11000-12000

#Web management multi-user login
allow_user_login=true
allow_user_register=true
allow_user_change_username=true

#extension
allow_flow_limit=false
allow_rate_limit=false
allow_tunnel_num_limit=false
allow_local_proxy=false
allow_connection_num_limit=false
allow_multi_ip=false
system_info_display=false

#cache
http_cache=false
http_cache_length=100

#get origin ip
http_add_origin_header=false

#pprof debug options
#pprof_ip=0.0.0.0
#pprof_port=9999

#client disconnect timeout
disconnect_timeout=60
simonkimi commented 12 months ago

我也遇到了相同的问题

>>> lsof -i | grep nps
nps       973528            root    7u  IPv6 41169967      0t0  TCP *:http-alt (LISTEN)
nps       973528            root    8u  IPv6 41169964      0t0  TCP *:8024 (LISTEN)
nps       973528            root   10u  IPv6 41168852      0t0  TCP *:20443 (LISTEN)
nps       973528            root   11u  IPv6 41168854      0t0  TCP *:20080 (LISTEN)
snakewqq commented 7 months ago

遇到同样问题,太神奇了,是不是版本bug,我试了直接启动服务,和用docker启nps服务,都是只有ipv6监听。(不知道是不是我用群晖的关系)

snakewqq commented 7 months ago

试了其他版本,问题依旧

WJQSERVER commented 7 months ago

我也遇到了同样的问题,我的服务器有ipv6地址也无法访问,Debian12

amd6700k commented 3 months ago

华为云centos7.9也有同样问题

NovaShen555 commented 3 months ago

华为云centos7.9也有同样问题

重启,重新配docker,其他的不懂该怎么办

hs233666 commented 2 months ago

我也是 二进制文件直接运行 只监听ipv6

NovaShen555 commented 2 months ago

我也是 二进制文件直接运行 只监听ipv6

多重启几次试试,或者用docker