VLAN and fixed IPs

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

VLAN and fixed IPs

Jan Lundmark

 

 

 

Hi,

 

We have an application where we want the clients to  have fixed IPs and that the clients are all on the same subnet.

It is not practical for our application to use the MAC adresses of the clients.

 

This configuration below will assign a somewhat fixed IP based on the VLAN  subnets but it is not exactly what we want.

The point is that we want each client to receive a fixed IP address based on their port in the switch.

 

/etc/network/interfaces:

# VLAN 2

iface eth0.2 inet static

address 192.168.5.1

netmask 255.255.255.0

vlan_raw_device eth0

 

# VLAN 3

iface eth0.3 inet static

address 192.168.6.1

netmask 255.255.255.0

vlan_raw_device eth0

 

/etc/dhcp/dhcpd.conf

# VLAN 2DHCP

subnet 192.168.5.0 netmask 255.255.255.0 {

                range 192.168.5.50 192.168.5.200;

}

 

# VLAN 3

subnet 192.168.6.0 netmask 255.255.255.0 {

                range 192.168.6.50 192.168.6.200;

}

 

 

So, my question is:

 

Is there a way to assign fixed IP(v4) adresses in dhcpd.conf to clients based on their VLAN membership instead of their subnet?

 

Regards

 

Jan

 

 

 

 


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: VLAN and fixed IPs

José Queiroz
Why don't you give your devices a loooong lease, so the addresses get fixed to the devices, once assigned?



2017-09-28 6:33 GMT-03:00 Jan Lundmark <[hidden email]>:

 

 

 

Hi,

 

We have an application where we want the clients to  have fixed IPs and that the clients are all on the same subnet.

It is not practical for our application to use the MAC adresses of the clients.

 

This configuration below will assign a somewhat fixed IP based on the VLAN  subnets but it is not exactly what we want.

The point is that we want each client to receive a fixed IP address based on their port in the switch.

 

/etc/network/interfaces:

# VLAN 2

iface eth0.2 inet static

address 192.168.5.1

netmask 255.255.255.0

vlan_raw_device eth0

 

# VLAN 3

iface eth0.3 inet static

address 192.168.6.1

netmask 255.255.255.0

vlan_raw_device eth0

 

/etc/dhcp/dhcpd.conf

# VLAN 2DHCP

subnet 192.168.5.0 netmask 255.255.255.0 {

                range 192.168.5.50 192.168.5.200;

}

 

# VLAN 3

subnet 192.168.6.0 netmask 255.255.255.0 {

                range 192.168.6.50 192.168.6.200;

}

 

 

So, my question is:

 

Is there a way to assign fixed IP(v4) adresses in dhcpd.conf to clients based on their VLAN membership instead of their subnet?

 

Regards

 

Jan

 

 

 

 


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: VLAN and fixed IPs

Christian Kratzer
In reply to this post by Jan Lundmark
Hi,

On Thu, 28 Sep 2017, Jan Lundmark wrote:

>
>
>
> Hi,
>
> We have an application where we want the clients to  have fixed IPs and that the clients are all on the same subnet.
> It is not practical for our application to use the MAC adresses of the clients.
>
> This configuration below will assign a somewhat fixed IP based on the VLAN  subnets but it is not exactly what we want.
> The point is that we want each client to receive a fixed IP address based on their port in the switch.
<snipp/>

dhcp snooping on some switches is able to insert realay agent options into packets passing by even in pure l2 environments.

You can then assign fixed ip based on option82 circuit-id or remote-id options.

Greetings
Christian

--
Christian Kratzer                   CK Software GmbH
Email:   [hidden email]               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

RE: VLAN and fixed IPs

Patrick Trapp
Seconding Christian's suggestion if your relay agent will support it.

-----Original Message-----
From: dhcp-users [mailto:[hidden email]] On Behalf Of Christian Kratzer
Sent: Thursday, September 28, 2017 4:48 AM
To: Users of ISC DHCP <[hidden email]>
Subject: Re: VLAN and fixed IPs

Hi,

On Thu, 28 Sep 2017, Jan Lundmark wrote:

>
>
>
> Hi,
>
> We have an application where we want the clients to  have fixed IPs and that the clients are all on the same subnet.
> It is not practical for our application to use the MAC adresses of the clients.
>
> This configuration below will assign a somewhat fixed IP based on the VLAN  subnets but it is not exactly what we want.
> The point is that we want each client to receive a fixed IP address based on their port in the switch.
<snipp/>

