NAT and address change

interfaces:
int1, address=1.2.3.4
int2, address=2.3.4.5

nat rule:
chain=srcnat action=masquerade src-address=10.0.0.0/8

routes:
add dst-address=0.0.0.0/0 gateway=1.2.3.4 distance=1 check-gateway=ping disabled=no
add dst-address=0.0.0.0/0 gateway=2.3.4.5 distance=10 disabled=no

so, in normal conditions all traffic goes through int1 and is srcnatted with 1.2.3.4 address
but when 1.2.3.4 fails (no ping), corresponding route becomes invalid, and all traffic goes through int2. but! all old connections are srcnatted with 1.2.3.4 address, unless one removes these connections from ‘firewall-connections’.

is there any methods to change src-nat address for existent connections?

I don’t think so. There are a variety of methods to deal with this issue, but the easiest is to include something like:

/ip firewall connection remove [find]

in netwatch. You are using the distance metric to change the route, which is fine, but doesn’t give you as much flexibility as netwatch. Either way, you could add a netwatch script and include the above as part of the down script.

actually, I have three interfaces with load-balancing, and it is hard to use netwatch. what other methods can you suggest?

You could just write a scheduler script that runs every few seconds to detect the current gateway. If/when that changes, then have the scheduler run the command I suggested above.

but I don’t want to use the easiest =) what other methods are there?

You could use the scheduler as I suggested above. You could write a script that runs on another system that uses perl that will ssh into the router and have it do the work…you can write a script, then run that script from scheduler. You can use netwatch (you said it was too hard to use). There are many ways to accomplish what you are after…netwatch or scheduler are easiest/best. Why complicate it further than that?

But it looks like

/ip firewall connection remove [find]

is just one way out =)

Yes. That is the answer to the original question. The “variety” I spoke of is where and how you issue that command.