Page 1 of 1

one dhcp server, static leases two diffent gateway addresses

Posted: Fri Jun 14, 2019 11:42 am
by rene72
Hi,

I have got me an RB2011 (I am new to this hardware) and got it configured with dhcp rangen 192.168.1.100 - 192.168.1.200 gateway 192.168.1.1
I also got a few devices configures static: 192.168.1.50,192.168.1.51,192.168.1.53,192.168.1.54,192.168.1.60

Now I want to change the default gateway for ip-adress 192.168.1.53 from 192.168.1.1 to 192.168.2.5 when it assigns the static ipaddress to that device.
Is there an option to do this with the firewall rules and/or mangle rules ?
Or is there another way to accomplish this.

Re: one dhcp server, static leases two diffent gateway addresses

Posted: Fri Jun 14, 2019 2:12 pm
by Sob
Where does 192.168.2.5 suddenly comes from? You didn't write what netmask you have, but in case it's the most common /24, 192.168.2.x can't be default gateway for 192.168.1.x. Or do you mean two upstream routers and routing traffic from some addresses to one and from other addresses to another?

Re: one dhcp server, static leases two diffent gateway addresses

Posted: Fri Jun 14, 2019 2:29 pm
by rene72
Where does 192.168.2.5 suddenly comes from? You didn't write what netmask you have, but in case it's the most common /24, 192.168.2.x can't be default gateway for 192.168.1.x. Or do you mean two upstream routers and routing traffic from some addresses to one and from other addresses to another?
Hi oops my mistake. The correct text should be:
Hi,

I have got me an RB2011 (I am new to this hardware) and got it configured with dhcp rangen 192.168.1.100 - 192.168.1.200 gateway 192.168.1.1
I also got a few devices configures static: 192.168.1.50,192.168.1.51,192.168.1.53,192.168.1.54,192.168.1.60

Now I want to change the default gateway for ip-adress 192.168.1.53 from 192.168.1.1 to 192.168.1.2 when it assigns the static ipaddress to that device.
Is there an option to do this with the firewall rules and/or mangle rules ?
Or is there another way to accomplish this.
Subnet mask is 255.255.255.0

Re: one dhcp server, static leases two diffent gateway addresses

Posted: Fri Jun 14, 2019 2:59 pm
by sebastia
You can achieve this by defining multiple networks, ex:
/ip dhcp-server network
add address=192.168.1.0/26 dns-server=192.168.1.1 domain=home gateway=192.168.1.1 netmask=24 ntp-server=192.168.1.1
add address=192.168.1.64/26 dns-server=172.16.1.2 domain=dyn.home gateway=192.168.1.2 netmask=24 ntp-server=192.168.1.2

Re: one dhcp server, static leases two diffent gateway addresses

Posted: Fri Jun 14, 2019 9:12 pm
by rene72
You can achieve this by defining multiple networks, ex:
/ip dhcp-server network
add address=192.168.1.0/26 dns-server=192.168.1.1 domain=home gateway=192.168.1.1 netmask=24 ntp-server=192.168.1.1
add address=192.168.1.64/26 dns-server=172.16.1.2 domain=dyn.home gateway=192.168.1.2 netmask=24 ntp-server=192.168.1.2
Hi,

Yes did was it I was looking for thanx, I changed /26 to /25 to create two scopes.
Tested it and works thank you for the fast reply