Monday, July 31, 2017

How to Configure VLAN, DHCP server, Assigning IP on a VLAN interface & routing provision at Cisco Switch


---------------Basic Initial Configuration----------------------------
(config)#line vty 0 4
(config-line)#password cisco
(config-line)#login
(config)#enable secret password
(config)#service password-encryption
(config)#banner login "Authorized Personnel Only!"
(config)#hostname Sylhet_S2

---------------VLAN Configuration----------------------------
(config)#vlan 10
(config)#name SYL_IT
(config)#vlan 20
(config)#name SYL_NOC
(config)#vlan 30
(config)#name SYL_BK
(config)#vlan 99
(config)#name Management
(config)#interface range fa0/10-14
(config-if-range)#switchport mode access
(config-if-range)#switchport access vlan 10
(config)#interface range fa0/15-20
(config-if)#switchport mode access
(config-if)#switchport access vlan 20
(config)#interface range fa0/21-24
(config-if-range)#switchport mode access
(config-if-range)#switchport access vlan 30
(config)#interface fa0/03
(config-if)#switchport mode access
(config-if)#switchport access vlan 99
(config)#interfaceinterface fa0/01
(config-if)#switchport trunk encapsulation dot1
(config-if)#switchport mode trunk
(config)#interfaceinterface fa0/02
(config-if)#switchport trunk encapsulation dot1
(config-if)#switchport mode trunk
(config)#interfaceinterface fa0/03
(config-if)#switchport trunk encapsulation dot1
(config-if)#switchport mode trunk
(config-if)#switchport trunk allowed vlan add 10,30,99


--------------------Assign IP to each VLAN ---------------------------
(config)#interface vlan 99
(config-if)#ip address 192.168.0.99 255.255.255.0
(config-if)#no sh
(config)#interface vlan 10
(config-if)#ip address 192.168.10.1 255.255.255.0
(config-if)#no sh
(config)#interface vlan 20
(config-if)#ip address 192.168.20.1 255.255.255.00
(config-if)#no sh
(config)#interface vlan 30
(config-if)#ip address 192.168.30.1 255.255.255.0
(config-if)#no sh


--------------------DHCP CONFIGURATION---------------------------
(config)# ip dhcp pool MGT_IP_Client
(dhcp-config)# network 192.168.99.0 255.255.255.0
(dhcp-config)#dns-server 8.8.8.8
(dhcp-config)#default-router 192.168.99.1

(config)# ip dhcp pool VLAN_10_IP_Client      //Create a DHCP IP address pool for the IP addresses you want to use.
(dhcp-config)# network 192.168.10.0 255.255.255.0 //Specify the network and subnet for the addresses you want to use from the pool.
(dhcp-config)#dns-server 8.8.8.8
(dhcp-config)#default-router 192.168.10.1   //Specify the default router (i.e., default gateway).
(dhcp-config)#lease 7   //Specify the lease duration for the addresses you're using from the pool.

(config)# ip dhcp pool VLAN_20_IP_Client
(dhcp-config)# network 192.168.20.0 255.255.255.0
(dhcp-config)#dns-server 8.8.8.8
(dhcp-config)#default-router 192.168.20.1

(config)# ip dhcp pool VLAN_30_IP_Client
(dhcp-config)# network 192.168.30.0 255.255.255.0
(dhcp-config)#dns-server 8.8.8.8
(dhcp-config)#default-router 192.168.30.1

####This takes you back to the global configuration prompt. Next, exclude any addresses in the pool range that you don't want to hand out.
For example, let's say that you've decided that all IP addresses up to .100 will be for static IP devices such as servers and printers. 
All IP addresses above .100 will be available in the pool for DHCP clients.
Here's an example of how to exclude IP addresses .100 and below:
(config)#ip dhcp excluded-address 1.1.1.0 1.1.1.100 ######

(config)#ip dhcp excluded-address 192.168.99.1 192.168.99.20
(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.20
(config)#ip dhcp excluded-address 192.168.20.1 192.168.20.20
(config)#ip dhcp excluded-address 192.168.30.1 192.168.30.20

No comments:

Post a Comment