Wednesday, April 17, 2019

STP Interview Questions and Answers [CCNP]

https://www.metime.web.id


What is STP & Redundant Links?
Spanning Tree Protocol (STP) is a protocol which prevents layer 2 loops. STP enables switches to become aware of each other so that they can negotiate a Loop-Free path through network. In practical Scenario, Redundant links are created to avoid complete network failure in an event of failure of one link.

How STP works?
STP chooses a Reference point (Root Bridge) in the network and calculates all the redundant paths to that reference point. Than it picks one path by which to forward frames and blocks other redundant paths.

What are the different port states?
1. Disabled - A port in the disabled state does not participate in the STP.
2. Blocking - A blocked port does not forward frames. It only listens to BPDUs. The purpose of the blocking state is to prevent the use of looped paths.
3. Listening - A port in listening state prepares to forward data frames without populating the MAC address table. The port also sends and listens to BPDUs to make sure no loops occur on the network.
4. Learning - A port in learning state populates the MAC address table but doesn’t forward data frames. The port still sends and receives BPDUs as before.
5. Forwarding - The port now can send and receive data frames, collect MAC addresses in its address table, send and receive BPDUs. The port is now a fully functioning switch port within the spanning-tree topology.

What is the default time a port takes to transition from the blocking state to the forwarding state?
The default time a port takes to transition from the blocking state to the forwarding state is 50 seconds: 20 seconds for Max Age,15 seconds for listening, and 15 seconds for learning.

What are STP Timers and Explain different types of STP Timers?
STP uses three timers to make sure that a network converges properly before a bridging loop can form.
1. Hello - The time interval between Configuration BPDUs sent by the root bridge. It is 2 seconds by default.
2. Forward Delay - The time interval that a switch port spends in both the Listening and Learning states. The default value is 15 seconds.
3. Max Age - Maximum length of time, a BPDU can be stored without receiving an update. It can also be define as a time interval that a switch stores a BPDU before discarding it. It is 20 seconds by default.

Explain types of STP Port Roles?
1. Root port - The root port is always the link directly connected to the root bridge, or the shortest path to the root bridge. It is always on Non-Root Bridge.
2. Designated port - A designated port is one that has been determined as having the best (lowest) cost. A designated port will be marked as a forwarding port. It can be on both Root Bridge & Non Root Bridge. All ports of Root Bridge are Designated Port.
3. Forwarding port - A forwarding port forwards frames.
4. Blocked port - A blocked port is the port that is used to prevent loops. It only listens to frames. Any port other than Root port & Designated port is Block Port.

What is the STP blocking state?
When a switch starts, all ports are in the blocking state to prevent any loop in the network. If there is a better path to the root bridge, the port remains in the blocked state. Ports in the blocked state cannot send or receive traffic, but they can receive BPDUs.

What is BPDU?
All the switches exchange information to select Root Bridge as well as for configuration of the network. This is done through Bridge Protocol Data Unit (BPDU). Each switch compares the parameters in the BPDU that it sends to one neighbor with the one that it receives from another neighbor.

How often do Bridges send BPDUs on active ports?
The default time that bridges send BPDUs is 2 seconds.

What does STP do when it detects a topology change in the network due to a bridge or link failure?
 If spanning tree detects a change in the network due to a bridge or link failure, it send out TCN[topology change message] BPDU and at least one bridge interface changes from the blocking state to the forwarding state, or vice versa.

What is the Max Age timer?
The Max Age timer is how long a bridge stores a BPDU before discarding it. The default time is 20 seconds (ten missed hello intervals).

What is STP forward delay?The forward delay is the time it takes for a port to move from the listening state to the learning state or from the learning state to the forwarding state. The default time is 30 seconds.

What is the destination MAC address used by Bridge Protocol Data Units (BPDUs)?
Bridge Protocol Data Units (BPDUs) frames are sent out as at multicast destination MAC address 01:80:c2:00:00:00.

What are Types of BPDU?
Two types of BPDU exist -
1. Configuration BPDU - Used for Spanning-Tree Computation.
2. Topology Change Notification (TCN) BPDU - Used to announce changes in the Network Topology.

