I am running ubuntu on my machine with another ubuntu in Virtualbox, I am trying to make them connect together so they both have access each others and both can access the internet.
This is the ifconfig
of the host machine
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 130.15.1.72 netmask 255.255.255.0 broadcast 130.15.1.255
inet6 fe80::3f37:1632:b494:f83d prefixlen 64 scopeid 0x20<link>
ether 84:2b:2b:a2:f0:d2 txqueuelen 1000 (Ethernet)
RX packets 7275030 bytes 2419246030 (2.4 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 705630 bytes 93740106 (93.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 21 memory 0xf7fe0000-f8000000
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 132569 bytes 44162247 (44.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 132569 bytes 44162247 (44.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
And this is the /etc/network/interfaces
of the host
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet static
address 130.15.1.72
netmask 255.255.255.0
network 130.15.1.0
broadcast 130.15.1.255
gateway 130.15.1.1
In Virtualbox network settings, I set up a Host only network called vboxnet0
with the following settings:
IP4 Address: 192.168.56.0
IP4 Network Mask: 255.255.255.0
and DHCP disabled
Now I have in the virtual machine settings:
Adapter 1: Host only network - vboxnet0
Adapter 2: NAT
This is the output when I run ls /sys/class/net
on my guest
enp0s3 enp0s8 lo
This is the ifconfig
of the guest machine
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.56.101 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::a00:27ff:fefd:775c prefixlen 64 scopeid 0x20<link>
ether 08:00:27:fd:77:5c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 87 bytes 9096 (9.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.3.15 netmask 255.255.255.0 broadcast 10.0.3.255
inet6 fe80::a00:27ff:fef3:976 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:f3:09:76 txqueuelen 1000 (Ethernet)
RX packets 14384 bytes 13692205 (13.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6941 bytes 749919 (749.9 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
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 348 bytes 25732 (25.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 348 bytes 25732 (25.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
And this is the /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
# The host-only network interface
auto enp0s3
iface enp0s3 inet static
address 192.168.56.101
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
# NAT interface
auto enp0s8
iface enp0s8 inet dhcp
I am trying to ping to make sure the connectivity is established. The guest seems to be able to ping the host (130.15.1.72) successfully. However, the host can only ping 192.168.56.0 (which is just the broadcast address for vboxnet0), while pinging 192.168.56.101 just hangs without giving any output. Also, when I try to SSH from the host, I just get
Trying 192.168.56.101...
While when I try to SSH from the guest I get a connection refused error.
Please help me and let me know what I'm doing wrong. I am sure it's something in the IP addresses because it was very confusing for me to set up.
Thanks