dhcp snooping on some switches is able to insert realay agent options into packets passing by even in pure l2 environments.

You can then assign fixed ip based on option82 circuit-id or remote-id options.

Greetings
Christian

--
Christian Kratzer                   CK Software GmbH
Email:   [hidden email]               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: VLAN and fixed IPs

Christian Kratzer
In reply to this post by Jan Lundmark
Hi,

On Thu, 28 Sep 2017, Jan Lundmark wrote:
<snipp/>
> Is there a way to assign fixed IP(v4) adresses in dhcpd.conf to clients based on their VLAN membership instead of their subnet?

once you have dhcp snooping setup you can do things like this:

cisco switch:

!
ip dhcp snooping vlan 101
!
interface GigabitEthernet1/0/1
  switchport mode access
  switchport access vlan 101
  ip dhcp snooping vlan 101 information option format-type circuit-id override string foo
!

interface GigabitEthernet1/0/2
  switchport mode access
  switchport access vlan 101
  ip dhcp snooping vlan 101 information option format-type circuit-id override string bar
!

dhcp.conf:

host foo {
     host-identifier option agent.circuit-id "foo";
     fixed-address 192.0.2.1;
}
host bar {
     host-identifier option agent.circuit-id "bar";
     fixed-address 192.0.2.2;
}


>
> Regards
>
> Jan
>
>
>
>
>

--
Christian Kratzer                   CK Software GmbH
Email:   [hidden email]               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: VLAN and fixed IPs

Doug Hughes
In reply to this post by Patrick Trapp
3rd for Option 82. Most switches DHCP relay agent will support this via
a command. The problem I ran into with the ISC DHCP option 82 was that I
could do it based upon circuit-id (switch port) or on switch ID
(sometimes IP address of switch, sometimes configurable to mac, or
sometimes to hostname, usually configurable), but trying many different
ways I could never get it to use both at the same time.

If your use case is simple on a single switch, or multiple switches
where the switch port is unique, it should work just fine.



On 9/28/2017 5:58 AM, Patrick Trapp wrote:

> Seconding Christian's suggestion if your relay agent will support it.
>
> -----Original Message-----
> From: dhcp-users [mailto:[hidden email]] On Behalf Of Christian Kratzer
> Sent: Thursday, September 28, 2017 4:48 AM
> To: Users of ISC DHCP <[hidden email]>
> Subject: Re: VLAN and fixed IPs
>
> Hi,
>
> On Thu, 28 Sep 2017, Jan Lundmark wrote:
>>
>>
>> Hi,
>>
>> We have an application where we want the clients to  have fixed IPs and that the clients are all on the same subnet.
>> It is not practical for our application to use the MAC adresses of the clients.
>>
>> This configuration below will assign a somewhat fixed IP based on the VLAN  subnets but it is not exactly what we want.
>> The point is that we want each client to receive a fixed IP address based on their port in the switch.
> <snipp/>
>
> dhcp snooping on some switches is able to insert realay agent options into packets passing by even in pure l2 environments.
>
> You can then assign fixed ip based on option82 circuit-id or remote-id options.
>
> Greetings
> Christian
>

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: VLAN and fixed IPs

Christian Kratzer
Hi,

On Thu, 28 Sep 2017, Doug Hughes wrote:

> 3rd for Option 82. Most switches DHCP relay agent will support this via
> a command. The problem I ran into with the ISC DHCP option 82 was that I
> could do it based upon circuit-id (switch port) or on switch ID
> (sometimes IP address of switch, sometimes configurable to mac, or
> sometimes to hostname, usually configurable), but trying many different
> ways I could never get it to use both at the same time.

yes isc cannot match both.

Generally you should have control over what values you provision into circuit-id or remote-id so you should be able to provision a sufficently unique value so you can get by with only matching one of them.

In an isp ptp fibre scenario I provision the customers lineid into option82 circuit-id.

> If your use case is simple on a single switch, or multiple switches
> where the switch port is unique, it should work just fine.

the trick is to design your network so that what you want is possible.


Greetings
Christian

--
Christian Kratzer                   CK Software GmbH
Email:   [hidden email]               Wildberger Weg 24/2
Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian Kratzer
Web:     http://www.cksoft.de/
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users