Skip to content
Advertisement

Setup Jupyter inside Fusion’s CentOS 7

I am trying to install Jupyter inside CentOS 7 VM (that I already had) so I can access it via port 8888 at my host Mac laptop. However, I cannot figure out the networking piece.

I am changing the IP address to 200.100.x.x for convenience

From Host Machine

I have 2 adapters for that CentOS VM

enter image description here

enter image description here

$ ifconfig gives me this (I believe those are the same):

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

From within CentOS

[root@localhost ~]# 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

My tests

I pinged the following IP addresses from my host machine and they all worked:

200.100.42.128

200.100.40.145

200.100.42.1

200.100.40.1

That means there is networking connectivity into the VM. Correct?

When I do jupyter notebook, I could access http://localhost:8888/tree inside the VM but I cannot go there using any IP address from my host OS on the Macbook.

I have restarted my VM many times.

Questions

  1. Is it because of port blocking / not forwarding (8888) or something and if so, how to fix it?

  2. Did I setup the networking incorrectly? Is there something else I need to do inside CentOS? I read this blog here http://twiki.org/cgi-bin/view/Blog/BlogEntry201310x2 and I don’t see eth0 at all.

Advertisement

Answer

The problem is Jupyter picked 127.0.0.0 or localhost by default. If you have the adapter with other IP addresses, it won’t work.

You need to change the IP of Jupyter inside the VM

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

$ jupyter notebook --generate-config

Edit it:

vi /root/.jupyter/jupyter_notebook_config.py

Then change:

c.Notebookapp.ip = '0.0.0.0'

Restart jupyter notebook and should be good to go.

Make sure firewall is off or open for port 8888 as well.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement