我试图远程访问我的Blazegraph服务器,它运行在Azure的Ubuntu虚拟机上。所以我想用它的公共IP地址访问服务器,例如51.123.45.234:9999。我改变了Azure中的防火墙设置,允许9999端口的流量进入,但目前我只能通过以下方式访问服务器。
curl 127.0.0.1:9999
curl localhost:9999
当我连接到服务器时,我无法从ssh shell中获取信息。当我在连接的ssh shell上尝试服务器的IP时,我甚至无法与服务器连接。
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0d:3a:28:cd:60
inet addr:10.0.0.4 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::20d:3aff:fe28:cd60/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:208531 errors:0 dropped:328 overruns:0 frame:0
TX packets:178597 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:170613969 (170.6 MB) TX bytes:28500224 (28.5 MB)
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:6387 errors:0 dropped:0 overruns:0 frame:0
TX packets:6387 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:565256 (565.2 KB) TX bytes:565256 (565.2 KB)
该IP是虚拟机所在的虚拟网络的IP,而不是公共网络的IP。
而如果我尝试
curl 10.0.0.4:9999
I get:
curl: (7) Failed to connect to 10.0.0.4 port 9999: Connection refused
I set up up my server following the instructions here.我还改变了我的.ssh/config to:
Host queryserver
LocalForward localhost:9999 127.0.0.1:9999
我还跑了netstat to check if the server is listening:
netstat -ln | grep 9999
tcp6 0 0 127.0.0.1:9999 :::* LISTEN
My iptables shouldn't be the problem:
sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
我怎样才能解决这个问题呢?