Linux systemd-resolve占用53端口的解决方法

在Linux系统中有些软件(如:Dnsmasq解锁Netflix中的Dns等服务)可能要用到53的端口,但有些系统提示已使用(required port 53 already in use )。

使用**“netstat -tlunp|grep 53**”查看53端口是不是systemd-resolved占用了。如果是,下面是解决方法可以试试看对你有没有帮助。

1、先停用 systemd-resolved 服务

systemctl stop systemd-resolved

2、编辑 /etc/systemd/resolved.conf 文件

vi /etc/systemd/resolved.conf

3、换下面说明更改,然后按一下“esc”键,再输入“:wq”(不要输入引号),回车保存即可。

[Resolve]
DNS=8.8.8.8  #取消注释,增加dns
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
DNSStubListener=no  #取消注释,把yes改为no

4、最后运行下面命令即可。

ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
### Linux Web Server Port Already In Use and Kill Command Not Working When encountering a situation where the web server cannot start because port 10023 is occupied by another process, and using `kill -9` does not terminate this process effectively, several strategies can help resolve the issue. A common misconception might lead one to believe that simply killing the offending process would free up the port immediately; however, sometimes processes do not respond as expected or may restart automatically depending on how they are managed within the system. Instead of relying solely on forceful termination methods like `kill -9`, consider these alternatives: #### Verify Process Ownership Firstly, identify which application owns the problematic port with greater precision than just finding its PID (Process ID). This approach ensures no critical services are inadvertently disrupted when attempting resolution actions. ```bash sudo lsof -i :10023 ``` This command lists all connections associated with port 10023 along with detailed information about each connection including owner details[^1]. #### Adjust Kernel Parameters Temporarily If binding issues arise due to kernel restrictions such as those mentioned regarding non-local IP bindings, adjusting relevant parameters temporarily could provide relief without modifying core configurations permanently: ```bash echo "1" | sudo tee /proc/sys/net/ipv4/ip_nonlocal_bind ``` Note that changing certain settings requires administrative privileges and should only occur after careful consideration since it affects network behavior globally across the entire machine. #### Restart Network Services Gracefully Instead of forcefully terminating specific PIDs via `kill -9`, restarting networking components gracefully often resolves lingering socket states more reliably while minimizing potential side effects: ```bash sudo systemctl restart network-manager.service # Or for older systems using init.d scripts instead of systemd units sudo service network-manager restart ``` For cases involving database listeners specifically bound to particular ports similar to what was described concerning Oracle instances listening on custom ports outside default ranges[^2]: - Ensure proper configuration files reflect intended operational modes post-restart. - Validate firewall rules permit necessary traffic patterns through specified endpoints before assuming connectivity problems stem from local resource conflicts alone. By following above suggestions rather than exclusively focusing on brute-force approaches towards managing stuck resources, smoother resolutions become attainable even under challenging circumstances encountered during troubleshooting sessions related to web servers operating inside Linux environments.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值