如何通过辅助IP访问云主机?

时间:2017-11-21 07:12:23

标签: nginx networking ip cloud ubuntu-14.04

Ubuntu的版本是14.04,主机提供商是1and1.com。 我已经为主机配置了两个公共IP,以下是我的/ etc / network / interfaces文件的配置:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card
address {2nd IP address}
netmask 255.255.255.255
broadcast {2nd IP address}
network {2nd IP address ended with 0}

和ifconfig -a输出如下:

eth0      Link encap:Ethernet  HWaddr 00:50:56:12:68:8e
          inet addr:{Primary IP address}  Bcast:{Primary IP address} Mask:255.255.255.255
          inet6 addr: fe80::250:56ff:fe12:688e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1097 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:210260 (210.2 KB)  TX bytes:343976 (343.9 KB)

eth0:0    Link encap:Ethernet  HWaddr 00:50:56:12:68:8e
          inet addr:{2nd IP address}  Bcast:{2nd IP address} Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

所以根据配置,一切都应该没问题,但我不能在外部访问第二个IP,ping正在获取请求超时,如果我将第二个IP设置为任何域的A记录,那么&#39 ; s不工作。如何公开访问第二个IP?

提前致谢。

1 个答案:

答案 0 :(得分:0)

问题解决了,实际上防火墙阻止了第二个IP的所有端口。我只是允许。