How Root bridge is elected?
The Bridge ID is used to elect the root bridge in the STP domain. This ID is 8 bytes long and includes both the priority and the MAC address of the device. Switch with the lowest Bridge ID is elected as the Root bridge which means Switch with the lowest priority will become Root Bridge if two or more switches have same priority than switch with lowest mac address will become Root Bridge.

Explain Root path cost?
Root path cost is the Cumulative Cost of all links to the Root Bridge.

How Root Ports are elected?
Non Root Bridges use Root path cost to determine which port will be the Root port. The port with the lowest root path cost is elected as the root port and is placed in the forwarding state.

What is the difference between Path cost and Root Path cost?
Path cost is the value assigned to each port. It is added to BPDUs received on that port to calculate the root path cost. Root path cost is defined as the cumulative cost to reach the root bridge. This value is calculated by adding the receiving port's path cost to the value contained in the BPDU. In a BPDU, Root path cost is transmitted not the path cost.

What is Path Cost or Spanning Tree Path Cost value?
The Spanning Tree Cost Value is inversely proportional to the associated bandwidth of the link and therefore a path with a low cost value is more preferable than a path with high cost value.
Link Bandwidth               Cost Value
10 Gbps                                   2
1 Gbps                                     4
100 Mbps                                19
10 Mbps                                 100

What is Root Port?
Once the Root Switch is elected, every other Switch in the network must select a single port on itself to reach the Root Switch. The single selected port on a Switch with least Path Cost to reach the Root Bridge is called the Root Port. Root Bridge will never have a Root Port.

What is Extended System ID?
The Extended System ID is utilized by spanning-tree to include the VLAN ID information inside 16-bit STP Bridge Priority value. Extended System ID is the least significant 12-bits in 16-bit STP Bridge Priority value.

Explain Root Guard ?
Root guard is used to protect root bridge. Root Guard stops a new switch introduced in the network with a lower bridge ID to become the root bridge. If a port with Root Guard feature enabled receives a superior BPDU, it moves the port into a root-inconsistent state (equal to a listening state) thus maintaining the current Root Bridge status. It is enabled on interface level.
switch(config-if)# spanning-tree guard root

What is BPDU Guard ?
When we enable portfast on a port , we do not expect BPDU's on that port. Suppose a switch is connected by mistake on the port where portfast is enabled, loop can form. An even greater consequence is that connected switch has potential to become root bridge. The BPDU Guard feature was developed to protect the integrity of switch ports that have PortFast enabled. If any BPDU (superior to the current root or not) is received on a port where BPDU Guard is enabled, that port immediately is put into the error-disable state. The port is shut down in an error condition and must be either manually re-enabled or automatically recovered through the error-disable timeout function.
BPDU Guard can be enabled on both interface & global level. It is basically enabled on access layer switches. In this all vlans are effected.

Switch(config)# spanning-tree portfast bpduguard default
Switch(config-if)# spanning-tree bpduguard enable

Explain Sudden Loss of BPDUs?
Suppose switch does not receive BPDUs, it will think that the topology must have changed, so blocked ports can be unblocked again. What if the absence of BPDUs is actually a mistake and not a topology change, bridging loops easily can form.
There are two features that help detect or prevent the unexpected loss of BPDUs:-
1. Loop Guard
2. Unidirectional Link Detection (UDLD)

What is Loop Guard?
Loop Guard keeps track of the BPDU activity on non-designated ports. It does not allow non-designated ports to become designated ports in case of sudden loss of BPDUs. While BPDUs are received, the port is allowed to behave normally. When BPDUs go missing, Loop Guard moves the port into the loop-inconsistent state (port is effectively blocking at this point to prevent a loop from forming and to keep it in the non-designated role). When BPDUs are received on the port again, Loop Guard allows the port to move through the normal STP states and become active.
It can be enabled on both interface & global level. It affects per vlan basis.
Switch(config)# spanning-tree loopguard default
Switch(config-if)# spanning-tree guard loop

What is BPDU Filter?
STP runs on a switch to prevent loops. However, in special cases when we need to prevent BPDUs from being sent or processed on one or more switch ports, we can use BPDU filtering to effectively disable STP on those ports. It prevents port from sending and receiving BPDUs. It can be enabled on both interface & global level.

