0

I an alpine vm running inside virtualbox I have set up 2 network interfaces:

  • eth0: a nat interface
  • eth1: a host only one

Guest network config (alpine VM)

The /etc/network/interfaces have:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 10.0.2.3/24

and the Routes are:

$ ip route
default via 10.0.2.2 dev eth0 
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 
10.0.2.0/24 dev eth1 proto kernel scope link src 10.0.2.3 

Also ifconfig is:

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:3E:01:9E  
          inet addr:10.0.2.15  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe3e:19e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6471 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3378 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4458349 (4.2 MiB)  TX bytes:266301 (260.0 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:82:18:08  
          inet addr:10.0.2.3  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe82:1808/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:30 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1800 (1.7 KiB)  TX bytes:3464 (3.3 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:238 errors:0 dropped:0 overruns:0 frame:0
          TX packets:238 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:18216 (17.7 KiB)  TX bytes:18216 (17.7 KiB)


Ans ssh listens to any port

$ sudo ss -tl 
State                       Recv-Q                      Send-Q                                             Local Address:Port                                             Peer Address:Port                      Process                      
LISTEN                      0                           128                                                      0.0.0.0:ssh                                                   0.0.0.0:*                                  

In the host

I get the following error during ping

$ ping 10.0.2.3
PING 10.0.2.3 (10.0.2.3) 56(84) bytes of data.
From 10.0.2.1 icmp_seq=1 Destination Host Unreachable
From 10.0.2.1 icmp_seq=2 Destination Host Unreachable
From 10.0.2.1 icmp_seq=3 Destination Host Unreachable
From 10.0.2.1 icmp_seq=4 Destination Host Unreachable
From 10.0.2.1 icmp_seq=5 Destination Host Unreachable
From 10.0.2.1 icmp_seq=6 Destination Host Unreachable
From 10.0.2.1 icmp_seq=8 Destination Host Unreachable
From 10.0.2.1 icmp_seq=9 Destination Host Unreachable
From 10.0.2.1 icmp_seq=10 Destination Host Unreachable
From 10.0.2.1 icmp_seq=11 Destination Host Unreachable
From 10.0.2.1 icmp_seq=14 Destination Host Unreachable
From 10.0.2.1 icmp_seq=15 Destination Host Unreachable
From 10.0.2.1 icmp_seq=16 Destination Host Unreachable
From 10.0.2.1 icmp_seq=17 Destination Host Unreachable
From 10.0.2.1 icmp_seq=18 Destination Host Unreachable
From 10.0.2.1 icmp_seq=19 Destination Host Unreachable
From 10.0.2.1 icmp_seq=20 Destination Host Unreachable
From 10.0.2.1 icmp_seq=21 Destination Host Unreachable
From 10.0.2.1 icmp_seq=22 Destination Host Unreachable
From 10.0.2.1 icmp_seq=23 Destination Host Unreachable
From 10.0.2.1 icmp_seq=24 Destination Host Unreachable
From 10.0.2.1 icmp_seq=25 Destination Host Unreachable
From 10.0.2.1 icmp_seq=26 Destination Host Unreachable
From 10.0.2.1 icmp_seq=27 Destination Host Unreachable
From 10.0.2.1 icmp_seq=28 Destination Host Unreachable
From 10.0.2.1 icmp_seq=29 Destination Host Unreachable
From 10.0.2.1 icmp_seq=30 Destination Host Unreachable
From 10.0.2.1 icmp_seq=31 Destination Host Unreachable
From 10.0.2.1 icmp_seq=32 Destination Host Unreachable
From 10.0.2.1 icmp_seq=33 Destination Host Unreachable
From 10.0.2.1 icmp_seq=34 Destination Host Unreachable
From 10.0.2.1 icmp_seq=35 Destination Host Unreachable
From 10.0.2.1 icmp_seq=36 Destination Host Unreachable
From 10.0.2.1 icmp_seq=37 Destination Host Unreachable
From 10.0.2.1 icmp_seq=38 Destination Host Unreachable
From 10.0.2.1 icmp_seq=39 Destination Host Unreachable
From 10.0.2.1 icmp_seq=40 Destination Host Unreachable
From 10.0.2.1 icmp_seq=41 Destination Host Unreachable
From 10.0.2.1 icmp_seq=45 Destination Host Unreachable
From 10.0.2.1 icmp_seq=46 Destination Host Unreachable
^C
--- 10.0.2.3 ping statistics ---
47 packets transmitted, 0 received, +40 errors, 100% packet loss, time 47048ms
pipe 4

Whilst netcat unable to connect as well.

$ nc -vz 10.0.2.3 22
nc: connect to 10.0.2.3 port 22 (tcp) failed: No route to host

Any ideas why?

Dimitrios Desyllas
  • 523
  • 2
  • 10
  • 27
  • You have two interfaces with addresses on the same IPv4 LAN: same on eth0 and eth1. This causes routing problems unless you know what you're doing (and use policy routing). Fix that first. Also dont use ifconfig on Linux (just don't intall whatever provides this command). Always use ip link and ip address instead. – A.B May 11 '22 at 05:32

0 Answers0