TRUNK MODE......






from email.policy import default
from multiprocessing.dummy import connection


Trunk Mode = Trunk port bind the multipal communication path into single path.

switch 1 is connect to switch 2 via fa0/1 on both side.
vlan 2 has 32 pc and vlan 3 has 10 pc.
23 connection from switch 1 and 9 connection from switch 2.

------configration on switch 1

Switch>en
Switch#sh vtp status
VTP Version                     : 2
Configuration Revision          : 0
Maximum VLANs supported locally : 255
Number of existing VLANs        : 5
VTP Operating Mode              : Server    -----------server by default
VTP Domain Name                 :
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0x7D 0x5A 0xA6 0x0E 0x9A 0x72 0xA0 0x3A
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)

-----------------------
Switch(config)#vtp domain name.com
Changing VTP domain name from NULL to name.com
Switch(config)#int fa0/1
Switch(config-if)#switch mode trunk

-----------------------

Switch(vlan)#vlan 2 name IT
VLAN 2 added:
    Name: IT
Switch(vlan)#vlan 3 name Admin
VLAN 3 added:
    Name: Admin

Switch(config)#int range fa0/2-24
Switch(config-if-range)#switchport access vlan 2

----------------------
configration on switch 2

Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console
sh vtp status
VTP Version                     : 2
Configuration Revision          : 2
Maximum VLANs supported locally : 255
Number of existing VLANs        : 7
VTP Operating Mode              : Client
VTP Domain Name                 : name.com
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0xD1 0x16 0x9D 0xC8 0x21 0xC2 0xC5 0x71
Configuration last modified by 0.0.0.0 at 3-1-93 00:12:31
Switch#sh vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gig0/1
                                                Gig0/2
2    IT                               active    
3    Admin                            active    
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup


--------------------
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int range fa0/2-10
Switch(config-if-range)#switchport access vlan 2
Switch(config-if-range)#int range fa0/11-20
Switch(config-if-range)#switchport access vlan 3
Switch(config-if-range)#^Z

-------------------------

Done, Try to ping.....


 VLAN...

VLAN = Virtual Local Area NETWORK
It's a logical function between switches through which you devide a large broadcast domain into small domain.
There are two types of VLAN:
1. Static VLAN
2. Dynamic VLAN



1. Static VLAN:






switch> en
switch# sh vlan ---------to show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gig0/1, Gig0/2
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

Creating VLAN..........

Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 2 name IT
VLAN 2 added:
    Name: IT
Switch(vlan)#vlan 3 name Admin
VLAN 3 added:
    Name: Admin
Switch(vlan)#vlan 4 name Sales
VLAN 4 added:
    Name: Sales


Assigning Port.......

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int range fa0/1-3
Switch(config-if-range)#switchport access vlan 2
Switch(config-if-range)#int range fa0/4-6
Switch(config-if-range)#switchport access vlan 3
Switch(config-if-range)#int range fa0/7-9
Switch(config-if-range)#switchport access vlan 4
Switch(config-if-range)#^Z

Switch#sh vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gig0/1
                                                Gig0/2
2    IT                               active    Fa0/1, Fa0/2, Fa0/3
3    Admin                            active    Fa0/4, Fa0/5, Fa0/6
4    Sales                            active    Fa0/7, Fa0/8, Fa0/9
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

Your VLAN is ready, now try to ping in another vlan...


Removing Port........

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int range fa0/1-24
Switch(config-if-range)#switchport access vlan 1
Switch(config-if-range)#^Z

Removing VLAN.........

Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#no vlan 2
Deleting VLAN 2...
Switch(vlan)#no vlan 3
Deleting VLAN 3...
Switch(vlan)#no vlan 4
Deleting VLAN 4...


 MySQL...


show databases;
create database [db_name];
use [db_name];
drop database [db_name];


