Community discussions

MikroTik App
 
User avatar
pedzopenguin
just joined
Topic Author
Posts: 15
Joined: Thu Mar 10, 2011 4:42 am
Location: Belgrade, Serbia

DHCP server setup question

Tue Jan 03, 2012 9:19 pm

Can my RB750 have DHCP server configured for following scenario:

Image

I have tried to:
1. Create 3 different IP pools and then
2. Create 3 DHCP servers to use those pools (respectfully) asigning them to different ports
with no luck

In code:
1. /ip pool
add name="LAN" ranges=192.168.1.1-192.168.1.50
add name="LAN-AP" ranges=192.168.1.100-192.168.1.150
add name="Guest-AP" ranges=192.168.1.200-192.168.1.250
2. /ip dhcp-server
add name="DHCP_LAN" address-pool=LAN interface=eth2-LAN lease-time=3d
add name="DHCP_LAN-AP" address-pool=LAN-AP interface=eth3-LAN-AP lease-time=12h
add name="DHCP_Guest-AP" address-pool=Guest-AP interface=eth4-Guest-AP lease-time=2h
I don't know why this doesn't work :(
I'm just learning this stuff... What am I doing wrong?

Thanks in advance,
Penguin
 
w0lt
Long time Member
Long time Member
Posts: 537
Joined: Wed Apr 02, 2008 2:12 pm
Location: Minnesota USA

Re: DHCP server setup question

Tue Jan 03, 2012 9:30 pm

Specifically, what doesn't work?
Are you not able to get a dhcp lease off any of the ports?
Are you using a bridge anywhere?
 
User avatar
pedzopenguin
just joined
Topic Author
Posts: 15
Joined: Thu Mar 10, 2011 4:42 am
Location: Belgrade, Serbia

Re: DHCP server setup question

Wed Jan 04, 2012 12:21 am

I always get IP address from first range (for now :)).
No matter in what port I connect my test-PC.

What I did - step by step:
I did ip address release on my test PC.
I plugged into eth2 and got IP 192.168.1.45 (don't ask me why THAT address, I'm not sure). It's address from the scope I expected (1-50).
Unplugged from eth2.
Did ip address release again.
Manually setup IP address 192.168.1.66 (address not belonging to any scope defined).
Connected to RB (eth2 port) and deleted IP lease i got.
Disconnected from RB and released the IP address from PC.
Connected to eth3 - expected to get IP from 100-150 scope - and got IP address 192.168.1.44?! (address from first scope, defined on eth2 port)

RB config:
I did a quick default setup from scratch, just changing the IP on interface eth2 from default to 192.168.1.254 and renamed all interfaces. And rebooted to confirm.
So, no Bridge defined anywhere, and ports 2-5 swithed (port 2 is the master for 3-5), and port 1 is not switched with masquerading defined by default.
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: DHCP server setup question

Wed Jan 04, 2012 12:28 am

and ports 2-5 swithed (port 2 is the master for 3-5)
Above is answer to your question.
Set 'master-port=none' for interfaces 'eth3-LAN-AP' and 'eth4-Guest-AP'.

HTH,
 
w0lt
Long time Member
Long time Member
Posts: 537
Joined: Wed Apr 02, 2008 2:12 pm
Location: Minnesota USA

Re: DHCP server setup question

Wed Jan 04, 2012 12:36 am

I always get IP address from first range (for now :)).
No matter in what port I connect my test-PC.

What I did - step by step:
I did ip address release on my test PC.
I plugged into eth2 and got IP 192.168.1.45 (don't ask me why THAT address, I'm not sure). It's address from the scope I expected (1-50).
Unplugged from eth2.
Did ip address release again.
Manually setup IP address 192.168.1.66 (address not belonging to any scope defined).
Connected to RB (eth2 port) and deleted IP lease i got.
Disconnected from RB and released the IP address from PC.
Connected to eth3 - expected to get IP from 100-150 scope - and got IP address 192.168.1.44?! (address from first scope, defined on eth2 port)

