please anyone can help me
i need a script that check the local-address of pppoe-client and go to the firewall mangle and add the local-address to src-nat number 0 in dst-address
i mean the local-address that get from script when pppoe-client is up"to src-nat number 0 in dst-address"
this is not clear for me
i mean the local-address that get from script when pppoe-client is up"to src-nat number 0 in dst-address"
this is not clear for me
insert inside a dstnat in firewall nat
my proplem is how to get the local-address from the pppoe-client
/int pppoe-client export hide-sensitive
that's resultsi mean the local-address that get from script when pppoe-client is up"to src-nat number 0 in dst-address"
this is not clear for me
insert inside a dstnat in firewall nat
my proplem is how to get the local-address from the pppoe-client
first paste this on terminal and put on forum the results:
after that I can write your scriptCode: Select all/int pppoe-client export hide-sensitive
/interface pppoe-client
add comment=E+ interface=Lan1 name=pppoe-out1 user=2015@najaftop52x
add comment="E+ Qasimq" interface=Lan2 max-mtu=1500 name=pppoe-out2 user=\
qasimq@najaf
[admin@MikroTik] >
what of your 2 pppoe-client must modify the nat rule?
/ip firewall nat
add action=dst-nat chain=dstnat dst-address=10.140.70.16 dst-port=80,443 \
protocol=tcp to-addresses=10.20.20.2 comment=1
add action=dst-nat chain=dstnat dst-address=10.140.70.19 dst-port=80,443 \
protocol=tcp to-addresses=10.20.20.3 comment=2
ok, both nat, one from ppp client 1 and other from 2?what of your 2 pppoe-client must modify the nat rule?these 2 natCode: Select all/ip firewall nat add action=dst-nat chain=dstnat dst-address=10.140.70.16 dst-port=80,443 \ protocol=tcp to-addresses=10.20.20.2 comment=1 add action=dst-nat chain=dstnat dst-address=10.140.70.19 dst-port=80,443 \ protocol=tcp to-addresses=10.20.20.3 comment=2
the dst-address changed with local-address of the pppoe-client
/ppp profile
add change-tcp-mss=yes name="default autoNAT 1" on-up="/ip fire nat set [find where comment=\"changeMe1\" ] dst-address=\$\"local-address\""
add change-tcp-mss=yes name="default autoNAT 2" on-up="/ip fire nat set [find where comment=\"changeMe2\" ] dst-address=\$\"local-address\""
you are amazingOK, paste this on terminal:
now modify NAT rules:Code: Select all/ppp profile add change-tcp-mss=yes name="default autoNAT 1" on-up="/ip fire nat set [find where comment=\"changeMe1\" ] dst-address=\$\"local-address\"" add change-tcp-mss=yes name="default autoNAT 2" on-up="/ip fire nat set [find where comment=\"changeMe2\" ] dst-address=\$\"local-address\""
change/set NAT rule comment to exactly "changeMe1" (without quotes) where dst-address must be set with pppoe-client1 IP and
change/set NAT rule comment to exactly "changeMe2" (without quotes) where dst-address must be set with pppoe-client2 IP
with the next instruction, probably your connection can be disconnected for some seconds:
with winbox on "PPP" / "interface" open pppoe-out1 and on "Dial Out" tab change "Profile" from "default" to "default autoNAT 1"
now open pppoe-out2 and change again "Profile" from "default" to "default autoNAT 2"
from now everytime one of your pppoe-client change IP or go up (after go down) the IP on NAT are updated.
(if you need, you can comment more than one NAT line, or also no one, with same "changeMe" comment, and all are updated at same time without change the script)
If for some reason the NAT rule or comment are removed or changed, nothing happen.