create table [table_name] (col1,col2,col3....col)
ex: create table tb1 (id int(11) primary key, name varchar(20) not null, city varchar(15);

show tables;
desc [table_name];
drop table [table_name];

alter table [table_name] rename to [new_table_name];
truncate table [table_name];

insert into [table_name] (id,name,city) values(1,'aks','delhi');
insert into [table_name] values (1,'aks','delhi');

select * from [table_name];

alter table [table_name] add [column_name];
update [table_name] set [column_name] = [value] where id = [value];

delete from [table_name] where id=1; #delete row

--------------
select * from [table_name] where [column_name = -----];
select e_name, city,salary from [table_name] where [column_name = -----];
select e_name as 'USERNAME', city as 'CITYNAME' from [table_name];
select distinct([column_name]) from [table_name];---------different values
-----------
select * from [table_name] where [column_name = --] and [column_name = --];
select * from [table_name] where [column_name >= --] and [column_name <= --];
select * from [table_name] where [column_name] between -----;
-----------
select * from [table_name] where [column_name = --] or [column_name = --];
select * from [table_name] where [column_name] in ([]);
------------
select * from [table_name] limit [value];----show from top
select * from [table_name] limit [value] offset [value];
------------
select * from [table_name] order by [column_name] desc;
select * from [table_name] order by [column_name] desc limit 2;
-------------
LIKE
% = 0,1 or multiple charecter
_ = single charecter
select * from [table_name] where [column_name] like 'a%';
select * from [table_name] where [column_name] like '_a%';
select * from [table_name] where [column_name] like '%a_';
------------
FUNC =SUM, AVG, MIN, MAX
select SUM([column_name]) from [table_name];
select SUM([column_name]) as 'ALIAS' from [table_name];

select [value] from [table] where column = (select MIN([column]) from [table];
------------
Foreign key is used to interconnet table.

create table [table] (col1, col2, col3, foreign key(col) references [table](col);



 Cockpit in RHEL 8...


#!/bin/bash

yum install cockpit

#start cockpit
systemctl start --now cockpit.socket
systemctl enable --now cockpit.socket

#set firewall for cockpit
firewall-cmd --add-service=cockpit
firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload

echo "Congrates, You have successfully started cockpit."
echo "Go to Browser, Enter your IP:9090 in url, Enjoy"



 NFS Server Configuration...


#!/bin/bash

yum install nfs-utils -y
systemctl start nfs-server.service

echo "share the location where you want to put your sharing folder"
read loc
cd $loc

echo "please suggest me 3 different names to make dir for nfs sharing"
echo "where your 1st dir is for everyone"
echo "2nd dir is for network having 'rw' permissions"
echo "and 3rd dir is for perticuler IP having 'ro' permission"

read name1 name2 name3
mkdir $name1 $name2 $name3
chmod 777 $name1 $name2 $name3
echo "please provide your client network ip"
read netip
echo "please provide your client ip"
read ipaddr
cat >/etc/exports <<EOF
/$name1 *(rw,sync)
/$name2 $netip(rw,async)
/$name3 $ipaddr(ro,async)
EOF
systemctl restart nfs-server.service
firewall-cmd --add-service={nfs,rpc-bind,mountd,nfs3} --permanent
firewall-cmd --reload


 FTP service in RHEL 8...


#!/bin/bash

echo "Your CD name: "
read CD
mount /dev/$CD /mnt
cd /mnt/AppStream/Packages
rpm -ivh vsftpd*
systemctl start vsftpd.service
systemctl enable vsftpd.service
echo Congrates, Your VSFTPD service is running now.




 YUM configuration...


#!/bin/bash

mkdir /var/ftp/pub/rhel8
cd /mnt
cp -rvf * /var/ftp/pub/rhel8

cat > /etc/yum.repos.d/yc.repo <<EOF
[AppStream]
name=AppStream
baseurl=file:///var/ftp/pub/rhel8/AppStream
enabled=1
gpgcheck=0

[BaseOS]
name=BaseOS
baseurl=file:///var/ftp/pub/rhel8/BaseOS
enabled=1
gpgcheck=0
EOF

yum clean all
yum update

echo "Congrates, Your yum server is ready!"