端口9000上的hadoop连接被拒绝virtualbox端口9000转发无法与桥接适配器一起工作

9rygscc1  于 2021-05-31  发布在  Hadoop
关注(0)|答案(1)|浏览(388)

我在virtualbox ubuntu上安装了hadoop。所有端口都通过网桥适配器转发到windows。但端口9000不可用。我已经禁用了windows defender、防火墙和smartscreen。
乌班图:

user@vrtualBox:~/hadoop/hadoop-2.10.0$ netstat -lntu
active internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State      
tcp        0      0 0.0.0.0:50010           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50075           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50020           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50090           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:33201         0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50070           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp6       0      0 :::13562                :::*                    LISTEN     
tcp6       0      0 :::8030                 :::*                    LISTEN     
tcp6       0      0 :::8031                 :::*                    LISTEN     
tcp6       0      0 :::8032                 :::*                    LISTEN     
tcp6       0      0 :::8033                 :::*                    LISTEN     
tcp6       0      0 :::8040                 :::*                    LISTEN     
tcp6       0      0 :::8042                 :::*                    LISTEN     
tcp6       0      0 :::42835                :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 :::8088                 :::*                    LISTEN

ser@vrtualBox:~/hadoop/hadoop-2.10.0$ sudo iptables -S
[sudo] password for user: 
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT

Windows:

PS C:\Windows\system32> Test-NetConnection -ComputerName 192.168.0.12 -Port 8088                                                                                                                                                                                                                                                                                        
ComputerName     : 192.168.0.12
RemoteAddress    : 192.168.0.12
RemotePort       : 8088
InterfaceAlias   : Ethernet
SourceAddress    : 192.168.0.11
TcpTestSucceeded : True

PS C:\Windows\system32> Test-NetConnection -ComputerName 192.168.0.12 -Port 9000
WARNING: TCP connect to (192.168.0.12 : 9000) failed

ComputerName           : 192.168.0.12
RemoteAddress          : 192.168.0.12
RemotePort             : 9000
InterfaceAlias         : Ethernet
SourceAddress          : 192.168.0.11
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : False
gdx19jrr

gdx19jrr1#

问题解决了:端口转发到localhost

sudo sysctl -w net.ipv4.conf.all.route_localnet=1
sudo iptables -t nat -A PREROUTING -p tcp -d 192.168.0.12/24 --dport 9000 -j DNAT --to-destination 127.0.0.1:9000
sudo iptables -t nat -A POSTROUTING -j MASQUERADE

相关问题