0

I have a loopback interface on one machine with a certain IP address, and on another machine I have a static route to that loopback interface subnet.

I can ping the other loopback interface when using the directly connected interface. However, when I ping from another interface using the -I flag, it no longer works.

It seems to be related to the scope of the route being link rather than host, but I'm not sure how this can be changed.

This is the configuration of the remote host with the loopback interfaces:

user@remote:~$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 77.77.77.77/24 brd 77.77.77.255 scope global lo:10
       valid_lft forever preferred_lft forever
    inet 66.66.66.66/24 brd 66.66.66.255 scope global lo:11
       valid_lft forever preferred_lft forever
    inet 145.52.150.1/24 brd 145.52.150.255 scope global lo:12
       valid_lft forever preferred_lft forever
    inet 5.16.0.1/24 brd 5.16.0.255 scope global lo:13
       valid_lft forever preferred_lft forever
    inet 176.111.208.1/24 brd 176.111.208.255 scope global lo:14
       valid_lft forever preferred_lft forever
    inet 185.10.172.1/24 brd 185.10.172.255 scope global lo:15
       valid_lft forever preferred_lft forever
    inet 189.199.123.1/24 brd 189.199.123.255 scope global lo:16
       valid_lft forever preferred_lft forever
    inet 165.254.255.133/24 brd 165.254.255.255 scope global lo:17
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:e5:17:a0 brd ff:ff:ff:ff:ff:ff
    inet 10.88.1.2/24 brd 10.88.1.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fee5:17a0/64 scope link 
       valid_lft forever preferred_lft forever
user@remote:~$ ip route
default via 10.88.1.1 dev enp0s3 
10.88.0.0/24 dev enp0s3 scope link 
10.88.1.0/24 dev enp0s3 proto kernel scope link src 10.88.1.2

This is the local machine with the static routes:

user@local:~$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:1a:aa:71 brd ff:ff:ff:ff:ff:ff
    inet 10.88.0.1/24 brd 10.88.0.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe1a:aa71/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:81:d8:21 brd ff:ff:ff:ff:ff:ff
    inet 10.88.1.1/24 brd 10.88.1.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe81:d821/64 scope link 
       valid_lft forever preferred_lft forever
user@local:~$ ip route
default via 192.168.1.1 dev enp0s9 
5.16.0.0/24 dev enp0s8 scope link 
8.8.8.0/24 dev enp0s8 scope link 
10.88.0.0/24 dev enp0s3 proto kernel scope link src 10.88.0.1 
10.88.1.0/24 dev enp0s8 proto kernel scope link src 10.88.1.1 
66.66.66.0/24 dev enp0s8 scope link 
77.77.77.0/24 via 10.88.1.2 dev enp0s8 
145.52.150.0/24 dev enp0s8 scope link 
169.254.0.0/16 dev enp0s3 scope link metric 1000 
176.111.208.0/24 dev enp0s8 scope link 
185.10.172.0/24 dev enp0s8 scope link 
192.168.1.0/24 dev enp0s9 proto kernel scope link src 192.168.1.110 
198.199.123.0/24 dev enp0s8 scope link

This command hangs:

user@detector:~$ ping -I enp0s3 77.77.77.77
PING 77.77.77.77 (77.77.77.77) from 10.88.0.1 enp0s3: 56(84) bytes of data.
0

By definition, a loopback interface is accessible only from the local host. Are you sure that you have a static route to the remote loopback interface or is it possible that you're actually pinging the loopback on you localhost?

  • Yes, I have confirmed with tcpdump that I am actually reaching the loopback interface of the remote machine. I doesn't seem to be possible to route the traffic trough multiple hops, that's what my question is about. – Eloy Jun 20 at 19:12
  • Can you edit your question to include the results of ip addr on both systems and the output of your ping command? – doneal24 Jun 20 at 19:53
  • I have added them – Eloy Jun 20 at 20:06
  • A loopback interface really comparable to a serial port with the transmit line connected to the receive line. To connect with some other host you need to use some other type on interface. May I ask why you are trying to implement this convoluted system which is against how things are intended to be used? Also, you should not be using non-RFC1918 addresses that don't belong to you, even if you are confident they won't leak to the public internet. – Johan Myréen Jun 21 at 7:21
  • On Cisco devices, I can add a loopback interface with just any address, and I can route to it. Though, I don't think Cisco doesn't know how networking works. The point of this is emulating public IP addresses. We are building a custom SIEM tool for educational purposes, the IP addresses need to look "real" without sending them to the real internet. – Eloy Jun 21 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.