Mark
Mark

Reputation: 11

how to save ip rule and ip route configuration

The issus is: I configured the following policy routing:

ip route add 192.168.1.0/24 via 10.0.2.15 dev eth0 table 10

ip route add default via 10.0.2.15 dev eth0 table 10

ip rule add from 10.0.2.15 table 10

these configurations are temporary, once network restart or reboot,the policy route I configured would lost, Is there any way you can solve this problem?

Upvotes: 1

Views: 11493

Answers (1)

Suyash Jain
Suyash Jain

Reputation: 571

Create a file if does not exist

/etc/sysconfig/network-scripts/route-eth0

Add the following contents

192.168.1.0/24 via 10.0.2.15 dev eth0

default via 10.0.2.15 dev eth0

default route can be added in /etc/sysconfig/network-scripts/ifcfg-eth0

GATEWAY=10.0.2.15

Third rule is not clear to me

Upvotes: 1

Related Questions