Trying to run container but it causes ifconfig disappearing interfaces, then unable to bind them to docker0
Linux version:
Linux 5.19.0-29-generic #30-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 4 12:14:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 22.10
Release: 22.10
Codename: kinetic
1. check ifconfig before run container:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:aa:3b:be:14 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
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 1000 (Local Loopback)
RX packets 2823 bytes 238614 (238.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2823 bytes 238614 (238.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:c1:5d:b8 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.39.1 netmask 255.255.255.0 broadcast 192.168.39.255
ether 52:54:00:4e:11:7c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::6d4e:a07b:411f:5ff1 prefixlen 64 scopeid 0x20<link>
ether e0:2b:e9:b5:42:30 txqueuelen 1000 (Ethernet)
RX packets 196797 bytes 240397351 (240.3 MB)
RX errors 0 dropped 54 overruns 0 frame 0
TX packets 50394 bytes 9701876 (9.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2. Run docker container:
docker run hello-world Thu 02 Feb 2023 12:01:42 PM CET
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
Everything's ok until 2nd run
3. Second docker run
docker run hello-world 1718ms Thu 02 Feb 2023 12:03:40 PM CET
docker: Error response from daemon: failed to create endpoint vigilant_haslett on network bridge: adding interface veth0c10d54 to bridge docker0 failed: could not find bridge docker0: route ip+net: no such network interface.
ERRO[0000] error waiting for container: context canceled
4. Check ifconfig
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 1000 (Local Loopback)
RX packets 2936 bytes 249701 (249.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2936 bytes 249701 (249.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::6d4e:a07b:411f:5ff1 prefixlen 64 scopeid 0x20<link>
ether e0:2b:e9:b5:42:30 txqueuelen 1000 (Ethernet)
RX packets 257866 bytes 316947762 (316.9 MB)
RX errors 0 dropped 76 overruns 0 frame 0
TX packets 62581 bytes 11411451 (11.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Disappeared docker0 and other interface and unable to bind any other container.
Mostly it can't bridge any interface to erased docker0.
Result of check-config.sh
sh ./check-config.sh Thu 02 Feb 2023 12:11:13 PM CET
warning: /proc/config.gz does not exist, searching other paths for kernel config ...
info: reading kernel config from /boot/config-5.19.0-29-generic ...
Generally Necessary:
- cgroup hierarchy: properly mounted [/sys/fs/cgroup]
- apparmor: enabled and tools installed
- CONFIG_NAMESPACES: enabled
- CONFIG_NET_NS: enabled
- CONFIG_PID_NS: enabled
- CONFIG_IPC_NS: enabled
- CONFIG_UTS_NS: enabled
- CONFIG_CGROUPS: enabled
- CONFIG_CGROUP_CPUACCT: enabled
- CONFIG_CGROUP_DEVICE: enabled
- CONFIG_CGROUP_FREEZER: enabled
- CONFIG_CGROUP_SCHED: enabled
- CONFIG_CPUSETS: enabled
- CONFIG_MEMCG: enabled
- CONFIG_KEYS: enabled
- CONFIG_VETH: enabled (as module)
- CONFIG_BRIDGE: enabled (as module)
- CONFIG_BRIDGE_NETFILTER: enabled (as module)
- CONFIG_IP_NF_FILTER: enabled (as module)
- CONFIG_IP_NF_TARGET_MASQUERADE: enabled (as module)
- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE: enabled (as module)
- CONFIG_NETFILTER_XT_MATCH_CONNTRACK: enabled (as module)
- CONFIG_NETFILTER_XT_MATCH_IPVS: enabled (as module)
- CONFIG_NETFILTER_XT_MARK: enabled (as module)
- CONFIG_IP_NF_NAT: enabled (as module)
- CONFIG_NF_NAT: enabled (as module)
- CONFIG_POSIX_MQUEUE: enabled
- CONFIG_CGROUP_BPF: enabled
Optional Features:
- CONFIG_USER_NS: enabled
- CONFIG_SECCOMP: enabled
- CONFIG_SECCOMP_FILTER: enabled
- CONFIG_CGROUP_PIDS: enabled
- CONFIG_MEMCG_SWAP: enabled
(cgroup swap accounting is currently enabled)
- CONFIG_BLK_CGROUP: enabled
- CONFIG_BLK_DEV_THROTTLING: enabled
- CONFIG_CGROUP_PERF: enabled
- CONFIG_CGROUP_HUGETLB: enabled
- CONFIG_NET_CLS_CGROUP: enabled (as module)
- CONFIG_CGROUP_NET_PRIO: enabled
- CONFIG_CFS_BANDWIDTH: enabled
- CONFIG_FAIR_GROUP_SCHED: enabled
- CONFIG_RT_GROUP_SCHED: missing
- CONFIG_IP_NF_TARGET_REDIRECT: enabled (as module)
- CONFIG_IP_VS: enabled (as module)
- CONFIG_IP_VS_NFCT: enabled
- CONFIG_IP_VS_PROTO_TCP: enabled
- CONFIG_IP_VS_PROTO_UDP: enabled
- CONFIG_IP_VS_RR: enabled (as module)
- CONFIG_SECURITY_SELINUX: enabled
- CONFIG_SECURITY_APPARMOR: enabled
- CONFIG_EXT4_FS: enabled
- CONFIG_EXT4_FS_POSIX_ACL: enabled
- CONFIG_EXT4_FS_SECURITY: enabled
- Network Drivers:
- "overlay":
- CONFIG_VXLAN: enabled (as module)
- CONFIG_BRIDGE_VLAN_FILTERING: enabled
Optional (for encrypted networks):
- CONFIG_CRYPTO: enabled
- CONFIG_CRYPTO_AEAD: enabled
- CONFIG_CRYPTO_GCM: enabled
- CONFIG_CRYPTO_SEQIV: enabled
- CONFIG_CRYPTO_GHASH: enabled
- CONFIG_XFRM: enabled
- CONFIG_XFRM_USER: enabled (as module)
- CONFIG_XFRM_ALGO: enabled (as module)
- CONFIG_INET_ESP: enabled (as module)
- "ipvlan":
- CONFIG_IPVLAN: enabled (as module)
- "macvlan":
- CONFIG_MACVLAN: enabled (as module)
- CONFIG_DUMMY: enabled (as module)
- "ftp,tftp client in container":
- CONFIG_NF_NAT_FTP: enabled (as module)
- CONFIG_NF_CONNTRACK_FTP: enabled (as module)
- CONFIG_NF_NAT_TFTP: enabled (as module)
- CONFIG_NF_CONNTRACK_TFTP: enabled (as module)
- Storage Drivers:
- "aufs":
- CONFIG_AUFS_FS: missing
- "btrfs":
- CONFIG_BTRFS_FS: enabled (as module)
- CONFIG_BTRFS_FS_POSIX_ACL: enabled
- "devicemapper":
- CONFIG_BLK_DEV_DM: enabled
- CONFIG_DM_THIN_PROVISIONING: enabled (as module)
- "overlay":
- CONFIG_OVERLAY_FS: enabled (as module)
- "zfs":
- /dev/zfs: present
- zfs command: missing
- zpool command: missing
Limits:
- /proc/sys/kernel/keys/root_maxkeys: 1000000
Do you have any ideas what may cause it, probably there's' some misconfiguration in the system.
Tried this solution by adding interface to /etc/network/interfaces , didn't work.
Related
Please help with this
I have a windows laptop --> On this installed VM ware Tool --> On this I've Installed Linux OS
Installed docker and stopped firewalld service (then only docker service start)
If I run the docker run command as:
docker run **--network=host** -p 8080:8080 -d tomcat
Then only can access the URL: http://:8080 i.e http://192.168.0.108:8080 (It was IP of Linux VM) from the browser on windows system
If I run the docker command without using the --network=host option I'm not able to access the container application. for example, if running docker run -p 8080:8080 -d tomcat
how can I access all running containers from the windows system browser?
Do I need to add a route in the Linux OS (the one Installed in a VM ware Tool) or in the Windows one or change the network settings in VMWare configuration?
Docker container Ip start with 172.17.xx.xx series and my windows/LINUX OS was on 192.168.xx.xx series. do need to add any route?
MY network details:
[root#Docker_test ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:e8ff:fef2:7ed7 prefixlen 64 scopeid 0x20<link>
ether 02:42:e8:f2:7e:d7 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 500 bytes 23738 (23.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.108 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::20c:29ff:fee6:b685 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:b6:85 txqueuelen 1000 (Ethernet)
RX packets 2310526 bytes 3211791978 (2.9 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 457745 bytes 45884268 (43.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root#Docker_test]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 100 0 0 ens33
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
Regards
Ram
I have created my docker image and container using the Dockerfile in this blog.
https://hackernoon.com/raspberry-pi-cluster-emulation-with-docker-compose-xo3l3tyw
I am able to ssh into the rpi and ifconfig returns the following status:
pi#raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
ether 52:54:00:12:34:56 txqueuelen 1000 (Ethernet)
RX packets 561 bytes 49862 (48.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 386 bytes 47311 (46.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 41 base 0x1000 dma 0xff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 2 bytes 100 (100.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 100 (100.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now I want to be able to connect this to internet. As per docker docs, I tried to connect a running container to the internet using:
docker network connect multi-host-network 008796f5316a
It returns the error.
Error response from daemon: network multi-host-network not found.
How can I connect to the internet from inside the docker?
Edit:
The blog talks about running qemu on docker and installing a modified raspbian on top of that(for compatibility with qemu).
When I access the container using docker exec command,
docker exec -it testnode bash
ifconfig returns the following:
root#1f210520938c:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet)
RX packets 637 bytes 356778 (356.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 404 bytes 39482 (39.4 KB)
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
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
And the ifconfig command for pi returns the results as shown above.
So, ping google.com is working on the root# and not on pi#raspberry.
I need to connect the pi directly to the internet.
This error occurs because you haven't created a Docker network called multi-host-network. To create it, you may refer to Docker docs.
By default, all docker containers are connected to the default bridge network (the name matches driver type). As for docker-compose, bridge network with name docker-compose-directory-name_defaultwill be created, as described [here][2]. You can check it by runningdocker network inspect docker-compose-directory-name_defaultand find your container inContainers` section.
Since your container is already connected to the internet, it should have internet access without explicitly connecting it to a network.
If there is no internet connection, please try solutions proposed in this question. I would suggest starting with
sysctl -w net.ipv4.ip_forward=1 # both on host and container
sudo service docker restart # (or sudo systemctl restart docker) on host
The instructions you're following set up QEMU to use "user-mode networking". This is (sort of) like QEMU itself emulating a little NAT-router and private network that the VM lives behind. This in turn is inside the docker container and talking to whatever the docker container's networking setup is, so you have two layers here -- you'll want to be clear about this double-layer setup so you don't get confused about which of the two might be the source of any problems you have.
User-mode networking has some limitations: notably, ping doesn't work, and you can't connect from the outside into the VM except where you have specific port-forwarding set up (the instructions include a port-forward from host port 2222 to the VM's ssh port 22).
So you need to figure out whether you can live with user-mode networking's limits, and make sure that whatever testing you're doing is testing what you care about and not things you probably don't really care about like whether ping packets in particular work. If you don't want user-mode networking, you'll need to set up a QEMU tap (bridge) network backend, which is a lot more complicated but does let you make a QEMU VM truly visible as a machine on the host network.
I am having trouble setting up an internet to be shared on Beaglebone (BB) through the host (Mac running Big Sur OS).
When I do ifconfig on BB, I see two USB interfaces showing up (usb0, usb1) with designated IP addresses but I can't seem to ping to my host machine for instance to verify the internet connection. It says From 192.168.7.2 icmp_seq=1 Destination Host Unreachable
According to this link:
With the latest images, it should no longer be necessary to install drivers for your operating system to give you network-over-USB access to your Beagle. In case you are running an older image, an older operating system or need additional drivers for serial access to older boards, links to the old drivers are below.
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.7.2 netmask 255.255.255.252 broadcast 192.168.7.3
inet6 fe80::e1c:57ff:fe00:c2c0 prefixlen 64 scopeid 0x20<link>
ether 0c:1c:57:00:c2:c0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.6.2 netmask 255.255.255.0 broadcast 192.168.6.255
ether 0c:1c:57:00:c2:c4 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I did download the latest image but for further verification, how do you verify the image being run i.e version or something that tells whether this matches the image version 10.3 as stated on the website?
On the host, following is the relevant interface for the USB. For the pings to go through, the netmask needs to be matched with that of the usb0?
en7: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=404<VLAN_MTU,CHANNEL_IO>
ether 0c:1c:57:00:c2:c3
inet6 fe80::d1:b3cb:50eb:72e1%en7 prefixlen 64 secured scopeid 0x14
inet 192.168.7.1 netmask 0xffffff00 broadcast 192.168.6.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (none)
status: inactive
In the Network Settings of the host, I see it says Either the cable for BeagleBoneBlack is not plugged in or the device at the other end is not responding. That's weird because in the ifconfig output on the host, I do see en7 showing up which is referring to the USB connection to the BeagleBone
uname -a
This shows your kernel
cat /etc/dogtag
This shows your image
Are you using an Ethernet cable or are you trying to use a USB dongle for Wifi? If you are using Ethernet, it should be plug and play but you will need to use Chrome or Firefox.
I am not sure about the Big Sur OS but you can try beaglebone.local or 192.168.6.2 instead. This may prove useful when using ssh.
also...try this:
use a COM port or if there is no COM ports on Big Sur OS, get a
USB to TTL converter cable and get onto the board via serial...
This way, you can find your IP Address by ip addr.
Look for eth0 on the BBB and not usb(x).
I've got a Fedora 26 QEMU guest VM with a LAMP application running on a Fedora 25 host. I can access the guest web server from both the guest and the host, but I can't access it from the other systems on my local LAN - and I'd like to be able to do that.
I've put a host static route entry in my router (LEDE) to route the F26 guest's static IPv4 address (192.168.122.186) to the F25 host. The F25 host already has a network route entry for the virbr0 v-interface (192.168.122.0/24).
It seems that the F25 host firewall is what's blocking the access because when I disable firewalld on the F25 host, it works as required.
I'd appreciate a pointer to how to wrangle firewalld in this type of configuration.
Edit 2017/12/11:
I started off with only one firewalld zone (public), but now I'm trying 2 (public and internal). The "services" (ports) shown below have always been open. http and https, in particular, are what I need to work.
I need to route the traffic from devices on my local LAN, 10.3.2.0/24, (except the F25 host, of course) through the F25 host to the F26 guest VM. As I wrote before, the routing appears to be working, except when firewalld is running on the F25 host - in which case this traffic is blocked.
I've spent a lot of time searching, and there are two recurring topics, forwarding and masquerading. None of the things suggested has done what I require, however.
How can I do this? Tx
========== running: firewall-cmd --get-zones ===========
FedoraServer FedoraWorkstation block dmz drop external home internal public trusted work
========== running: firewall-cmd --get-active-zones ===========
internal
interfaces: virbr0
public
interfaces: enp0s31f6
========== running: firewall-cmd --get-default-zone ===========
public
========== running: firewall-cmd --zone=public --list-all ===========
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s31f6
sources:
services: mdns ssh dhcpv6-client http https
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
========== running: firewall-cmd --zone=internal --list-all ===========
internal (active)
target: ACCEPT
icmp-block-inversion: no
interfaces: virbr0
sources:
services: ssh http https dhcpv6-client mdns
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
$ ifconfig -a # on the F25 host
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.3.2.10 netmask 255.255.255.0 broadcast 10.3.2.255
inet6 xxxxxxxxxxxxxxxxxxxxxxxxx prefixlen 64 scopeid 0x20<link>
inet6 xxxxxxxxxxxxxxxxxxx prefixlen 128 scopeid 0x0<global>
inet6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx prefixlen 64 scopeid 0x0<global>
ether xxxxxxxxxxxxxxxxx txqueuelen 1000 (Ethernet)
RX packets 145 bytes 16680 (16.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 217 bytes 27947 (27.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xf7000000-f7020000
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 1000 (Local Loopback)
RX packets 24 bytes 2056 (2.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24 bytes 2056 (2.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:93:ae:d3 txqueuelen 1000 (Ethernet)
RX packets 99 bytes 11189 (10.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 73 bytes 9612 (9.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:93:ae:d3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc54:ff:fe7c:437c prefixlen 64 scopeid 0x20<link>
ether fe:54:00:7c:43:7c txqueuelen 1000 (Ethernet)
RX packets 99 bytes 12575 (12.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 195 bytes 17988 (17.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.3.2.1 0.0.0.0 UG 0 0 0 enp0s31f6
10.3.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s31f6
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
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
$ 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
Is it because of port blocking / not forwarding (8888) or something and if so, how to fix it?
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.
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.