LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Single DHCP server ,to provide the ip address to a MAC address in two different subne (http://www.linuxquestions.org/questions/linux-software-2/single-dhcp-server-to-provide-the-ip-address-to-a-mac-address-in-two-different-subne-550543/)

alix123 05-01-2007 11:21 PM

Single DHCP server ,to provide the ip address to a MAC address in two different subne
 
Can a single DHCP server ,provide the ip address to a MAC address in two different subnets

For example i have a client whose mac address :- 00:9F:55:34:56:55 & assuming that there are two different subnets such as 10.201.202.0/24 and 10.201.200.0/24

I have to statically bind this MAC address ip address (a must)

so when the client is connected to the 1st physical network ,10.201.202.0/24 DHCP should issue ip addrss 10.201.202.10

and when the client is connected to the 2nd physical network ,10.201.200.0/24 DHCP should issue ip addrss 10.201.200.10

If iam not wrong the DHCP needs to have ip address & physical interface in each subnet? Can i use a single physical interface assined two different virtual address in each subnet.?

is there anything i need to change on clients?

Can some body provide the simple dhcp.conf file , iam able to implement my dhcp for single subnet ,but I'am really confused with two different subnets.

Gryyphyn 05-02-2007 01:28 AM

Quote:

Originally Posted by alix123
Can a single DHCP server ,provide the ip address to a MAC address in two different subnets

For example i have a client whose mac address :- 00:9F:55:34:56:55 & assuming that there are two different subnets such as 10.201.202.0/24 and 10.201.200.0/24

I have to statically bind this MAC address ip address (a must)

so when the client is connected to the 1st physical network ,10.201.202.0/24 DHCP should issue ip addrss 10.201.202.10

and when the client is connected to the 2nd physical network ,10.201.200.0/24 DHCP should issue ip addrss 10.201.200.10

If iam not wrong the DHCP needs to have ip address & physical interface in each subnet? Can i use a single physical interface assined two different virtual address in each subnet.?

is there anything i need to change on clients?

Can some body provide the simple dhcp.conf file , iam able to implement my dhcp for single subnet ,but I'am really confused with two different subnets.

Wow, that's a loaded question... Are you taking something like a laptop to two different subnets or are you doing vsys/vlan routing for different services from one NIC in the same network environment?

If you're running back and forth between two networks with one box then you should be able to bind the mac to a specific IP on the router/DHCP server. Routers like Linksys and Juniper Netscreen allow this.

As far as I know there's no way to do this client side. You'd have to request a specific IP from the client, possibly through a script, but I don't think that's really a solution for your issue.

If you're doing some type of advanced routing then it's not IP binding, it's service binding and advanced routing that needs to be resolved.

Give some more detail about the network environment and it would be a lot easier to give advice. Information such as routers on the network and connection type are particularly helpful for this kind of situation. :)

Gryyphyn, out.

alix123 05-04-2007 07:53 PM

yes my hosts are switching back & forth in two vlans
 
Hii thanks for the reply

yes my hosts are switching back and forth in two different vlans ,my dhcp should remain constant once it is setup ,however if there
topology change for example if my host was in 200 vlan will now be in 202 vlan ,so each time the dhcp should issue the ip address based on that vlan.

Gryyphyn 05-05-2007 11:24 PM

Quote:

Originally Posted by alix123
Hii thanks for the reply

yes my hosts are switching back and forth in two different vlans ,my dhcp should remain constant once it is setup ,however if there
topology change for example if my host was in 200 vlan will now be in 202 vlan ,so each time the dhcp should issue the ip address based on that vlan.

If I understand your topology correctly then I'm not sure that there is much of a solution.

If you were traipsing between two different LANs then it would be simple. The problem is that your client/host would broadcast a request and wait for a reply. The first server to reply is the one that's going to give out the IP. If that's one server then your host is going to already be registered and will be assigned an IP from the primary list.

In order to do what you're talking about you'd have to have some way to make a choice between which IP you get.

Let's make sure I've got your configuration right: you have one switch/router, multiple clients and a DHCP server that's behind everything. You have multiple servers in the network, separated by a router of some kind that's doing your VLAN separation and you need one box to access them all.

If that's correct I'd have an allowed client policy/ACL that would direct traffic based on requested port from specific IP. Make sure that you get the same IP from the DHCP server every time by MAC and use the router like it's designed: to route from one LAN or VLAN to another. That's the only solution I can think of without more specific information about your topology.

Gryyphyn, out.

alix123 05-07-2007 11:25 PM

Well here is my exact topology
 
1) switch /router
2) linux box acting as a DHCP server.
3) two subnets 10.201.202.0/24 & 10.201.200.0/24
4) two vlans 20 ,22

basically iam trying to do pxe based installation,thats why i need the DHCP server.

So my objective if somebody plugs in the PC(physically) to 10.201.200.0/24 subnet or topology changes he should be able to get the ip address from dhcp

similarly if somebody plugs in to 10.201.202.0/24 he also should able to get the ip address from dhcp.

I can statically bind the MAC->ip ,because I have list of MAC address/pc that cab be plugged.

currently my dhcp is in 20 vlan giving dhcp ip address to PC's in 20 vlan and this is working fine.

I want the same dhcp server to issue the ip address to PC's on 22 vlan.

it may be possible sometimes ,assuming that a device 'A' whose MAC address is 00:aa:5f:00:90:fg is connected to 20 vlan or it may be connected to 22 vlan.So DHCP should offer the ip address depending upon the port/vlan/subnet the request came in??

Gryyphyn 05-08-2007 11:16 PM

Quote:

Originally Posted by alix123
So DHCP should offer the ip address depending upon the port/vlan/subnet the request came in??

Not exactly. When a client connects to a network there's four DHCP packets that get sent:

Syn (hello & request)
Syn/Ack (reply and 'what do you need?')
Syn/Ack (need IP address, here's my mac)
Ack (got your mac, here's your IP)

Problem is that the DHCP server has to be on the same subnet as the requesting client. I see three possible solutions:

1. Add a NIC to your DHCP server, making it multi-honed, and tie the second NIC to 22.

2. Set up relay agent. A relay agent is on the same subnet and will forward the request to a specific destination IP, then return the Ack to the requesting client. But I'm not sure how to accomplish this outside of the Win realm so I couldn't help with that.

3. Make your router the relay agents. The primary problems with this is a) your router wants to be the DHCP server anyways; b) the routers that can do this are fairly expensive; and c) it would defeat the purpose of having a dedicated Linux DHCP server.

My personal advice is to go with the relay agent. You can then specify through the server options to have all requests coming in eth0 to get assigned an IP from the 20 vlan/200 net (like it's already set up now) and inbound to eth1 would be assigned an address from vlan22/sub 202.

Hope all of this makes sense for you. It's pretty much the limit of my knowledge now.

If anyone else can lend some assistance I'm sure it would be appreciated. Hope everything goes well for you!

Gryyphyn, out.


All times are GMT -5. The time now is 05:47 PM.