Transcription
In my last video, I showed you how to configure a Cisco router with your home or office internet, step-by-step. In today's video, I'm going to show you how to connect and configure the internet on a Cisco switch and a Cisco router, step-by-step. If you haven't watched my previous video yet, I highly recommend checking it out first for a better understanding. The link is in the description below.
First, let me show you my network topology. This is my last video's topology, where I connected and configured my Cisco router with my home or office internet. Now, in this video, I'm going to add a Cisco switch to the same topology. I'll connect the FastEthernet 0/1 port of my Cisco router to the GigabitEthernet 1/24 port on the newly added Cisco switch. Then, I'll configure static IPs on these interfaces.
Here's what I'll cover in this video: creating VLANs, configuring a DHCP server to assign IP addresses automatically, configuring access ports on the Cisco switch, setting up a static route, and enabling IP routing on the Cisco switch. On the Cisco router side, I'll show you how to assign a DNS server, configure a static route for internet connectivity, and set up an access control list. Finally, we'll test the internet service on VLAN 20 by connecting a laptop to the Cisco switch. In my next video, I'll be adding and configuring a Hikvision NVR and Hikvision IP cameras to this network. So watch this video till the end and don't forget to check out my next video.
Now let's get started and do our physical activity first. I will connect one end of my network cable to the FastEthernet 0/1 port on the back side of my Cisco router. The second end of this network cable I'll connect to the GigabitEthernet 1/24 port on my Cisco switch.
I will configure my Cisco switch first. For that, I'll connect my console cable to the console port of my Cisco switch. After connecting the console cable, press Enter a couple of times and then type the command `enable` and press Enter. Now we are in enable mode. To go to global config mode, I type the command `config terminal` and press Enter.
First, we will change the Cisco switch name. By default, its name is `switch`. To change the Cisco switch name, I type the command `hostname` followed by the new name for this Cisco switch. I type `lab switch` and press Enter. And here you can see the switch name changes from `switch` to `lab switch`.
Now let's establish communication between the Cisco switch and the Cisco router by assigning static IPs to their interfaces. First, I will assign a static IP to my Cisco switch interface. For that, I type the command `interface GigabitEthernet 1/24` and press Enter. Now first I make this port a routed port. For that I type the command `no switchport` and press Enter. Now we can assign the static IP to this port. For that, I type `ip address 10.0.0.1 255.255.255.0` and press Enter. Here we have successfully assigned the static IP to this interface. Now I exit from here.
Next, we need to assign the static IP address to the FastEthernet 0/1 port on the router side. For that, first I remove the console cable from my Cisco switch console port and connect it to the Cisco router console port. After pressing Enter a couple of times, I type the command `enable` and press Enter. Then I type `config terminal` and press Enter. Now I select the router interface connected to my Cisco switch, which is FastEthernet 0/1, and press Enter. Next, I assign a static IP address to this interface by typing `ip address 10.0.1.1 255.255.255.0` and press Enter. To enable NAT on this port, I type `ip nat inside` and press Enter. By default, the router ports are in a shutdown state. To activate this port, I type `no shutdown` and press Enter. That's it. Then I exit and exit again.
To verify connectivity between my Cisco switch and Cisco router, let's ping the Cisco switch IP address from the router side. For that, I type the command `ping 10.0.1.2` and press Enter. Here you can see we can successfully ping our Cisco switch from the Cisco router. Now let's connect our console cable back to the Cisco switch and continue with the remaining configuration. Here I press Enter a couple of times and then first I'll show you how to create a VLAN on a Cisco switch. For that, I type the command `vlan 20` and press Enter. Next, I'll assign a name to this VLAN. To do that, I type `name` and let's assign the name `data` to this VLAN. Then I press Enter. Now VLAN 20 has been successfully created and named `data`. Then I exit.
Now let's assign a gateway IP address to this VLAN. For this, I go into the VLAN interface configuration mode by typing `interface VLAN 20` and press Enter. Next, I assign the gateway IP address to this VLAN by typing `ip address 10.0.2.254 255.255.255.0`. I choose the last IP address as the gateway. Then I press Enter. Finally, I exit. With this, we've successfully created VLAN 20 and configured it with a gateway IP address. The VLAN is now ready to use.
Now let me show you how to configure a DHCP server, or DHCP pool, on a Cisco switch. For that, I type the command `ip dhcp pool` and here you need to give the name to this pool. I type `VLAN 20` and press Enter. Next, I define the network range for this DHCP pool. To do that, I type `network 10.0.20.0 255.255.255.0` and press Enter. Now I need to provide the default gateway for this network: `default-router 10.0.2.254` and press Enter. This is the gateway IP address we assigned earlier to VLAN 20. Finally, I configured the DNS server for this DHCP pool. For that, I type `dns-server 8.8.8.8 4.2.2.2` and press Enter. These are free public DNS servers provided by Google. Once all settings are configured, I type `exit` to leave the DHCP configuration mode. We've successfully created a DHCP server for VLAN 20 on this Cisco switch.
Now I'll create another VLAN, VLAN 40, specifically for our CCTV network as per our network topology. To configure VLAN 40, I start by typing `vlan 40` and press Enter. VLAN 40 is now created. Next, I assign a name to this VLAN to indicate it's for the CCTV network. For that, I type `name CCTV` and press Enter. This sets the name of VLAN 40 to `CCTV`. After that, I type `exit` and press Enter. Now it's time to assign an IP address to VLAN 40. For this, I enter the VLAN interface configuration mode by typing `interface VLAN 40` and press Enter. Then I assign the gateway IP address for VLAN 40 by typing `ip address 10.40.0.254 255.255.255.0` and press Enter. This sets the last IP address in the subnet as the gateway for VLAN 40. Finally, I type `exit` to leave the interface configuration mode for VLAN 40. I won't create a DHCP server; all IP cameras and the NVR in this VLAN will use static IP addresses, which I'll show you in the next video.
Now let me show you how to configure access ports on a Cisco switch, step-by-step. To configure the first 10 ports as access ports for VLAN 20, I use the range command. I type `interface range GigabitEthernet 1/0/1-10` and press Enter. Now, to configure these ports as access ports, I type `switchport mode access` and press Enter. Next, I assign these ports to VLAN 20 by typing `switchport access vlan 20` and press Enter. Finally, I type `exit` to leave the interface configuration mode. Now the first 10 ports are successfully assigned to VLAN 20 as access ports.
Next, let's configure access ports for VLAN 40. To assign ports 11 through 20, I type `interface range GigabitEthernet 1/0/11-20` and press Enter. Then I type `switchport mode access` and press Enter to set these ports to access mode. After that, I assign them to VLAN 40 by typing `switchport access vlan 40` and press Enter. Finally, I type `exit` to leave the configuration mode. Now ports 11 through 20 are successfully assigned to VLAN 40 as access ports.
Now I will show you how to see the VLANs on a Cisco switch. For that, we type the command `show vlan` and press Enter. Here you can see VLAN 20 and VLAN 40 created successfully, and these ports are assigned to each VLAN.
Now let me show you how to configure a static route on a Cisco switch. This is an important step to ensure traffic is routed correctly to the internet. To configure the static route, I type the following command: `ip route 0.0.0.0 0.0.0.0 10.0.1.1` and press Enter. This command tells the switch that any IP address from any subnet should be routed to our Cisco router's IP address 10.0.1.1. The router will then handle forwarding the traffic to the internet.
Next, let me show you how to enable IP routing on the Cisco switch. To do that, I type `ip routing` and press Enter. This is the magical command that activates IP routing on the Cisco switch. Once the configuration is complete, it's important to save it. To save the configuration, I type `copy running-config startup-config` and press Enter. This ensures that all configurations are saved even after a reboot. With this, the Cisco switch configuration is complete. Now it's time to move on and configure the Cisco router.
Now let me shift the console cable from my Cisco switch to the console port of my Cisco router. After pressing Enter a couple of times, you can see that we're now in the Cisco router's command-line interface. I enter global configuration mode by typing `config terminal` and pressing Enter.
Now let me show you how to configure IP routing on the Cisco router. To do this, I type `ip route 10.0.2.0 255.255.255.0 10.0.1.2` and press Enter. This `ip route` command means traffic destined for the 10.0.2.0 network will be forwarded to the Cisco switch's interface at 10.0.1.2. Next, let's add the route for our second network. I use the same command as before but with the new network details. I type `ip route 10.0.40.0 255.255.255.0 10.0.1.2` and press Enter. This `ip route` command means this route will forward traffic destined for the 10.0.40 network to the Cisco switch's interface at 10.0.1.2. `ip route 0.0.0.0 0.0.0.0 192.168.1.1` and press Enter. This command creates a default route that forwards all traffic to my internet router at 192.168.1.1.
Now let me show you how to configure an access list on a Cisco router. This will allow us to control and permit traffic between our networks. For that, I type `ip access-list standard 1` and press Enter. Next, I permit the static IP network between my Cisco switch and router by typing `permit 10.0.1.0 0.0.0.3` and press Enter. 0.0.0.3 is the wildcard mask for this network. Now I need to permit VLAN 20 and VLAN 40 on this access list. For VLAN 20, I type `permit 10.0.2.0 0.0.0.255` and press Enter. Similarly, for VLAN 40, I type `permit 10.0.40.0 0.0.0.255` and press Enter. After adding all the necessary networks, I type `exit` to leave the access list configuration mode. When the access list is ready, it's time to configure NAT overload on the Cisco router. I type `ip nat inside source list 1 interface FastEthernet 0/0 overload` and press Enter. Now we have successfully completed the configuration on our Cisco router. Before proceeding with the verification, it's important to save the configuration by typing `copy running-config startup-config` and press Enter.
Now let's connect our laptop to one of the first 10 ports on the Cisco switch, which belongs to VLAN 20. As you can see, our laptop automatically receives an IP address from the VLAN 20 DHCP server configured on the Cisco switch. Next, let's test the internet connection. I open the browser, and here you can see the internet is working perfectly on my laptop.
In this video, we successfully configured a Cisco switch and Cisco router with my home internet. We also configured VLANs, DHCP, static routes, and NAT, and everything is functioning as expected. Thank you for watching, and please don't forget to like, share, and subscribe to my channel. Thank you.