Switch(config)# spanning-tree portfast bpdufilter default
Switch(config-if)# spanning-tree bpdufilter { enable | disable }

What is the difference between BPDU Guard and BPDU Filter?
BPDU Guard works aggresively and puts the port in error-disable state while BPDU filter does not shut the port, it only filters BPDU. BPDU Guard only prevents receiving BPDUs while BPDU filter prevents both sending and receiving BPDU.


If Both BPDU Guard and BPDU Filter is enabled on a port than only BPDU filter will work.

Related topics-

General Network Challenges (Unicast flooding ) [ CCNP]
Read More

General Network Challenges (Unicast flooding ) [ CCNP]

https://www.metime.web.id


                                               Unicast flooding

It refers to the unintentional behavior of a switch treating a unicast packet as a broadcast packet; The cause of flooding is that the destination MAC address of the packet is not in the L2 forwarding table of the switch. Normally occurs when the router needs to deliver a packet; it has an ARP entry for a destination host, but the switch has no CAM entry.   The result is a packet that needs to be flooded to all of the ports in the VLAN In order to locate that MAC address port/VLAN.

Common reasons for destination MAC address not being known to the switch:

Cause 1: Asymmetric Routing.

With asymmetric routing, transmit and receive packets follow different paths between a host and the peer with which it communicates, at some point in the packet delivery path a Switch may not have that MAC address destination on its CAM table and would need to flood the frame in order to discover which port/MAC address is.

Cause 2: Spanning-Tree Protocol Topology Changes.

Since TCNs are triggered by a port that is transitioning to or from the forwarding state we may remember that what TCN does is to age out the CAM table in order to relearn the Active MAC address,
A final cause of unicast floods are topology changes. When a link state changes on a network port which participates in rapid spanning tree, the address cache on that switch will be flushed causing all subsequent packets to be flooded out of all ports until the addresses are learned by the switch.

Cause 3: Forwarding Table Overflow.

Another possible cause of flooding can be overflow of the switch forwarding table. In this case, new addresses cannot be learned and packets destined to such addresses are flooded until some space becomes available in the forwarding table. New addresses will then be learned. This is possible but rare,
A switch that has no room left in its address cache will flood the packet out to all ports. This is a common problem on networks with many hosts. Less common is the artificial flooding of address tables—this is termed MAC flooding.

Another common cause are hosts with ARP timers longer than the address cache timeout on switches—the switch forgets which port connects to the host.

Remedies -

There are several remedies discussed in the links above.  But for many situations, a low end switch needs to be replaced with a higher end switch—one that has a larger address table and one that can block unicast floods. Blocking unicast floods on a Cisco switch is easy to do, but it is not enabled by default. After ensuring that timeouts and/or security features have been configured to maintain table entries on client access ports longer than typical host ARP cache timeouts, this command is used to quiet down the unicast floods on those ports

By default unknown unicast traffic is flooded to all Layer 2 ports in a Vlan. We can use UUFB and UMFB, features to prevent or limit this traffic.

The UUFB [unknown unicast flooding blocking] and UMFB [unknown multicast flooding blocking ] features block unknown unicast and multicast traffic flooding at a specific port, only permitting egress traffic with MAC addresses that are known to exist on the port. The UUFB and UMFB features are supported on all ports that are configured with the switchport command, including private VLAN (PVLAN) ports.

Router(config-if)# switchport    --> Configures the port for Layer 2 switching.
Router(config-if)# switchport block {unicast | multicast} -->Enables unknown unicast or multicast flood blocking on the port.



Note: Enter the switchport block multicast command only on ports where all unknown multicast flooded traffic needs to be completely blocked. UMFB disrupts protocols that make use of local subnetwork multicast control groups in the 224.0.0.0/24 range, for example:

•ARP
•IPv6 neighbor discovery (IPv6 ND)
•Network Time Protocol (NTP)

Do not enter this command on nonreceiver (router) ports or host ports that rely on dynamic ARP. Use IGMP snooping or other rate-limiting options to restrict, rather than completely block, unknown multicast flooded traffic.

Other techniques involve isolating hosts at Layer 2, which blocks intra-LAN communication not destined to the router. A handy tool (available in lower end switches ) is the

