jupyter noteb的iptables规则

2024-05-21 15:53:17 发布

您现在位置:Python中文网/ 问答频道 /正文

jupyter笔记本的iptables设置有问题。使用以下规则(假设notebook端口8888),jupyter notebook server将成功启动,但实际的notebook内核将无法启动/建立。你知道吗

通过注释掉最后一条iptables规则“-A OUTPUT-j DROP”,一切正常。你知道吗

有什么想法吗?你知道吗

-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 8888 -j ACCEPT
-A INPUT -p tcp -m state --state ESTABLISHED --sport 8888 -j ACCEPT
-A OUTPUT -p tcp -m state --state ESTABLISHED --sport 8888 -j ACCEPT 
-A OUTPUT -p tcp -m state --state NEW,ESTABLISHED --dport 8888 -j ACCEPT
-A INPUT -j DROP
-A OUTPUT -j DROP

Tags: iptablesnewinputoutput规则笔记本jupyterdrop
1条回答
网友
1楼 · 发布于 2024-05-21 15:53:17

像jupyter这样的工具通常使用环回设备(localhost)来访问某些功能。例如,jupyter有一个通过HTTP与笔记本服务器通信的前端,笔记本服务器通过套接字将消息发送到IPython内核(参见:https://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html)。你知道吗

我要补充以下规则:

sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A OUTPUT -o lo -j ACCEPT

这些规则允许在环回设备(localhost)之间进行输入和输出。你知道吗

相关问题 更多 >