Search code examples
networkingciscodhcp

Configuring a DHCP server with VLAN on a switch


I have a problem while configuring a switch, I want to create a VLAN and to activate the DHCP server and so all switch ports associated to this VLAN will receive automatically an IP address from the DHCP server.

So I want to ask you if this is possible ? and If 'yes', how can I dot it ? because I didn't found the appropriates commands (cisco or d-link) !


Solution

  • yes, of course it's possible

    take a look at this, i think it's what u want :

    Vlan's and DHCP

    Here is what u should do :

    ip dhcp pool pool1
    network 10.10.1.0 255.255.255.0
    default-router 10.10.1.1 
    dns-server what.ever.ip.itis
    !
    ip dhcp pool pool2
       network 10.10.2.0 255.255.255.0
       default-router 10.10.2.1 
       dns-server what.ever.ip.itis2
    vlan 10
     ip address 10.10.1.1 255.255.255.0
    !
    vlan 20
    ip address 10.10.2.1 255.255.255.0
    

    you must define two pools( or more ), and give them same range IP as u gave to your VLANs ... it will work ...

    And you should also exclude ip addresses that the router uses (.1 in this example).