DHCP lab in GNS3 | How to Configure DHCP on Cisco Router

Cisco DHCP Configuration | How to assign automatic IP address from Cisco Router:

In this article I will show you how to configure and enable DHCP (Dynamic Host Configuration Protocol) on Gns3 router. For this lab I have Create the following lab in which I have configure a router (DHCP Server) as DHCP server where as I used the two DHCP clients which will obtain the IP address automatically from DHCP server. These DHCP clients include a router (which is configured like a PC) and a VM machine.  You can visit How to connect windows VM to Gns3 & installation of windows 10 on Virtualbox for more detail.



Following configuration are required for making the Router as DHCP server.

DHCP server (R1) Configuration:
R1#enable
R1#Configure t
R1 config)#ip dhcp pool ipranges
R1(dhcp-config)# network 100.1.11.0 255.255.255.0
R1(dhcp-config)#dns server 100.1.11.1
 R1(dhcp-config)#default-router 100.1.11.1
R1(dhcp-config)#lease 10 (this command will set the IP lease for 10 day, view more Cisco Commands)

How to exclude the IP addresses from DHCP range


R1(dhcp-config)#ip dhcp excluded-addresses 100.1.11.20 100.1.11.31

Following are the configuration required on router which will act as DHCP client.

PC2 Configuration:
PC2#enable
PC2#Configure t
PC21#no ip routing
PC2#inf f0/0
PC2#ip address dhcp
 PC2#no shutdown

VM win 10 DHCP client configurations:

Simple power on the VM host in DHCP and set the network adapter setting to obtain the IP automatically. Check the following images:




How to test DHCP configurations:

On DHCP server use the following command for confirming DHCP configurations
show ip dhcp binding
Following will be the output in our case.


Other command that you can use is:
show DHCP neighbor.

2 comments:

  1. HI I write this like a voip router configuration sip.conf with asterisk but I cant run nothing, any web with this navigation demo?


    [GENERAL]


    ;SERVER
    ;host=dynamic;
    ;bindaddr=0.0.0.0
    ;bindport=5060; default 5060
    ;permit=/
    ;deny=/
    ;srvlookup=no;
    ;autodomain;
    ;domains;
    ;externip;
    ;externhost;
    ;trunkname;


    ;;RESOURCES
    context=default
    ;context=normal;
    ;context=unauthenticated;
    ;disallow=all
    ;allow=ilbc
    ;allow=g729
    ;allow=gsm
    ;allow=g723
    ;allow=ulaw
    ;allow=ulaw
    ;videosupport=yes;
    ;language=en,es;
    ;musicclass;
    ;musdiconhold;
    ;engine;
    ;autodomain=yes;
    ;externrefresh=10;
    ;tcpenable=no;
    ;tcpbindaddr=0.0.0.0;
    ;udpbindaddr=0.0.0.0;
    ;transport=tcp;
    ;regcontext;
    ;vmexten;
    ;nat=yes;
    ;incominglimit;
    ;outgoinglimit;
    ;tlsbindaddr;




    ;;SIP SERVER CONFIGURATION
    ;qualify=yes;
    ;fromuser=dynamic;
    ;allowexternaldomains;
    ;canreinvite=yes;
    ;compactheaders=yes;
    ;notifymimetype=yes;
    ;useragent; = : Allow the SIP header "User-Agent" to be customized. The default is "Asterisk PBX"
    ;directrtpsetup=yes;
    ;trustrpid;
    ;sendrpid;
    ;subscribemwi=yes;
    ;progressinband=yes;
    ;disallowed_methods;
    ;directrtpsetup = yes;
    ;preferred_codec_only=yes;
    ;fromdomain=dynamic;



    ;;REAL TIME
    ;tos=reliability;
    ;tos_sip=cs3 ; Sets TOS for SIP packets.
    ;tos_audio=ef ; Sets TOS for RTP audio packets.
    ;tos_video=af41 ; Sets TOS for RTP video packets.
    ;tos_text=af41 ; Sets TOS for RTP text packets.
    ;cos_sip=3 ; Sets 802.1p priority for SIP packets.
    ;cos_audio=5 ; Sets 802.1p priority for RTP audio packets.
    ;cos_video=4 ; Sets 802.1p priority for RTP video packets.
    ;cos_text=3 ; Sets 802.1p priority for RTP text packets.
    ;rtautoclear=yes;
    ;rtcachefriends=no;
    ;rtpholdtimeout=300;
    ;rtpkeepalive=20;
    ;rtptimeout=0;
    ;directsetup=yes;
    ;jbenable=yes;
    ;jbforce=yes;
    ;jbmaxsize=500;
    ;jbresyncthreshold=1000;
    ;jbimpl=fixed;
    ;relaxdtmf=yes;
    ;rfc2833compensate=yes;
    ;dtmfmode=rfc2833;
    ;directmedia=yes;
    ;directrtpsetup=yes;
    ;allowoverlap=no;



    ;;REGISTERINGS & ACCOUNTS
    ;allowsubscribe=no; Enablings
    ;autocreatepeer=no;
    ;allowguest=no;
    ;auth = ;
    ;defaultexpiry=2;
    ;regseconds=2;
    ;call-limit=15;
    ;busylevel=5;
    ;ignoreregexpire=yes;
    ;outboundproxy;
    ;outboundproxyport;
    ;regcontext;
    ;registerattempts;
    ;registertimeout;
    ;subscribecontext=default_extension;
    ;defaultuser=rutersip;
    ;usereqphone=no;
    ;callgroup;
    ;pickupgroup;
    ;regexten;


    ;;NUMBERING AND ROUTING
    ;pedantic;
    ;setvar;
    ;permit=/
    ;deny=/
    ;restrictcid;




    ;;SERVERS INTEGRATION & SERVICES
    ;mailbox;
    ;Asterisk sip checkmwi;
    ;amaflags;
    ;astdb;
    ;callcounter;
    ;recordhistory;
    ;notifyringing
    ;callevents;
    ;promiscredir;
    ;useclientcode;
    ;dumphistory;
    ;rtupdate;
    ;jblog;
    ;notifyringing;
    sipdebug=yes;















    ;[11];[SIP_ACCOUNT]
    ;ACCOUNT
    ;name;
    ;accountcode;
    ;username;
    ;secret;
    ;host;
    ;autodomain;
    ;canreinvite;
    ;domains;
    ;notifyringing;
    ;defaultuser;
    ;md5secret;


    ;REGISTRATION


    ;SIP
    ;user
    ;authuser;
    ;callerid;
    ;callingpres;
    ;port;
    ;type=user;
    ;disallow=all;
    ;allow;
    ;nat;
    ;dmtfmode;
    ;fromuser;


    ;DIALPLAN
    ;setvar;
    ;context;
    ;dial;


    ;SERVICES AND DESCRIPTION
    ;mailbox;
    ;defaultip;
    ;fullcontact;
    ;fullname;


    ;.....

    ;or register => user[:secret[:authuser]]@host[:port][/extension]
    ;mwi => 1234:password@mysipprovider.com/1234




    ;[1000]
    ;ACCOUNT
    ;username;
    ;secret;

    ;REGISTRATION

    ;SIP
    ;user;
    ;type=user


    ;DIALPLAN
    ;context

    ;context=default
    ;context=normal;
    ;context=unauthenticated;


    ;SERVICES AND DESCRIPTION


    ;[1001]
    ;ACCOUNT
    ;username;
    ;secret;

    ;REGISTRATION

    ;SIP
    ;user;
    ;type


    ;DIALPLAN


    ;SERVICES AND DESCRIPTION

    ReplyDelete

UA-23728446-1