9 Replies Latest reply: Jul 22, 2011 2:23 PM by Philip Esi RSS

    router interface as a DHCP client

    Harry

      Hallo everybody

       

      i've tried to assign a dynamic IP to a router interface so it would work as a dhcp client  gotten from a dhcp server.

      i made a video for that. but the server did not consider the router as thier gateway.

      how to solve it ?

       

        • 1. Re: router interface as a DHCP client
          Sey

          First of all, you didn't get an IP address by DHCP on the video, as there was no syslog message about that. Yes you have an IP address assigned to a router interface by DHCP, but that must have been before you started recording.

           

          You entered "ip add dhcp" for the second time. That command did not do anything as it did not differ from the one which is already in the running config. If you want to send a new DHCP query from the router, shut and the no shut the interface on the router.

           

          Now to your questions.

           

          1) Gateway not set. Why?

          You did not actually check if the gateway is set or not. You cannot see it in the "show ip int brief". Try "show ip route" instead.

           

          2) How can I successfully ping server at 12.0.0.2?

          You should have a valid IP address, subnet mask, and default gateway on the PC that you tried to ping from. The IP parameters should correspond to those on the router interface (either 10.x.x.x or 11.x.x.x, I don't know which is which).

          • 2. Re: router interface as a DHCP client
            Harry

            thanks Sey , i appreciate ur reply.

            let me in other words explain the problem.

            i know that the server should have a complete ip configuration in order to be visible through the router for the users from outside.

            here i go on:

            the server says: my ip is 12.0.0.2 /8 and i still need a gateway.

            hey router, your interface should not have an ip (which suppose to be my gateway)  because you are a DHCP client and i will give you a dynamic ip.

            the router says: ok, i got 12.0.0.1, thank you server !

            but...... the server didn't understand the change in the gateway ip. the server didn't pick it up.

            if i set manually a geteway ,this make no sense for DHCP server.

             

            how to insure that server gateway be changed dynamically with router ip

            coz they must be the same to access the network beyond the router.

            • 3. Re: router interface as a DHCP client
              simplyccna

              you can also zip yours pt file an attach here to get it checked by other members

              • 4. Re: router interface as a DHCP client
                Harry

                good idea, i did it. 

                • 5. Re: router interface as a DHCP client
                  Sey

                  Are you saying that you want to get a default gateway automatically not from the server but to the server? This is impossible as your server has a static IP address (and it's a DHCP server itself!)

                   

                  You've got to configure default gateway for server manually. DHCP is supposed to give an address to the router and, possibly, to other hosts behind the router.

                  • 6. Re: router interface as a DHCP client
                    Harry

                    if i assign a gateway manually to the server, how to insure that the router interface be assigned the same ip from dhcp setting of the server ? as a result the router works sometimes, and sometimes not.

                    is the use of setting an interface of a router as a dhcp client common and practical of not ?  what do we get out of it ?

                    • 7. Re: router interface as a DHCP client
                      Philip Esi

                      Hi Hydir,

                      A dhcp server gives out ip addresses, specifies a default gateway, dns server to clients etc but is not itself affected by the configured scope. Thats why if for instance you configured a network range of 20.0.0.0 with a mask of 255.0.0.0 and you manually configured the servers's ip to be 20.0.0.1 but didnt declare that ip address as excluded, the server would give out 20.0.0.1 as a valid address. Why? because a dhcp server is a server ONLY TO OTHER NODES and not to itself. So, if you assign an ip address to a router via dhcp and you want that router to be the gateway for the network and the server, you would specify that ip address as the default gateway in your dhcp config, and you would manually configure the server to have that address as the default gateway also.

                       

                      Now the thing is, how do we make sure the same router gets the gateway address everytime? You simply manually configure the ip address of that router to be the same as what you specified in the dhcp config on the server. You never want to assign the ip address of your gateway in production dynamically anyway.

                       

                      Note that implementing dhcp does not mean you dont have to manually set ip addresses. In live networks, the mission critical equipment, have their ip addresses manually set. In a lab environment, you can use dhcp to assign ip addresses to a router but in production, I'll strongly advise against it.

                       

                      HTH

                      Philip

                      • 8. Re: router interface as a DHCP client
                        Harry

                        Hello Philip,

                        you understood me very wel !

                        and your answer helped me very much.

                         

                        thanks alot

                         

                        b.r.

                        Hydir

                        • 9. Re: router interface as a DHCP client
                          Philip Esi

                          No problem.