您尚未登录。

#1 2015-09-01 09:37:26

csbde
会员
注册时间: 2013-12-04
帖子: 45

53端口被占用,但找不出是哪个程序占用

└─[3] <> sudo netstat -anlp | grep -w LISTEN            
tcp        0      0 0.0.0.0:29917           0.0.0.0:*               LISTEN      1938/wineserver     
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      606/php-fpm: master 
tcp        0      0 127.0.0.1:8911          0.0.0.0:*               LISTEN      1938/wineserver     
tcp        0      0 0.0.0.0:6800            0.0.0.0:*               LISTEN      660/aria2c          
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      657/nginx: master p 
tcp        0      0 0.0.0.0:5298            0.0.0.0:*               LISTEN      1860/pidgin         
tcp        0      0 127.0.0.1:10101         0.0.0.0:*               LISTEN      1938/wineserver     
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1/init              
tcp        0      0 127.0.0.1:8118          0.0.0.0:*               LISTEN      648/privoxy         
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      587/cupsd           
tcp        0      0 127.0.0.1:1080          0.0.0.0:*               LISTEN      639/python          
tcp        0      0 0.0.0.0:8057            0.0.0.0:*               LISTEN      1938/wineserver     
tcp6       0      0 :::3306                 :::*                    LISTEN      562/mysqld          
tcp6       0      0 :::5298                 :::*                    LISTEN      1860/pidgin         
tcp6       0      0 ::1:631                 :::*                    LISTEN      587/cupsd 

看上面是init程序占用了53端口,但init程序不是管理运行级的吗?怎么会占用端口? 如何处理

sudo systemctl status dnsmasq.service 
● dnsmasq.service - A lightweight DHCP and caching DNS server
   Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2015-09-01 09:24:22 CST; 12min ago
     Docs: man:dnsmasq(8)
  Process: 2945 ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file (code=exited, status=2)
  Process: 2944 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 2945 (code=exited, status=2)

Sep 01 09:24:22 SimonT61 systemd[1]: Starting A lightweight DHCP and caching DNS server...
Sep 01 09:24:22 SimonT61 dnsmasq[2944]: dnsmasq: syntax check OK.
Sep 01 09:24:22 SimonT61 systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 01 09:24:22 SimonT61 systemd[1]: Failed to start A lightweight DHCP and caching DNS server.
Sep 01 09:24:22 SimonT61 systemd[1]: dnsmasq.service: Unit entered failed state.
Sep 01 09:24:22 SimonT61 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Sep 01 09:24:22 SimonT61 dnsmasq[2945]: dnsmasq: failed to create listening socket for port 53: Address already in use

离线

#2 2015-09-01 10:48:03

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,917
个人网站

Re: 53端口被占用,但找不出是哪个程序占用

你的 init 是 systemd 啦。systemctl list-sockets 看看。

离线

#3 2015-09-01 11:40:27

csbde
会员
注册时间: 2013-12-04
帖子: 45

Re: 53端口被占用,但找不出是哪个程序占用

谢谢,用systemctl list-sockets 能很清晰的看出来是哪个程序占用了,更改原本软件的端口就可以了。 我对systemd 还只停留在启动关闭和查看状态这几个动作上

离线

#4 2015-09-01 11:46:19

atmouse
会员
注册时间: 2011-08-24
帖子: 701

Re: 53端口被占用,但找不出是哪个程序占用

init占用了53,说明你有个systemd unit 采用socket的形式来启动。
也就是触发式的。

systemctl status dnsmasq.socket 等程序看下

离线

#5 2015-09-01 11:47:33

atmouse
会员
注册时间: 2011-08-24
帖子: 701

Re: 53端口被占用,但找不出是哪个程序占用

我还是建议,不用socket触发方式,而用service

离线

#6 2015-09-01 11:52:44

csbde
会员
注册时间: 2013-12-04
帖子: 45

Re: 53端口被占用,但找不出是哪个程序占用

atmouse 说:

我还是建议,不用socket触发方式,而用service

谢谢,已经解决了,原本是service的,所以冲突,现在改成socket了。

离线

页脚