Community discussions

MikroTik App
 
PiGeonCZ
just joined
Topic Author
Posts: 12
Joined: Sat Jan 28, 2017 12:43 pm

WAN - IP address and route configuration

Sun Aug 21, 2022 11:01 am

Hello to everyone,
yestarday I was at my friends house to fix his WAN connection. His router is running on the 7.4.1 version.
The original commands used to configure the WAN IP address and static route were like this:
/ip address add address=192.168.88.48/32 interface=ether1 network=192.168.88.0
/ip route add distance=1 gateway=192.168.88.1
Notice the wrong netmask!

I am trying to recall what I saw yesterday, but the otput of the configuration must have looked like this:
Flags: D - DYNAMIC; A - ACTIVE; c, s, y - COPY
Columns: DST-ADDRESS, GATEWAY, DISTANCE
#     DST-ADDRESS       GATEWAY          DISTANCE
0  IUHs 0.0.0.0/0         192.168.88.1            1
  DAc 192.168.22.0/24   bridge_intranet         0
  DAc 192.168.88.0/32   ether1                  0
I have immediately noticed the dynamic route with the 0 IP address and /32 netmask, which didn't look right to me.
I was able to fix it by changing the Network IP to .1
/ip address add address=192.168.88.48/32 interface=ether1 network=192.168.88.1
The configuration now looks like this and everything seems to work flawlesly:
Flags: D - DYNAMIC; A - ACTIVE; c, s, y - COPY
Columns: DST-ADDRESS, GATEWAY, DISTANCE
#     DST-ADDRESS       GATEWAY          DISTANCE
0  As 0.0.0.0/0         192.168.88.1            1
  DAc 172.22.0.0/24     ovpn-client             0
  DAc 192.168.22.0/24   bridge_intranet         0
  DAc 192.168.88.1/32   ether1                  0

Originally I wanted to ask if there was some change in v7 routing configuration, but then I have compared it with my config and found out, that the proper solution would have been to change the Netmask of the WAN IP address to /24.
/ip address add address=192.168.88.48/24 interface=ether1 network=192.168.88.0

So my questions now are:
How come that everything is working?
Will it survive a reboot? I forgot to test it yesterday :(

thanks for any comments ;)

PiGeon

PS: my intention is to set the proper IP addres netmask and network IP next time I come by physically. I am afraid to touch it via remote connection.
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: WAN - IP address and route configuration  [SOLVED]

Sun Aug 21, 2022 8:40 pm

It works, because you created point to point config. If you have address with /32 mask, then the network parameter is remote address, which can be completely unrelated. You can have e.g.:
/ip address add address=192.168.88.48/32 interface=ether1 network=10.20.30.40
and in you connect it to another router with same config, only with swapped address and network parameters, it will work. It's less known, but same thing works also with Linux:
ip addr add 192.168.88.48 peer 10.20.30.40 dev eth0
or Windows:
address = 192.168.88.48
mask = 255.255.255.255
gateway = 10.20.30.40
and possibly other systems too. It's perfectly valid configuration and doesn't cause any problems, as long as you don't need to access any other 192.168.88.x, because now you don't have route to that.

If you want to change it to /24, which is probably still good idea, to avoid confusing someone else in the future, it should be safe to do remotely, especially if you use Safe Mode.

Who is online

Users browsing this forum: jaclaz, mstanciu, tarfox and 43 guests