7

I have a PC which has 192.168.1.1/24 configured to eth0 interface. Now if I try to add routes via 10.10.10.254, the ip utility reports that No such process:

root@PC:~# ip neigh add 10.10.10.254 lladdr 00:01:02:03:04:05 dev eth0
root@PC:~# ip route add default via 10.10.10.254 dev eth0
RTNETLINK answers: No such process
root@PC:~# ip route add 172.16.0.1/32 via 10.10.10.254 dev eth0
RTNETLINK answers: No such process
root@PC:~# 

As long as PC knows the MAC address of 10.10.10.254 it is technically possible to send data via 10.10.10.254 while 10/8 network is not configured to any interface in PC. Based on my example it would use PCs eth0 MAC address as a source MAC, 00:01:02:03:04:05 as a destination MAC, 192.168.1.1 as a source IP address and destination address would be whatever I specify.

Is it possible to force Linux to add a route if sub-net, where gateway is situated, is not in configured to an interface?

2
  • before we (try to) answer, which combination of route add foo/X ... have you tried ?
    – Archemar
    Sep 28, 2015 at 12:42
  • I have tried ip route add default via 10.10.10.254 dev eth0 and ip route add 172.16.0.1/32 via 10.10.10.254 dev eth0. However, the point does not seem to be which destination network I use, but the fact that eth0 interface does not have address from the same broadcast domain that 10.10.10.254.
    – Martin
    Oct 1, 2015 at 7:40

1 Answer 1

5
+50

Try this:

ip route add 172.16.0.1/32 via 10.10.10.254 dev eth0 onlink

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.