여러 IP가 동일한 포트를 갖습니다.

여러 IP가 동일한 포트를 갖습니다.

여러 IP 주소를 사용하고 동일한 포트를 실행하려고 합니다. 이는 다중 기술 및 전용 IP 주소에 적용됩니다.

내 네트워크 인터페이스는 다음과 같이 설정되어 있습니다.

ifcfg-eno1
ifcfg-eno1:0 
ifcfg-eno1:1
ifcfg-eno1:2
ifcfg-eno1:3

그리고 IP 주소를 192.xxx.xxx.147,148,149,150으로 변경하세요.

ping을 하면 서버로 돌아가지만 multicraft를 사용하려고 하면 포트에 바인딩할 수 없습니다.

이것이 인터페이스입니다(각 인터페이스의 IP를 변경하면 됩니다).

DEVICE="eno1"
ONBOOT=yes
NETBOOT=yes
UUID="14081356-1da3-49ca-a25d-3ed9fe2fcd32"
IPV6INIT=yes
BOOTPROTO=none
TYPE=Ethernet
DNS1=127.0.0.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPADDR=192.xxx.xxx.146
PREFIX=29
GATEWAY=192.xxx.xxx.145
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

실수:

WARN **** FAILED TO BIND TO PORT!
13.03 01:41:25 [Server] WARN The exception was: java.net.BindException: Address already in use
13.03 01:41:25 [Server] WARN Perhaps a server is already running on that port?

네트워크 통계 출력:

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:21              0.0.0.0:*               LISTEN      11397/multicraft    
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      24745/named         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      24771/sshd          
tcp        0      0 0.0.0.0:25465           0.0.0.0:*               LISTEN      11397/multicraft    
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      24745/named         
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1841/master         
tcp        0      0 0.0.0.0:25565           0.0.0.0:*               LISTEN      7912/java           
tcp6       0      0 :::3306                 :::*                    LISTEN      22341/mysqld        
tcp6       0      0 :::80                   :::*                    LISTEN      1555/httpd          
tcp6       0      0 ::1:53                  :::*                    LISTEN      24745/named         
tcp6       0      0 :::8118                 :::*                    LISTEN      19667/java          
tcp6       0      0 :::22                   :::*                    LISTEN      24771/sshd          
tcp6       0      0 ::1:953                 :::*                    LISTEN      24745/named         
tcp6       0      0 ::1:25                  :::*                    LISTEN      1841/master         
tcp6       0      0 :::443                  :::*                    LISTEN      1555/httpd          
tcp6       0      0 192.xxx.xxx.146:25567   :::*                    LISTEN      22781/java          
tcp6       0      0 192.xxx.xxx.146:8192    :::*                    LISTEN      19667/java          
tcp6       0      0 192.xxx.xxx.146:25568   :::*                    LISTEN      19667/java          
tcp6       0      0 192.xxx.xxx.146:8193    :::*                    LISTEN      15346/java          
tcp6       0      0 192.xxx.xxx.146:25569   :::*                    LISTEN      11462/java          
tcp6       0      0 192.xxx.xxx.146:25570   :::*                    LISTEN      15346/java          
tcp6       0      0 192.xxx.xxx.147:25571   :::*                    LISTEN      20296/java          
tcp6       0      0 :::25575                :::*                    LISTEN      7912/java           
udp        0      0 127.0.0.1:53            0.0.0.0:*                           24745/named         
udp        0      0 0.0.0.0:25565           0.0.0.0:*                           7912/java           
udp6       0      0 ::1:53                  :::*                                24745/named         
udp6       0      0 192.xxx.xxx.146:25568   :::*                                19667/java          
raw6       0      0 :::58                   :::*                    7           673/NetworkManager  
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     8458     1/systemd            /run/systemd/journal/stdout
unix  2      [ ACC ]     STREAM     LISTENING     9741     1/systemd            /run/lvm/lvmetad.socket
unix  2      [ ACC ]     STREAM     LISTENING     9761     1/systemd            /run/lvm/lvmpolld.socket
unix  2      [ ACC ]     STREAM     LISTENING     12606    1/systemd            /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     15793    1841/master          public/pickup
unix  2      [ ACC ]     STREAM     LISTENING     15797    1841/master          public/cleanup
unix  2      [ ACC ]     STREAM     LISTENING     15800    1841/master          public/qmgr
unix  2      [ ACC ]     STREAM     LISTENING     15804    1841/master          private/tlsmgr
unix  2      [ ACC ]     STREAM     LISTENING     15807    1841/master          private/rewrite
unix  2      [ ACC ]     STREAM     LISTENING     15810    1841/master          private/bounce
unix  2      [ ACC ]     STREAM     LISTENING     15813    1841/master          private/defer
unix  2      [ ACC ]     STREAM     LISTENING     15816    1841/master          private/trace
unix  2      [ ACC ]     STREAM     LISTENING     80989    1/systemd            /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     15819    1841/master          private/verify
unix  2      [ ACC ]     STREAM     LISTENING     15822    1841/master          public/flush
unix  2      [ ACC ]     STREAM     LISTENING     15825    1841/master          private/proxymap
unix  2      [ ACC ]     STREAM     LISTENING     15828    1841/master          private/proxywrite
unix  2      [ ACC ]     STREAM     LISTENING     15831    1841/master          private/smtp
unix  2      [ ACC ]     STREAM     LISTENING     15834    1841/master          private/relay
unix  2      [ ACC ]     STREAM     LISTENING     15837    1841/master          public/showq
unix  2      [ ACC ]     STREAM     LISTENING     15840    1841/master          private/error
unix  2      [ ACC ]     STREAM     LISTENING     15843    1841/master          private/retry
unix  2      [ ACC ]     STREAM     LISTENING     15846    1841/master          private/discard
unix  2      [ ACC ]     STREAM     LISTENING     15849    1841/master          private/local
unix  2      [ ACC ]     STREAM     LISTENING     15852    1841/master          private/virtual
unix  2      [ ACC ]     STREAM     LISTENING     15855    1841/master          private/lmtp
unix  2      [ ACC ]     STREAM     LISTENING     15858    1841/master          private/anvil
unix  2      [ ACC ]     STREAM     LISTENING     15861    1841/master          private/scache
unix  2      [ ACC ]     STREAM     LISTENING     67741    22341/mysqld         /var/lib/mysql/mysql.sock
unix  2      [ ACC ]     SEQPACKET  LISTENING     78068    1/systemd            /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     14841    673/NetworkManager   /var/run/NetworkManager/private