RB config:
I did a quick default setup from scratch, just changing the IP on interface eth2 from default to 192.168.1.254 and renamed all interfaces. And rebooted to confirm.
So, no Bridge defined anywhere, and ports 2-5 swithed (port 2 is the master for 3-5), and port 1 is not switched with masquerading defined by default.
I believe you are getting a dhcp lease from the first range, as you say from any port, because you are setup in a switch configuration on ports 2 through 5. This is normal and to be expected. You will not be able to get the IP ranges on your ports that you have devised until you take them out of a switched configuration. Of course, once you do that, you'll have to route them as you will have removed the layer 2 connection between each port (2-5). If you try to bridge them, you'll just get the same issue, if I'm not mistaken.

Good luck..

-tp
 
w0lt
Long time Member
Long time Member
Posts: 537
Joined: Wed Apr 02, 2008 2:12 pm
Location: Minnesota USA

Re: DHCP server setup question

Wed Jan 04, 2012 3:59 am

This should give you a good start in accomplishing what you set out to do. This will use a combination of OSPF and the correct way to subnet you ip ranges. I have used 10.x.x.x where you have used 192.x.x.x. Either is ok as long as you use the correct subnet mask (cidr). I have tested this on my RB751U, and it seems to work well. My hope is that you can understand my work, and can make use of it.

Have fun...

-tp




#
/interface bridge
add admin-mac=00:00:00:00:00:00 ageing-time=5m arp=enabled auto-mac=yes \
disabled=no forward-delay=15s l2mtu=65535 max-message-age=20s mtu=1500 \
name=Loopback priority=0x8000 protocol-mode=none transmit-hold-count=6


/ip pool
add name=ether2 ranges=10.0.0.1-10.0.0.62
add name=ether3 ranges=10.0.0.65-10.0.0.126
add name=ether4 ranges=10.0.0.129-10.0.0.190
add name=ether5 ranges=10.0.0.193-10.0.0.253

/ip dhcp-server
add add-arp=yes address-pool=ether2 always-broadcast=yes authoritative=\
after-2sec-delay bootp-support=static disabled=no interface=ether2 \
lease-time=3d name=server1
add add-arp=yes address-pool=ether3 always-broadcast=yes authoritative=\
after-2sec-delay bootp-support=static disabled=no interface=ether3 \
lease-time=3d name=server2
add add-arp=yes address-pool=ether4 always-broadcast=yes authoritative=\
after-2sec-delay bootp-support=static disabled=no interface=ether4 \
lease-time=3d name=server3
add add-arp=yes address-pool=ether5 always-broadcast=yes authoritative=\
after-2sec-delay bootp-support=static disabled=no interface=ether5 \
lease-time=3d name=server4

/routing ospf instance
set default disabled=no distribute-default=never in-filter=ospf-in \
metric-bgp=auto metric-connected=20 metric-default=1 metric-other-ospf=\
auto metric-rip=20 metric-static=20 name=default out-filter=ospf-out \
redistribute-bgp=no redistribute-connected=no redistribute-other-ospf=no \
redistribute-rip=no redistribute-static=no router-id=10.0.1.254

/routing ospf area
set backbone area-id=0.0.0.0 disabled=no instance=default name=backbone type=\
default
add area-id=0.0.1.0 disabled=no instance=default name=area10 type=default
add area-id=0.0.1.1 disabled=no instance=default name=area11 type=default
add area-id=0.0.1.2 disabled=no instance=default name=area12 type=default
add area-id=0.0.1.3 disabled=no instance=default name=area13 type=default

/ip address
add address=10.0.0.1/26 disabled=no interface=ether2 network=10.0.0.0
add address=10.0.0.65/26 disabled=no interface=ether3 network=10.0.0.64
add address=10.0.0.129/26 disabled=no interface=ether4 network=10.0.0.128
add address=10.0.0.193/26 disabled=no interface=ether5 network=10.0.0.192
add address=10.0.0.254/32 disabled=no interface=Loopback network=10.0.0.254

/ip dhcp-client
add default-route-distance=0 disabled=no interface=ether1

/ip dhcp-server config
set store-leases-disk=5m

/ip dhcp-server network
add address=10.0.0.0/26 gateway=10.0.0.1
add address=10.0.0.64/26 gateway=10.0.0.65
add address=10.0.0.128/26 gateway=10.0.0.129
add address=10.0.0.192/26 gateway=10.0.0.193

