2015-10-12 114 views
0

我試圖在CentOS 7 VM(我已經擁有)內安裝Jupyter,所以我可以在我的主機Mac筆記本電腦上通過端口8888訪問它。但是,我無法弄清楚網絡連接。在Fusion的CentOS 7中安裝Jupyter

我改變了IP地址200.100.xx爲了方便

從主機

我有2個適配器爲CentOS的VM

enter image description here

enter image description here

$ ifconfig給我這個(我相信那些是相同的):

vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 
    ether 00:50:56:c0:00:01 
    inet 200.100.42.1 netmask 0xffffff00 broadcast 200.100.42.255 
vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 
    ether 00:50:56:c0:00:08 
    inet 200.100.40.1 netmask 0xffffff00 broadcast 200.100.40.255 

從內CentOS的

[[email protected] ~]# ifconfig 
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 
     inet 200.100.40.145 netmask 255.255.255.0 broadcast 200.100.40.255 
     inet6 fe80::20c:29ff:febf:4878 prefixlen 64 scopeid 0x20<link> 
     ether 00:0c:29:bf:48:78 txqueuelen 1000 (Ethernet) 
     RX packets 645 bytes 97963 (95.6 KiB) 
     RX errors 0 dropped 0 overruns 0 frame 0 
     TX packets 215 bytes 24854 (24.2 KiB) 
     TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 
     inet 200.100.42.128 netmask 255.255.255.0 broadcast 200.100.42.255 
     inet6 fe80::250:56ff:fe3d:7210 prefixlen 64 scopeid 0x20<link> 
     ether 00:50:56:3d:72:10 txqueuelen 1000 (Ethernet) 
     RX packets 18 bytes 1884 (1.8 KiB) 
     RX errors 0 dropped 0 overruns 0 frame 0 
     TX packets 45 bytes 6130 (5.9 KiB) 
     TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

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 220 bytes 50398 (49.2 KiB) 
     RX errors 0 dropped 0 overruns 0 frame 0 
     TX packets 220 bytes 50398 (49.2 KiB) 
     TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

我的測試

我從我的主機ping通下面的IP地址機器,他們都工作:

200.100.42.128 

200.100.40.145 

200.100.42.1 

200.100.40.1 

這意味着虛擬機中存在網絡連接。正確?

當我做jupyter notebook,我可以訪問http://localhost:8888/tree的VM 內,但使用任何IP地址從在MacBook我的主機操作系統,我不能去那裏。

我已經多次重啓我的虛擬機。

問題

  1. 是因爲端口阻塞/不轉發(8888)之類的東西,如果是,如何解決它?

  2. 我是否設置錯誤?在CentOS裏面還有什麼我需要做的嗎?我在這裏閱讀這個博客http://twiki.org/cgi-bin/view/Blog/BlogEntry201310x2,我根本沒有看到eth0

回答

1

的問題是Jupyter默認採摘127.0.0.0localhost。如果您有適配器與其他IP地址,它將不起作用。

您需要更改Jupyter的IP在VM內

http://jupyter-notebook.readthedocs.org/en/latest/config.html

$ jupyter notebook --generate-config

編輯:

vi /root/.jupyter/jupyter_notebook_config.py

然後改變:

重新啓動jupyter notebook應該很好去。

確保防火牆關閉或打開端口8888