Switch(config-if)# switchport protected

or a more robust, cross-switch solution than 'switchport protected' is the use of Private VLANs.


Related topics-

Read More

Monday, April 15, 2019

Describe IP operations [ ICMP Unreachable and Redirects ] CCNP

https://www.metime.web.id/

The Internet Control Message Protocol (ICMP) is a supporting protocol in the Internet protocol suite. It is used by network devices, like routers, to send error messages and operational information.

 

ICMP TYPE NUMBERS

 The Internet Control Message Protocol (ICMP) has many messages that are identified by a "type" field.

Type      Name                                                                    Reference
----         -------------------------                      ---------
  0            Echo Reply                                                          [RFC792]
  1            Unassigned                                                            [JBP]
  2            Unassigned                                                            [JBP]
  3            Destination Unreachable                                       [RFC792]
  4            Source Quench                                                     [RFC792]
  5            Redirect                                                                 [RFC792]
  6            Alternate Host Address                                         [JBP]
  7            Unassigned                                                            [JBP]
  8            Echo                                                                [RFC792]
  9            Router Advertisement                                    [RFC1256]
 10          Router Selection                                              [RFC1256]
 11          Time Exceeded                                                [RFC792]
 12          Parameter Problem                                          [RFC792]
 13          Timestamp                                                       [RFC792]
 14          Timestamp Reply                                             [RFC792]
 15          Information Request                                         [RFC792]
 16          Information Reply                                             [RFC792]
 17          Address Mask Request                                    [RFC950]
 18          Address Mask Reply                                         [RFC950]
 19          Reserved (for Security)                                      [Solo]
 20-29    Reserved (for Robustness Experiment)             [ZSu]
 30          Traceroute                                     [RFC1393]
 31          Datagram Conversion Error            [RFC1475]
 32     Mobile Host Redirect                       [David Johnson]
 33     IPv6 Where-Are-You                        [Bill Simpson]
 34     IPv6 I-Am-Here                                [Bill Simpson]
 35     Mobile Registration Request            [Bill Simpson]
 36     Mobile Registration Reply                [Bill Simpson]
 37     Domain Name Request                       [Simpson]
 38     Domain Name Reply                           [Simpson]
 39     SKIP                                                    [Markson]
 40     Photuris                                               [Simpson]
 41-255 Reserved                                           [JBP]



ICMP type 3, Destination unreachable message:


The ICMP destination unreachable message is generated by a router to inform the source host that the destination unicast address is unreachable.

The IP header plus the first 8 bytes of the original datagram’s data is returned to the sender. This data is used by the host to match the message to the appropriate process. If a higher level protocol uses port numbers, they are assumed to be in the first 64 data bits of the original datagram’s data.

If the Cisco IOS receives a nonbroadcast packet destined for itself that uses an unknown protocol, it sends an ICMP protocol unreachable message back to the source. If the software receives a packet that it is unable to deliver to the ultimate destination because it knows of no route to the destination address, it sends an ICMP host unreachable message to the source. (enabled by default).

3     Destination Unreachable         [RFC792]


        Codes
            0  Net Unreachable
            1  Host Unreachable
            2  Protocol Unreachable
            3  Port Unreachable
            4  Fragmentation Needed and Don't Fragment was Set
            5  Source Route Failed
            6  Destination Network Unknown
            7  Destination Host Unknown
            8  Source Host Isolated
            9  Communication with Destination Network is  Administratively Prohibited
           10  Communication with Destination Host is  Administratively Prohibited
           11  Destination Network Unreachable for Type of Service
           12  Destination Host Unreachable for Type of Service
           13  Communication Administratively Prohibited         [RFC1812]
           14  Host Precedence Violation                                      [RFC1812]
           15  Precedence cutoff in effect                                     [RFC1812]

Explaination -