구성된 경우:

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.xxx.xxx.146  netmask 255.255.255.248  broadcast 192.xxx.xxx.151
    inet6 fe80::7254:d2ff:feab:bebf  prefixlen 64  scopeid 0x20<link>
    ether 70:54:d2:ab:be:bf  txqueuelen 1000  (Ethernet)
    RX packets 177249286  bytes 48701330667 (45.3 GiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 282601048  bytes 51923351153 (48.3 GiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device interrupt 20  memory 0xf7f00000-f7f20000  

eno1:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.xxx.xxx.147  netmask 255.255.255.248  broadcast 192.xxx.xxx.151
        ether 70:54:d2:ab:be:bf  txqueuelen 1000  (Ethernet)
        device interrupt 20  memory 0xf7f00000-f7f20000  

eno1:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.xxx.xxx.148  netmask 255.255.255.248  broadcast 192.xxx.xxx.151
        ether 70:54:d2:ab:be:bf  txqueuelen 1000  (Ethernet)
        device interrupt 20  memory 0xf7f00000-f7f20000  

eno1:2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.xxx.xxx.149  netmask 255.255.255.248  broadcast 192.xxx.xxx.151
        ether 70:54:d2:ab:be:bf  txqueuelen 1000  (Ethernet)
        device interrupt 20  memory 0xf7f00000-f7f20000  

eno1:3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.xxx.xxx.150  netmask 255.255.255.248  broadcast 192.xxx.xxx.151
        ether 70:54:d2:ab:be:bf  txqueuelen 1000  (Ethernet)
        device interrupt 20  memory 0xf7f00000-f7f20000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 1815319739  bytes 455426211814 (424.1 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1815319739  bytes 455426211814 (424.1 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

다중 프로세스 회의:http://pastebin.com/q006LR24

답변1

동일한 머신에서 모두 동일한 포트를 사용하는 다중 다중 인스턴스를 허용하려면 각 인스턴스에 대해 특정 주소를 설정해야 합니다. 인스턴스가 이를 사용하도록 구성된 경우 0.0.0.0모든 인터페이스에 바인딩되며 다른 인스턴스는 바인딩할 수 없습니다.

예, 주소의 예:

## The daemon will listen on the following IP/port.
## 0.0.0.0 to listen on all available interfaces (all IPs). Note that
## you will have to use the "externalIp" setting below if you set this
## to 0.0.0.0 as the control panel needs to know where to connect.
ip = 192.xxx.xxx.147
port = 25465

192.xxx.xxx.147이 주소를 실제 주소로 변경해야 합니다 .

관련 정보