0

I have defined a dummy0 interface:

sudo ip link add dummy0 type dummy
sudo ip addr add 200.200.200.0/24 dev dummy0

The interface is there alright:

$ ip addr show dummy0
50: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether f2:f7:18:50:6f:d4 brd ff:ff:ff:ff:ff:ff
    inet 200.200.200.0/24 scope global dummy0
       valid_lft forever preferred_lft forever

But I can not reach it:

$ ping 200.200.200.1 -c 1 -W 1
PING 200.200.200.1 (200.200.200.1) 56(84) bytes of data.

--- 200.200.200.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

Routing seems to be wrong:

$ ip route
default via 172.16.8.1 dev eno1 proto dhcp metric 100
169.254.0.0/16 dev eno1 scope link metric 1000
172.16.8.0/23 dev eno1 proto kernel scope link src 172.16.9.220 metric 100
172.17.0.0/16 dev br-fcb6a17207d6 proto kernel scope link src 172.17.0.1 linkdown
172.18.0.0/16 dev br-5009391df1c5 proto kernel scope link src 172.18.0.1
172.19.0.0/16 dev br-def793c8b10c proto kernel scope link src 172.19.0.1 linkdown
172.20.0.0/16 dev br-79ca860054eb proto kernel scope link src 172.20.0.1 linkdown
172.20.16.0/24 via 172.16.8.1 dev eno1
172.20.96.0/24 via 172.16.8.1 dev eno1
172.20.192.0/24 via 172.16.8.1 dev eno1
172.22.0.0/16 dev br-13a8dc17b2c2 proto kernel scope link src 172.22.0.1 linkdown
192.168.42.0/24 dev docker0 proto kernel scope link src 192.168.42.5 linkdown

How do I route traffic to the 200.200.200.0/24 to this interface?

The obvious candidates do not work:

$ sudo ip route add 200.200.200.0/24 via 200.200.200.1 dev dummy0
Error: Nexthop has invalid gateway.

$ sudo ip route add 200.200.200.0/24 dev dummy0
Error: Device for nexthop is not up.
volingas
  • 101
  • 1
  • Is it not necessary to instantiate dummy inteface to just add another local address. You can add arbitrary address to any interface, for instance loopback: `ip addr add 192.168.0.2/24 dev lo`. – Nikita Kipriyanov Jan 21 '22 at 07:27

2 Answers2

1

you can not reach dummy0 because the interface is down, as you can see on you command

ip addr show dummy0 --> state DOWN

the interface is down because its a dummy so there is no real way to know its state because it is not really connected to any network.

you can force the interface to up with sudo ip link set dummy0 up

then you can ping you own irregular address

ping 200.200.200.0 
PING 200.200.200.0 (200.200.200.0) 56(84) bytes of data.
64 octets de 200.200.200.0 : icmp_seq=1 ttl=64 temps=0.063 ms
64 octets de 200.200.200.0 : icmp_seq=2 ttl=64 temps=0.048 ms
64 octets de 200.200.200.0 : icmp_seq=3 ttl=64 temps=0.058 ms

when the interface is up there is no need to add route, it will just show up.

ip route
default via ...
200.200.200.0/24 dev dummy0 proto kernel scope link src 200.200.200.0
dominix
  • 446
  • 2
  • 4
  • 13
1

you configured 200.200.200.0 as ip addr on dummy0

you try to ping 200.200.200.1

Chaoxiang N
  • 1,283
  • 5
  • 11
  • It's a /24 network – volingas Nov 06 '19 at 07:41
  • You're not adding all 256 IPs of the /24 network though. The /24 is the subnet mask. You're command is "add 200.200.200.0 which is part of a /24 network, as an IP to the interface dummy0", not "add this whole range of 200.200.200.0/24 to dummy0". – floodpants Jan 21 '22 at 12:26