1.       Network unreachable- it has a code value of 0. In this the datagram cannot be delivered to the network that is specified in the network ID portion of the IP address. This means that there was a problem with the routing and was caused by a bad address.
2.       The second is the host unreachable. This has a value code of 1. In this the datagram was delivered to the network that is specified but it could not be sent to the host who was mentioned in the address. This also implies a routing issue.
3.       The protocol unreachable is the next. The value code of this is 2. In this the destination port that was specified as UDP or TCP header was not valid.
4.       Fragmentation needed and DP set - the MTU is always smaller than the packet size. The router is not allowed to fragment the packet. This message is very often used in a very clever way. This is done by intentionally sending messages of increasing size to understand the maximum transmission size that the link can take. This process is also called the MTU path discovery.
5.       Source route failed - this is generated if the source route was specified for the datagram in the option but the router could not forward the datagram to the next step in the route.
6.       Destination network unknown - this is not used any more.
7.       Destination unknown host - in this the host that is specified is not known. This is generated by a router call made to the destination host. This usually means a bad address.
8.       Source host isolated - this is again not used anymore.
9.       Communication with the destination network is prohibited administratively -in this the source device will not be allowed to send the network where the destination device is located.
10.   Communication with the destination host is administratively prohibited - in this the source device is allowed to send network where the destination device is located but not to the particular device.
11.   Destination network is unreachable for the type of service - in this the network that is specified in the IP address cannot be reached due to the inability to provide the service that is clearly specified in the "type of service" field of the datagram header.
12.   Destination not reachable for the type of service - in this the destination host that is specified in the IP address cannot be reached due to the inability to provide the "type of service" mentioned in the datagram header.
13.   Communication administratively prohibited - in this the datagram cannot be forwarded as the filtering blocks the message based on the contents.
14.   Host precedence violation - this is sent by the first hop router when the precedence value in the "type of service field" is one that cannot be permitted.
15Precedence cutoff in effect - this is sent by the datagram that is in the receiving end. The precedence value         should be lower than the minimum allowed for the network at that time.

ICMP type 5, Redirects  message:

This mechanism is used by the host to notify that a better next hop is available to exit from the network. The CISCO routers will send the ICMP redirect message when the following conditions are met:

   5     Redirect    [RFC792]


        Codes
            0           Redirect Datagram for the Network (or subnet)
            1           Redirect Datagram for the Host
            2           Redirect Datagram for the Type of Service and Network

            3          Redirect Datagram for the Type of Service and Host


Explaination –

  1. The subnet or the network of the source IP address is same as that of the subnet or network of the next hop IP address.
  2. The interface where the packet comes into the router are same as the interface on which the packets are routed out.
  3. The datagram is not source routed.
  4. The kernel is such that it is configured to send redirects.






Read More

General Network Challenges [ micro-burst ] CCNP.

https://www.metime.web.id/

A micro-burst occurs when a specific amount of data (in bytes) is exceeded in a given time interval.

Micro-Burst Monitoring Overview
The micro-burst monitoring feature allows you to monitor traffic on a per-port basis for both ingress and
egress ports and to detect unexpected data bursts within a very small time window (micro-seconds). This allows you to detect flows in the network that are at risk of data loss, and that may require extra bandwidth. The micro-burst monitoring feature allows you to specify these limits as absolute values (for data and burst size) or as a percentage of the link speed. When these thresholds are exceeded the system generates a Syslog alarm message.

How to Use Micro-Burst Monitoring
The micro-burst monitoring feature monitors bursts in real time. The monitoring process also provides an overview of data path issues, and is helpful in identifying potential capacity issues in a network. Syslog
messages are generated with the burst exceeds the configured value.

Micro-burst monitoring provides real-time burst information that is used to:
• monitor network micro bursts
• trigger to congestion detection and latency processes

knowing your micro-burst is key to a smoothly functioning network environment. if that's for ultra low latency or high throughput enterprise networks having the right tools to understand your network flow is critical.


Configuration Example for Micro-Burst Monitoring The following example shows how to configure micro-burst monitoring on an Ethernet interface:

switch# configure terminal
switch(config)# interface ethernet 1/1
switch(config-if)# burst threshold egress limit 50 interval 30
switch(config-if)# burst threshold ingress size 500000 interval 16000
switch(config-if)# burst maximum egress burst-count 50000
switch(config-if)# burst maximum ingress burst-count 600000
switch(config-if)# exit
switch(config)#exit
switch# copy running-config startup-config




Related topics-



Read More

