4

On Linux I can type something like echo 202 my_table >> /etc/iproute2/rt_tables and voila, I can use my_table in commands like ip route add 1.1.1.1 dev eth0 table my_table.

But my rooted Android phone doesn't have /etc/iproute2. And even if I create this directory (mkdir -p /etc/iproute2/), then echo 202 my_table >> /etc/iproute2/rt_tables and run ip route add 1.1.1.1 dev eth0 table my_table I get :

Error: argument "my_table" is wrong: "table" value is invalid

How to create and delete route tables on Android?

2
  • 1
    It's /data/misc/net/rt_tables on Android. But Android's limited ip command doesn't read rt_tables at all. You need to build iproute2 package. Be noted that routing on Android is far complex than normal Linux distros. Commented Sep 29, 2020 at 2:03
  • @IrfanLatif Can you point to some documentation on routing on Android works? Commented Feb 2, 2023 at 1:49

1 Answer 1

1

As was pointed out in the comments, Android doesn't use /etc/iproute2/rt_tables.

You can, instead of a name, use a new table ID number. E.g.,

ip route add 1.1.1.1 dev eth0 table 10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .