thank you guys for your comments.
at first i would like to explain why i need to nat these ip instead of assign them directly to the servers
i have a local hosted website consists of three servers on my lan and because hi speed internet connection is very expensive in my country i thought about subscribing for 4 different internet connections and each have public pool ips so that i can take 3 ips of every wan connection and assign it to my 3 servers and using bind (linux DNS server) to round robin them (just like big websites which have different ip responding to each request) ..
correct me if i am wrong in these thought ..
- i have used my isp modem in bridge mode and notice that WAN IP is the ip assigned to the pppoe interface dynamically from my isp
- i added to same pppoe interface the 5 ips addresses i got from my isp with /29 at each, then mikrotik automatically figures that network address is the MATRIX LAN IP .. should i change the network ip to the GATEWAY IP ..
- i added a src-nat rule to translate a public ip to local one ex:
chain=srcnat action=src-nat to-addresses=1.1.1.2 src-address=192.168.0.1
now i can access my servers from outside my network ,but if i try to access the server from inside my network i can't using the public ip ..
i think i need to do hairbin nat, but dont know how ..
First of all: when you connecting with your ISP with PPPoE, you'll have only /32 IP address, because it's point to point network design over ethernet. When you getting /29 network from your ISP, he just adding static route on his BRAS, that your /29 network reachable through your PPPoE IP. Your gateway to the world(0.0.0.0/0) will be the one: though your PPPoE connection.
Now about NAT. If you want to translate public IP into local, you will need destination nat rule, not source, because you want to control your LAN, not to scr-natting the hole world. The rule will be like this, but depends of your interface name:
ip firewall nat
add chain=dstnat action=dst-nat interface=pppoe1 dst-address=1.1.1.2 to-address=192.168.0.1
Also you can choose type of protocol and port.
If you want to access to your local server through the router by public IP which you natting, you should use hairpin nat:
After you dst-nat from global to LAN, add these 2 rules:
ip firewall nat
add action=dst-nat chain=dstnat dst-address="your global IP" dst-port=80 in-interface="LAN interface for your web server"
protocol=tcp src-address=192.168.0.0/24 to-addresses=192.168.0.1 to-ports=80
add action=masquerade chain=srcnat dst-address=192.168.0.1 dst-port=80 out-interface="LAN interface for your web server" protocol=tcp src-address=192.168.0.0/24
If I misconfigured smthg, just adjust it to your idea.
General info about H-NAT:
https://wiki.mikrotik.com/wiki/Hairpin_NAT
P.S.: if you can't figure out why wiki manipulates 2 rules, but I use 3, it is because I specifying exact interface.