Assign a specified IP address to device based on port in switch

Unanswered Question
Sep 12th, 2007
User Badges:

I?m looking for a way to assign a specified IP address to IP printers based on what port on a switch they are plugged into. Will any switches accomplish this?

Right now we are using serial printers with Avocent ESP-8 serial hubs. These hubs have not been reliable and are difficult to program and troubleshoot.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
JORGE RODRIGUEZ Wed, 09/12/2007 - 06:30
User Badges:
  • Green, 3000 points or more

Hi Jason,

When you assign IP address to the printers and connect them to a switchport simply assing the proper vlan# membership on the switcport, where vlan# is the referece of the subnet IP the printer will be under.



jason.c Wed, 09/12/2007 - 07:22
User Badges:

Thank you for the reply.

I do not want to specify the IP address on the printer. It will need to use DHCP or something else to get its IP address. It needs to receive an IP address based on what port it is plugged into on the switch. That way, when a printer is moved to a different location, it will receive the IP address that the printer in that location should have. Are there any switches that can be configured to do this? Thanks

jason.c Thu, 09/13/2007 - 06:44
User Badges:

thank you for the reply.

Looking into that, I'm unsure how an 802.1x login will assign a specific IP address to a device based on the port in the switch that it is plugged into. Is there something I'm missing?

An example of what I'm am looking for:

I would like for any IP printer that is plugged into port 2 on the switch to be automatically assigned the IP address and any IP printer that is plugged into port 3 to be automatically assigned the IP address That way if an IP printer that is plugged into port 2 (with an IP address of is moved to port 3 it?s IP address will automatically change to

Edison Ortiz Sat, 09/15/2007 - 11:39
User Badges:
  • Super Bronze, 10000 points or more
  • Hall of Fame,

    Founding Member

The switchport information is not supplied during a DHCP negotiation, therefore you will need to perform IP management a bit different.

DHCP provides the ability to create reservations under scopes. With reservations, you enter the MAC address of the printing device and assign a static IP address for that device.

If you have the ability to change the MAC address of the printing device, then you can achieve what you are after.

paul.matthews Thu, 09/13/2007 - 23:57
User Badges:
  • Silver, 250 points or more

The only way I can think of doing this is by using small VLANs - how important is printing? ie do you need full HSRP or will you be able to handle a short outage of printing if there is a router issue?

I'll go with managing without if there is a problem

interface vlan 23

des printer 1

ip add

interface vlan 24

des printer 2

ip add

int fas 0/15

des printer 1

switch mode acce

switch acce vlan 23

int fas 0/16

des printer 2

switch mode acce

switch acce vlan 24

dhcp pool printer-1

network /30


dhcp pool printer-2

network /30


Please note there may be the odd typo in there as I hve done this from memory, but it should be close enough to get you going. If you need more info by DHCP, you would really need to use a separate DHCP server and use helper addresses instead.

Please also note that this assumes it is all being done on one L3 switch - you may need to split this across multiple devices if you are using an L2 switch as the access switch for the printer - the routing and DHCP pools would be on the L3 device.

This way basically you only have one address available in each VLAN, and the VLAN is used on only one port, so that address can only be given to the one port.

The difference for HSRP is that you would need a bigger VLAN to accommodate two real addresses and the standby address. I would recommend going with just the non-HSRP option if you can as tha uses half the addressing per printer. It is not very economical though, as you are using a block of four per printer.


Please remember to rate useful posts.


This Discussion