invalid routes

Can anyone perhaps inform me as to why MT sees this as a invalid route??


[admin@wsmd-core] > ip route add dst-address=196.0.0.0 netmask=255.0.0.0 gateway=165.146.240.231
[admin@wsmd-core] > ip route print
Flags: X - disabled, I - invalid, D - dynamic, J - rejected, C - connect, S - static, r - rip, o - ospf, b - bgp

DST-ADDRESS G GATEWAY DISTANCE INTERFACE

0 S 0.0.0.0/0 r 198.19.0.2 1 SERVER-CORE
1 IS 196.0.0.0/8 u 165.146.240.231 1 (unknown)
2 DC 198.19.1.0/24 r 0.0.0.0 0 WIRELESS-CORE
3 Ib 198.19.0.0/24 u 0.0.0.0 200 (unknown)
4 DC 198.19.0.0/24 r 0.0.0.0 0 SERVER-CORE
5 DC 192.168.1.0/24 r 0.0.0.0 0 INTERNAL-CORE
6 DC 165.146.192.1/32 r 0.0.0.0 0 National Gateway
[admin@wsmd-core] >

The default route goes over a ethernet interface, whilst the static route I am trying to add is going over a PPPoE Connection… Surely, this must be working!!!

Interfaces and addresses:

[admin@wsmd-core] > interface print
Flags: X - disabled, D - dynamic, R - running

NAME TYPE RX-RATE TX-RATE MTU

0 R SERVER-CORE ether 0 0 1500
1 R WIRELESS-CORE ether 0 0 1500
2 R INTERNAL-CORE ether 0 0 1500
3 R National Gateway pppoe-out 0 0 1380
[admin@wsmd-core] > ip address print
Flags: X - disabled, I - invalid, D - dynamic

ADDRESS NETWORK BROADCAST INTERFACE

0 192.168.1.1/24 192.168.1.0 192.168.1.255 INTERNAL-CORE
1 198.19.0.1/24 198.19.0.0 198.19.0.255 SERVER-CORE
2 198.19.1.1/24 198.19.1.0 198.19.1.255 WIRELESS-CORE
3 D 165.146.240.231/32 165.146.192.1 0.0.0.0 National Gateway

http://www.mikrotik.com/docs/ros/2.8/guide/aaa.content#13.4.8

see the routes parameter.

Eugene

If it was a incoming PPPoE Connection sure, I would look at AAA Routes. Unfortunately, it’s a outgoing connection (sorry for not being clear). I have solved this problem though.

My problem now, is that the routes are not always destroyed when a new IP is assigned to the interface (because it uses the same gateway - which is what I need to route to).

Does anyone perhaps have a funky regex for perl to match the route number out of the MT? I’ve tried quite a bit, but apparently MT doesn’t send new line characters so it’s extremely difficult to match in perl.

I’d advise to use internal scripting.

Unfortunatley not a option. Due to ISPs general lack to offer BPG to customers, I have to pull quite a huge route list (to route local vs international traffic on different pipes) from a MySQL Database. As far as I know, MT is not capable of talking to MySQL. These addresses also change quite often, so using something like routing tables or marking / mangling will also not work effeciently.

Therefore, I have now configured a script to send a email to a server if the address change on the PPPoE Interface (This works). Once the email is received, the server logs into the MT and it is then required to change the routing table to route local traffic to the new gateway address of the PPPoE Interface.

So you need to change gateway address for one or more records under /ip route when PPPoE interface changes it’s address?

Yes.

Basically, if

[/ip address get [/ip address find interface=“National Gateway”] network]

change, I need to run through the routing table, and update all routes going through that PPPoE Interface, and make sure that they route to the updated / not updated network address.

Then, I still need to remove routes which may not be local anymore, as well as add new routes which is classified as local.

I have successfully managed to dump the routing table into a nice perl Hash now though, so it’s just a matter of looping through the hash and doing the comparisons… Shouldn’t take to long anymore :wink:

Rightyo.

Script is done, working very nicely and thank you for everyone who helped. Now, we move on to a more advance and complicated problem - which SHOULD be fixable via the use of routing tables (tho - I am not sure exactly how).

This is now text based, so please bare with me and try to understand the diagram

/------
GW01–| |
| MT |— Rest of the network
GW02–| |
------/


Via static routes, I have now routed local traffic via GW01, and GW02 is the default route (routing the rest of the traffic). The problem now, is if I have a connection coming in to say, a web server behind the MT - the route will not be correctly reversed. More details,

Let’s say, 165.165/12 routes via GW01 (outbound). Now, I have a dyndns addy setup, with GW02’s address. 165.165.1.1 connects to the MT via GW02, the MT does the dst-nat, the data goes to the server. The server sends the data back to the MT, and the MT NOW will route the data out via GW01 (a local address) - the end result, is that the connection to the web server behind the MT will FAIL.

Possible solutions I have thought about so far, is to dst-nat everything coming in on GW01 and GW02 - or to use route tables so that a address coming in on GW01 will ALWAYS go out via GW01, and the same for GW02, regardless of the entries in the main routing table.

Is this still a bit unclear, and if so, how can I go about to resolve this type of routing abnormalities? cisco has something like ‘ip route same-interface’ if I am not mistaken…

To answer my own question… I should have tested more, Mikrotik seems to already take care of this by default…

Sorry for all the confusion - it’s a learning curve for me g