How to upgrade software on a Cisco 3850 Switch | Recover Password | Configuration Backup | Restore Configuration

https://www.metime.web.id/
This short post will show you how to upgrade the software on a single Cisco 3850 switch or a 3850 stack, using TFTP and USB.

The process is very easy but it is a bit different than the usual software image of previous switches i.e 3750 etc.

The main difference is the Cisco 3850 switch run IOS-XE so you have to copy the .bin file to the flash on the switch and then install the software on the switch.

Download the required image from cisco.com
Begin the install
Reboot the switch

Step 1 copy the new image to the 3850
https://www.metime.web.id/

3850-SW1#copy tftp flash
Address or name of remote host []? 10.1.1.100
Source filename []? cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EZ1.bin
Destination filename [cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EZ1.bin]?
Accessing tftp://10.1.1.250/cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EZ1.bin…
Loading cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EZ1.bin from 10.251.226.253 (via Port-channel1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Once the file has been copied verify the new IOS is present in flash

3850-SW1#dir flash:

Directory of flash:/

46472  -rwx     2097152  Sep 22 2013 10:23:20 +00:00  nvram_config
46468  -rwx     1689445  Aug 22 2013 20:48:35 +00:00  asic_dump_reg-1.csv
46467  -rwx     1689445  Aug 22 2013 21:17:05 +00:00  asic_dump_reg-0.csv
46469  -rwx         114  Sep 13 2013 06:08:19 +00:00  express_setup.debug
46466  -rw-   223737704  Feb 12 12:01:30 +00:00  cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EX3.bin
38721  drwx        4096  Sep 22 2013 10:14:12 +00:00  mnt
77443  -rwx        1224  Sep 22 2013 10:13:17 +00:00  packages.conf
46470  -rwx         736  Sep 20 2013 18:34:18 +00:00  vlan.dat
69699  -rwx    74369252  Sep 22 2013 10:13:12 +00:00  cat3k_caa-base.SPA.03.02.02.SE.pkg
69700  -rwx     5808828  Sep 22 2013 10:13:12 +00:00  cat3k_caa-drivers.SPA.03.02.02.SE.pkg
69701  -rwx    32488292  Sep 22 2013 10:13:12 +00:00  cat3k_caa-infra.SPA.03.02.02.SE.pkg
69702  -rwx    30403764  Sep 22 2013 10:13:12 +00:00  cat3k_caa-iosd-universalk9.SPA.150-1.EX2.pkg
69703  -rwx    16079584  Sep 22 2013 10:13:12 +00:00  cat3k_caa-platform.SPA.03.02.02.SE.pkg
69704  -rwx    64580300  Sep 22 2013 10:13:13 +00:00  cat3k_caa-wcm.SPA.10.0.111.0.pkg

1621966848 bytes total (1123991552 bytes free)

Step 1a copy the software to the 3850 using USB

The image for the 3850 is very big 250Mb+ so copying via TFTP can take a while, a much better solution is to use a USB stick.

The process is very simple and much easier than using tftp. All you need is a USB stick that is recognised by the switch and a console connection.

I use a Kingston 16GB stick – http://www.amazon.co.uk/Kingston-Drive-Premium-Metal-Casing/dp/B005SP91UW

Copy the image file into the root of drive and insert the USB drive into the USB slot on the front of the 3850.

From the Command line verify that the switch can recognise the file system.

dir usbflash0:

This should list all the files on your USB

You now need to copy the image from the USB to the Flash of the switch.

copy usbflash0:cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EX3.bin flash:

Now proceed to the software install in Step 2

Step 2 start the install

3850-SW1#software install file flash:cat3k_caa-universalk9.SPA.03.03.01.SE.150-1.EX3.bin switch 1-2

Please note the switch 1-2 command at the end will install the image onto switch 1 and 2 in your stack, so if you are running a stack of 8 switches you need to enter switch 1-8

This step will unpack the .bin file and install the software, after the software has installed you will be promted to reboot, the switch will reload and you can then verify you are running the new IOS

3850-SW1#sh ver | i INSTALL
*    1 32    WS-C3850-24T       03.03.01SE        cat3k_caa-universalk9 INSTALL


2 32    WS-C3850-24T       03.03.01SE        cat3k_caa-universalk9 INSTALL


Configuration BACKUP

Router#copy running-config    tftp:
Address or name of remote host []? 192.168.10.1
Destination filename [Router-confg]?   [press enter]
!!
1030 bytes copied in 2.489 secs (395 bytes/sec)
Router#

Restore configuration
Router#copy tftp: running-config
Address or name of remote host []? 192.168.10.1
Source filename []? Backupfile name
Destination filename [running-config]?  [press enter]
Accessing tftp://192.168.10.1/backupfile name...
Loading backup_cfg_for_router from 192.168.10.1 (via FastEthernet0/0): !
[OK - 1030 bytes]
 
1030 bytes copied in 9.612 secs (107 bytes/sec)
Router#
 
Password recovery—
 
Reload router and Press Ctrl+ Break Key When Router Starts to interrupt booting process..
 
Rommon>confreg 0X2142
 
[by this Register value you will bypass startup-configuration]
 
Rommon>Reset
 
Router >enable
Router #copy    running-config     startup-config


Read More

Friday, April 12, 2019

Membuat Stopwatch dengan JavaScript di Laravel

Kali ini kita akan mencoba membuat stopwatch dengan javascript yang mana akan kita gunakan untuk mencatat waktu tertentu.



Membuat Stopwatch dengan JavaScript di Laravel

Skrip yang disajikan dalam halaman ini adalah kronometer / stopwatch sederhana , dengan opsi Mulai, Berhenti, dan Atur Ulang. Ini menampilkan sepersepuluh detik, detik, dan menit, dan dapat diatur untuk berhenti dan menjalankan fungsi ketika waktu kronometer mencapai nilai tertentu.
- Untuk lebih jelasnya, lihat instruksi di bawah, dan komentar dalam kode.

Untuk menguji skrip ini, klik tombol Mulai. Dalam contoh ini, kronometer diatur untuk berhenti secara otomatis dan menampilkan jendela peringatan setelah 3 detik dan 8/10 detik.

- Fungsi startChr () memulai kronometer.
- Untuk menghentikan stopwatch, panggil fungsi stopChr () .
- Untuk mengatur ulang kronometer, panggil fungsi resetChr () .

<div id="showtm" style="font-size:21px; font-weight:800;">0:0</div>
<button onclick="stopChr()">Stop</button>
<button onclick="resetChr()">Reset</button>

Script nya....
<script type="text/javascript"><!--
// chronometer / stopwatch JS script - coursesweb.net

// Here set the minutes, seconds, and tenths-of-second when you want the chronometer to stop
// If all these values are set to 0, the chronometer not stop automatically
var stmints = 0;
var stseconds = 0;
var stzecsec = 0;

// function to be executed when the chronometer stops
function toAutoStop() {
  alert('Your life goes on');
}

// the initial tenths-of-second, seconds, and minutes
var zecsec = 0;
var seconds = 0;
var mints = 0;

var startchron = 0;

function chronometer() {
  if(startchron == 1) {
    zecsec += 1;       // set tenths of a second

    // set seconds
    if(zecsec > 9) {
      zecsec = 0;
      seconds += 1;
    }

    // set minutes
    if(seconds > 59) {
      seconds = 0;
      mints += 1;
    }

    // adds data in #showtm
    document.getElementById('showtm').innerHTML = mints+ ' : '+ seconds+ '<sub>'+ zecsec+ '</sub>';

    // if the chronometer reaches to the values for stop, calls whenChrStop(), else, auto-calls chronometer()
    if(zecsec == stzecsec && seconds == stseconds && mints == stmints) toAutoStop();
    else setTimeout("chronometer()", 100);
  }
}

function startChr() { startchron = 1; chronometer(); }      // starts the chronometer
function stopChr() { startchron = 0; }                      // stops the chronometer
function resetChr() {
  zecsec = 0;  seconds = 0; mints = 0; startchron = 0;
  document.getElementById('showtm').innerHTML = mints+ ' : '+ seconds+ '<sub>'+ zecsec+ '</sub>';
}

// start the chronometer, delete this line if you want to not automatically start the stopwatch
startChr();
--></script>
Read More