多个 ip 具有相同的端口

多个 ip 具有相同的端口

我正在尝试使用多个 IP 地址并运行相同的端口。这适用于 multicraft 和专用 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

允许在同一台机器上使用多个 multicraft 实例,所有实例都使用相同的端口,您需要为每个实例设置一个特定的地址。如果实例配置为使用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为真实地址。

相关内容