特定のIPのリスニングポートを停止する

特定のIPのリスニングポートを停止する

複数のネットワーク インターフェイスを備えた 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"/>

あるいは、ウィキ

関連情報