![特定のIPのリスニングポートを停止する](https://rvso.com/image/1520711/%E7%89%B9%E5%AE%9A%E3%81%AEIP%E3%81%AE%E3%83%AA%E3%82%B9%E3%83%8B%E3%83%B3%E3%82%B0%E3%83%9D%E3%83%BC%E3%83%88%E3%82%92%E5%81%9C%E6%AD%A2%E3%81%99%E3%82%8B.png)
複数のネットワーク インターフェイスを備えた SIP サーバーがあります。(仮想) コマンドを実行すると、netstat -nlput
以下のようにすべてのリッスン IP とポートが表示されます。
root@DUO-CALLSERVER004:/etc/init.d# netstat -nlput
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:111 0.0.0.0:* LISTEN 723/rpcbind
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.238:8021 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1835/sshd
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 1868/nrpe
tcp 0 0 172.20.112.118:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.117:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.114:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.112:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.110:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.238:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.111:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.116:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 172.20.112.115:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp 0 0 192.168.52.108:5060 0.0.0.0:* LISTEN 21036/freeswitch
tcp6 0 0 :::111 :::* LISTEN 723/rpcbind
tcp6 0 0 :::22 :::* LISTEN 1835/sshd
tcp6 0 0 :::5666 :::* LISTEN 1868/nrpe
udp 0 0 172.20.112.118:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.117:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.114:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.112:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.110:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.238:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.111:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.116:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 172.20.112.115:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 192.168.52.108:5060 0.0.0.0:* 21036/freeswitch
udp 0 0 0.0.0.0:111 0.0.0.0:* 723/rpcbind
udp 0 0 0.0.0.0:731 0.0.0.0:* 723/rpcbind
udp6 0 0 :::111 :::* 723/rpcbind
udp6 0 0 :::731 :::* 723/rpcbind
私がしたいのは、172.20.112.117:5060 でリッスンしているポート 5060 を強制終了することです。しかし、同じ PID を使用して同じポートをリストしている別の IP セットもあります。これらを強制終了したくありません。172.20.112.117 IP のみを 5060 ポートから解放する必要があります。これを行う方法はありますか?
答え1
プロセスを正しいアドレスにのみバインドするように設定してください0.0.0.0
。プロセスがフリースイッチ設定を確認する必要があります。メーリングリスト(古いですが)
おい、デフォルト設定からそのままだ:
<!-- bind_server_ip
Can be an ip address, a dns name, or "auto".
This determines an ip address available on this host to bind.
If you are separating RTP and SIP traffic, you will want to have
use different addresses where this variable appears.
Used by: sofia.conf.xml dingaling.conf.xml
-->
<X-PRE-PROCESS cmd="set" data="bind_server_ip=auto"/>
あるいは、ウィキ。