Community discussions

MikroTik App
 
neok
just joined
Topic Author
Posts: 3
Joined: Fri Jul 29, 2022 6:15 pm

Wrong outgoing public IP

Thu Aug 11, 2022 9:29 pm

Hello everyone.
I need to make the outgoing IP to the internet x.y.z.110 and not a.b.c.214. My ISP gave me a /30 for the WAN side and a /29 for the LAN side of my router.
While the internet connection is working fine, when I check the outgoing IP I realize that it is not what it should be. I think I have a NAT misconfiguration somewhere but I don't know where.
Attached is a diagram and the configuration of my router.
Any help you can give me will be more than appreciated.
Thank you very much.

Best regards.
Gabriel
Screenshot from 2022-08-11 15-28-26.png

# jul/29/2022 11:55:24 by RouterOS 6.47.10
# software id = DC59-QRN0
#
# model = RB760iGS
# serial number = XXXXXXXXXXXX
/interface bridge
add admin-mac=DC:2C:6E:17:31:8E auto-mac=no comment=defconf name=bridge
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=sfp1
/ip neighbor discovery-settings
set discover-interface-list=none
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/ip address
add address=192.168.88.1/24 comment=defconf disabled=yes interface=bridge network=192.168.88.0
add address=a.b.c.214/30 interface=ether1 network=a.b.c.112
add address=x.y.z.105/29 interface=ether2 network=x.y.z.104
add address=10.250.250.152/24 interface=bridge network=10.250.250.0
/ip cloud
set update-time=no
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1
/ip dns
set servers=8.8.8.8,1.1.1.1
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=accept chain=input comment="Allow SNMP from Zabbix" dst-port=161 protocol=udp
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
/ip route
add distance=1 gateway=a.b.c.213 pref-src=0.0.0.0
/ip service
set telnet disabled=yes
set ftp disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/ip ssh
set strong-crypto=yes
/snmp
set contact="John Doe <jdoe@gmail.com>" enabled=yes location="Data Center Of. 59 - Rack 5"
/system clock
set time-zone-name=America/Argentina/Buenos_Aires
/system identity
set name=GW_LUMEN1
/system ntp client
set enabled=yes primary-ntp=216.239.35.4 secondary-ntp=162.159.200.123 server-dns-names=8.8.8.8,1.1.1.1.
/tool bandwidth-server
set enabled=no
/tool mac-server
set allowed-interface-list=none
/tool mac-server mac-winbox
set allowed-interface-list=none
/tool mac-server ping
set enabled=no
You do not have the required permissions to view the files attached to this post.
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Wrong outgoing public IP

Fri Aug 12, 2022 12:03 am

Instead of action=masquerade (which selects address automatically), use action=src-nat to-addresses=x.y.z.110.
Last edited by Sob on Fri Aug 12, 2022 12:34 am, edited 1 time in total.
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 989
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: Wrong outgoing public IP

Fri Aug 12, 2022 12:11 am

Don't use the NAT ? Why use NAT if your Fortigate101F can do that for you ? That Fortigate can make all internal 10.x.x.x traffic coming out as x.y.z.110
All the rest is just routing.
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Wrong outgoing public IP

Fri Aug 12, 2022 12:35 am

Or that ^^^, even better. But if you need NAT for 10.250.250.0/24 subnet, then exclude public subnet from srcnat using src-address=!x.y.z.104/29.
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 989
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: Wrong outgoing public IP

Fri Aug 12, 2022 8:27 am

Or that ^^^, even better. But if you need NAT for 10.250.250.0/24 subnet, then exclude public subnet from srcnat using src-address=!x.y.z.104/29.
I did not even look at the config-file but only the picture. :D
Then he better had some extra segment 10.250.250.0/24 & 192.168.88.0/24 on the picture.

Yeah, in that case IF that 10.250.250.x and/or 192.168.88.0/24 needs Internet access then NAT is mandatory on the Mikrotik again.
 
neok
just joined
Topic Author
Posts: 3
Joined: Fri Jul 29, 2022 6:15 pm

Re: Wrong outgoing public IP

Fri Aug 12, 2022 4:13 pm

Or that ^^^, even better. But if you need NAT for 10.250.250.0/24 subnet, then exclude public subnet from srcnat using src-address=!x.y.z.104/29.
I did not even look at the config-file but only the picture. :D
Then he better had some extra segment 10.250.250.0/24 & 192.168.88.0/24 on the picture.

Yeah, in that case IF that 10.250.250.x and/or 192.168.88.0/24 needs Internet access then NAT is mandatory on the Mikrotik again.
Thank you very much for the answers. Sorry, I forgot to mention, I don't need internet access from the networks 10.250.250.0/24 nor from 192.168.88.0/24. Only from 10.10.40.0/22.
So, if I understood correctly, I just remove the NAT from my Mikrotik router and with that I would have it solved, right?

Thanks again.
Best regards

Gabriel
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 989
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: Wrong outgoing public IP

Fri Aug 12, 2022 5:05 pm

Yep, that should do it. Give it a try.
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Wrong outgoing public IP

Fri Aug 12, 2022 5:10 pm

And if you want x.y.z.110 to handle own firewalling for incoming connections, you should remove the last filter rule in forward chain.
 
neok
just joined
Topic Author
Posts: 3
Joined: Fri Jul 29, 2022 6:15 pm

Re: Wrong outgoing public IP

Wed Aug 24, 2022 8:49 pm

I change NAT from masquerade to accept and disable last firewall policy and everithing is working that I whish.
Thanks for the help.
Best regards,

Gabriel

Who is online

Users browsing this forum: jfh, llamajaja, v12, zabloc and 69 guests