/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB \
max-udp-packet-size=512 servers=172.16.11.1 <----- Change this to whatever you use

/ip firewall nat
add action=masquerade chain=srcnat disabled=no src-address=10.0.0.0/26
add action=masquerade chain=srcnat disabled=no src-address=10.0.0.64/26
add action=masquerade chain=srcnat disabled=no src-address=10.0.0.128/26
add action=masquerade chain=srcnat disabled=no src-address=10.0.0.192/26

/routing ospf network
add area=area10 disabled=no network=10.0.0.0/26
add area=area11 disabled=no network=10.0.0.64/26
add area=area12 disabled=no network=10.0.0.128/26
add area=area13 disabled=no network=10.0.0.192/26
add area=backbone disabled=no network=172.16.0.0/16 <----- Change this to whatever you use (the range on ether1)
 
User avatar
pedzopenguin
just joined
Topic Author
Posts: 15
Joined: Thu Mar 10, 2011 4:42 am
Location: Belgrade, Serbia

Re: DHCP server setup question

Wed Jan 04, 2012 10:44 pm

Will try this tommorow and will get back with results! Ty for your effort non the less!

One question, sine I'm still learning this stuff:
Why /interface bridge command?
What do we accomplish with that?

Thanks!
 
w0lt
Long time Member
Long time Member
Posts: 537
Joined: Wed Apr 02, 2008 2:12 pm
Location: Minnesota USA

Re: DHCP server setup question

Thu Jan 05, 2012 12:03 am

Will try this tommorow and will get back with results! Ty for your effort non the less!

One question, sine I'm still learning this stuff:
Why /interface bridge command?
What do we accomplish with that?

Thanks!
This is a "Loopback" interface to use with OSPF (Dynamic Routing).

You don't have to assign a interface to it, just the address.
add address=10.0.0.254/32 disabled=no interface=Loopback network=10.0.0.254
 
User avatar
pedzopenguin
just joined
Topic Author
Posts: 15
Joined: Thu Mar 10, 2011 4:42 am
Location: Belgrade, Serbia

Re: DHCP server setup question

Sun Jan 08, 2012 3:11 pm

It's working like a charm... now I'll have to study this further... Thanks!
Using OSPF is a marvelous idea! I just read that it's a bit CPU consuming ... I'll test this config non the less...

Karma up!
 
w0lt
Long time Member
Long time Member
Posts: 537
Joined: Wed Apr 02, 2008 2:12 pm
Location: Minnesota USA

Re: DHCP server setup question

Sun Jan 08, 2012 6:10 pm

Glad to hear it !!!
Thanks for the Karma..
Happy Trails..

-tp
 
User avatar
Girith
newbie
Posts: 34
Joined: Thu Jan 05, 2012 3:21 pm
Location: Zagreb, Croatia

Re: DHCP server setup question

Mon Jan 09, 2012 2:47 pm

there's really no need for OSPF if you don't have any other routers in your environment
 
User avatar
pedzopenguin
just joined
Topic Author
Posts: 15
Joined: Thu Mar 10, 2011 4:42 am
Location: Belgrade, Serbia

Re: DHCP server setup question

Tue Jan 10, 2012 12:14 am

there's really no need for OSPF if you don't have any other routers in your environment
I don't ... I have two AP's...
Could you please explain a bit more?

Regards
 
User avatar
Girith
newbie
Posts: 34
Joined: Thu Jan 05, 2012 3:21 pm
Location: Zagreb, Croatia

Re: DHCP server setup question

Tue Jan 10, 2012 12:47 am

APs are also routers :)
you need OSPF :wink:
 
brandonrossl
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Wed Jun 08, 2011 10:09 pm

Re: DHCP server setup question

Wed Jan 25, 2012 4:07 pm

Bu he doesn't have multiple routes to get to any destination, so I don't see how it would help.
 
User avatar
arbabnazar
Frequent Visitor
Frequent Visitor
Posts: 70
Joined: Tue May 03, 2011 1:37 pm

Re: DHCP server setup question

Sat Jan 28, 2012 7:16 pm

thanks for solution, i will try solution with OSPF and will let you know.......

Who is online

Users browsing this forum: JazzMaster and 17 guests