According to ip-route(8) :

ip route save
save routing table information to stdout This command behaves like ip route show except that the output is raw data suitable for passing to ip route restore.

ip route restore
restore routing table information from stdin This command expects to read a data stream as returned from ip route save. It will attempt to restore the routing table information exactly as it was at the time of the save, so any translation of information in the stream (such as device indexes) must be done first. Any existing routes are left unchanged. Any routes specified in the data stream that already exist in the table will be ignored.

But when I use ip route save > mydump , It return binary unlike of manual page, Is it a bug? Or I use wrongly?

  • the raw data comment implies that the output might not be human readable. That seems to be correct in this case. – llua Oct 8 '15 at 23:36

It is binary. A definitive indicator of this is the fact that it won't allow you to dump the binary data to stdout, with a error message:

# ip route save
Not sending binary stream to stdout
Dump terminated
  • I answer completely, – PersianGulf Oct 11 '15 at 0:27
  • @PersianGulf No you did not. You just specified an unnnecessary redirection. This one is the correct answer. – MariusMatutiae Dec 29 '15 at 6:32
  • @Brian , But i tested. – PersianGulf Dec 29 '15 at 17:15

The format of ip route save is binary but, in case of Linux, it is identical to rtnetlink(7). There are many tools to read/write/manipulate this files, one of it is Python pyroute2.


If you want to dump your RT, Please consider, ip route save provide stdout and stderr, So you have to use :

ip route save 1> dump

If you don't use 1> ip command, redirect stderr and stdout into dump.
NOTE: If you have a default gateway in your dump, please add its network by hand such as :

ip route add dev eth0

Then :

ip route restore < dump

But why with hand? Because first line of dump is dafualt gw and you get the following error:

RTNETLINK answers: Network is unreachable

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.