Ip rule - Routes - Setup questions

Hi fellow linux-users,

I have a server with 4 nics(currently only using 2), running virtual machines.

It uses two networks on different subnets.

E.g

eth1 192.168.2.0/29   (via gateway 192.168.2.1)
eth2 192.168.1.0/29   (via gateway 192.168.1.1)

I ran the following commands to make the 192.168.2.1/29 network to work with internet connection:

ip rule add from 192.168.2.1/29 table 200
ip route add default via 192.168.2.1 dev eth1 table 200

However if I leave the server for a couple of hours, it looses its connection to 192.168.2.1.

I have tried to make it persistent by making the following changes:

in /etc/sysconfig/network-scripts/route-eth1:

default via 192.168.2.1 dev eth1 table 200
192.168.2.1/29 via 192.168.2.1
from 192.168.2.1/29 table 200

in /etc/sysconfig/network-scripts/rule-eth1:

from 192.168.2.1/29 table 200

Any obvious ideas or errors?

I am new to linux, and have read a lot of network threads - and I cannot seem to get it work.

Hope you guys have some ideas.

Thanks,

Martin

Btw. Im using Centos 6

Is there a routing protocol running RIP/BGP/OSPF ? Someone has to be rewriting the routes!

Thanks for the response, I think you are right that the problem is that there is no one to rewrite tthe rules so it sticks.

Is there a way to check which routing protocols are running? (sorry for noob question)

I have no access to the router, as it is a server hosted in a datacenter which have access to two gateways through a small switch.

It is a standard centos 6 linux box with virtouzzo installed.

There are ICMP messages that rewrite routing tables, which in hindsight was a hackers dream, so they need to be disabled internally or with a firewall.

Otherwise, dynamic changes are done by protocols, and I assume daemons, but I work at high altitude, here. Linux Advanced Routing & Traffic Control HOWTO

1 Like