Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Cisco ASA in GNS3

January 23, 2017
Here is another tutorial running Cisco ASAv on GNS3 using Qemu.

For Configure GNS3

In My case I have used ASAv952-204.qcow2

Go to the GNS3>Edit>Preferences>QEMU>Qemu VMs>New
Follow on screen procedure. 

Don't forget to enable kvm and memory allocation. 



Now you can see I can run ASAv 9.5.2

Blank Password.



IOS XR GNS3 QEMU

December 05, 2016
This time lets have tutorial on Cisco XR 9k series router image running on the GNS3. Please don't ask for the XR image. Your are smart enough to get it.

My system configuration:

Ubuntu 16.04
GNS3 1.4
RAM 8Gig
i7 processor

Used XR Image
iosxrv-k9-demo-6.0.1.qcow2

This image is VIRL extracted image.

You need to convert this image into QEMU image, follow this link

I strongly recommend you to run it on the Linux system.

Now you have converted image, then go to the GNS3>Edit>Preferences>QEMU>Qemu VMs>New
then follow the onscreen procedure.

Setting for QEMU XR Image.

RAM:- 4Gig
CPU:- 1


Adapters at lest 4. 


-enable-kvm




Here you can see I can run the XR on my system. Interface is up and system is already booted. 



I have run 3 XR router  here is my system RAM CPU usages.



RP/0/0/CPU0:XR3(config)#int gi0/0/0/0
RP/0/0/CPU0:XR3(config-if)#ip add 192.168.13.2 255.255.255.252
RP/0/0/CPU0:XR3(config-if)#commit
RP/0/0/CPU0:XR3#ping 192.168.13.1
Mon Dec  5 14:28:29.088 UTC
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.13.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/19 ms


Note: Assign IP on gi0/0/0/0 interface but connect on e1 to e/1 on your router otherwise it will not ping. 

Enjoy. 




Unit vpnagentd service not loaded.

December 01, 2016
Somebody ask me to run Cisco EPIC VPN lab test provide by the Cisco. I just try it done but Anyconnect client doesn't seems to work on ubuntu system. The error message was


How to resolved the issue?? 

First of all install the following packages.

sudo apt-get install lib32z1 lib32ncurses5

Then try to install the AnyConnect client, if its still show the same error message. Used below command....

sudo apt-get install network-manager-openconnect

Reload the changes using this command....

sudo systemctl daemon-reload

Now AnyConnect should be installed. 




Perl Can't Locate in @inc

September 04, 2016
Recently I try to install  SmokePing (tar ball) on Centos 7, for my company to check Network latency, but  same error re-occur.

Multiple Errors:

Then I search a lot, try to install the packages but the problem still appear, then after I found  a simple solution.



Solution:

# perl -MCPAN -eshell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.

cpan[1]> install Net::OpenSSH
Reading '/root/.cpan/Metadata'
  Database was generated on Sat, 03 Sep 2016 21:53:30 GMT
Running install for module 'Net::OpenSSH'
Running make for S/SA/SALVA/Net-OpenSSH-0.73.tar.gz
Fetching with LWP:
http://cpan.communilink.net/authors/id/S/SA/SALVA/Net-OpenSSH-0.73.tar.gz
Fetching with LWP:
http://cpan.communilink.net/authors/id/S/SA/SALVA/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/S/SA/SALVA/Net-OpenSSH-0.73.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE

  CPAN.pm: Building S/SA/SALVA/Net-OpenSSH-0.73.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Net::OpenSSH
Could not read metadata file. Falling back to other methods to determine prerequisites
cp lib/Net/OpenSSH/ConnectionCache.pm blib/lib/Net/OpenSSH/ConnectionCache.pm
cp lib/Net/OpenSSH/ShellQuoter/fish.pm blib/lib/Net/OpenSSH/ShellQuoter/fish.pm
cp lib/Net/OpenSSH/ShellQuoter.pm blib/lib/Net/OpenSSH/ShellQuoter.pm
cp lib/Net/OpenSSH/ShellQuoter/POSIX.pm blib/lib/Net/OpenSSH/ShellQuoter/POSIX.pm
cp lib/Net/OpenSSH/ModuleLoader.pm blib/lib/Net/OpenSSH/ModuleLoader.pm
cp lib/Net/OpenSSH/ShellQuoter/Chain.pm blib/lib/Net/OpenSSH/ShellQuoter/Chain.pm
cp lib/Net/OpenSSH/SSH.pm blib/lib/Net/OpenSSH/SSH.pm
cp lib/Net/OpenSSH/Constants.pm blib/lib/Net/OpenSSH/Constants.pm
cp lib/Net/OpenSSH/ShellQuoter/MSWin.pm blib/lib/Net/OpenSSH/ShellQuoter/MSWin.pm
cp lib/Net/OpenSSH/OSTracer.pm blib/lib/Net/OpenSSH/OSTracer.pm
cp lib/Net/OpenSSH.pm blib/lib/Net/OpenSSH.pm
cp lib/Net/OpenSSH/ShellQuoter/MSCmd.pm blib/lib/Net/OpenSSH/ShellQuoter/MSCmd.pm
cp lib/Net/OpenSSH/ShellQuoter/csh.pm blib/lib/Net/OpenSSH/ShellQuoter/csh.pm
cp lib/Net/OpenSSH/ObjectRemote.pm blib/lib/Net/OpenSSH/ObjectRemote.pm
Manifying blib/man3/Net::OpenSSH::SSH.3pm
Manifying blib/man3/Net::OpenSSH::Constants.3pm
Manifying blib/man3/Net::OpenSSH::ShellQuoter::MSWin.3pm
Manifying blib/man3/Net::OpenSSH::ConnectionCache.3pm
Manifying blib/man3/Net::OpenSSH::ShellQuoter::MSCmd.3pm
Manifying blib/man3/Net::OpenSSH.3pm
Manifying blib/man3/Net::OpenSSH::OSTracer.3pm
  SALVA/Net-OpenSSH-0.73.tar.gz
  /usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/1_run.t .... #
# SSH client found: OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013.
# Trying to connect to localhost, timeout is 15s.
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
root@localhost's password:
t/1_run.t .... ok  
t/quoting.t .. # unable to exec csh -c echo good
# unable to exec tcsh -c echo good
# unable to exec ksh -c echo good
# unable to exec dash -c echo good
# unable to exec ash -c echo good
# unable to exec pdksh -c echo good
# unable to exec mksh -c echo good
# unable to exec zsh -c echo good
# unable to exec fish -c echo good
# running tests for shells sh bash
t/quoting.t .. ok    
t/uri.t ...... ok  
All tests successful.
Files=3, Tests=471, 16 wallclock secs ( 0.17 usr  0.01 sys +  1.63 cusr  1.06 csys =  2.87 CPU)
Result: PASS
  SALVA/Net-OpenSSH-0.73.tar.gz
  /usr/bin/make test -- OK
Running make install
Installing /usr/local/share/perl5/Net/OpenSSH.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ConnectionCache.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ModuleLoader.pm
Installing /usr/local/share/perl5/Net/OpenSSH/SSH.pm
Installing /usr/local/share/perl5/Net/OpenSSH/Constants.pm
Installing /usr/local/share/perl5/Net/OpenSSH/OSTracer.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ObjectRemote.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter/fish.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter/POSIX.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter/Chain.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter/MSWin.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter/MSCmd.pm
Installing /usr/local/share/perl5/Net/OpenSSH/ShellQuoter/csh.pm
Installing /usr/local/share/man/man3/Net::OpenSSH::SSH.3pm
Installing /usr/local/share/man/man3/Net::OpenSSH::Constants.3pm
Installing /usr/local/share/man/man3/Net::OpenSSH::ShellQuoter::MSWin.3pm
Installing /usr/local/share/man/man3/Net::OpenSSH::ConnectionCache.3pm
Installing /usr/local/share/man/man3/Net::OpenSSH::ShellQuoter::MSCmd.3pm
Installing /usr/local/share/man/man3/Net::OpenSSH.3pm
Installing /usr/local/share/man/man3/Net::OpenSSH::OSTracer.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
  SALVA/Net-OpenSSH-0.73.tar.gz
  /usr/bin/make install  -- OK

nslookup Command

March 21, 2016
A Network Administrator command  which help diagnosis DNS related issue. However to understand this,  you should better to know how DNS works.

How to troubleshoot DNS related issue.

1. NSLOOKUP example display "A Record" (IP Adress) of the domain




C:\Users\jpudasaini>nslookup jpudasaini.com.np 8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
Name:    jpudasaini.com.np
Address:  216.239.32.21

A Non-Authoritative Answer is a response from Cache. A DNS server is
authoritative for zones actually holds it.

The above output shows "A Records" (IP Adress) of the domain
"jpudasaini.com.np". Which is actually query to the public Google DNS. If
you don't put DNS after the domain, it will used your default DNS, in my
case I have used public DNS.

2. MX Record using -query=mx

MX (Mail Exchange) record maps for the specific domain name to verify mail
exchaing servers on that domain.


C:\Users\jpudasaini>nslookup -query=mx gmail.com 8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
gmail.com       MX preference = 40, mail exchanger =alt4.gmail-smtp-in.l.google
.com
gmail.com       MX preference = 20, mail exchanger =alt2.gmail-smtp-in.l.google
.com
gmail.com       MX preference = 10, mail exchanger =alt1.gmail-smtp-in.l.google
.com
gmail.com       MX preference = 30, mail exchanger =alt3.gmail-smtp-in.l.google
.com
gmail.com       MX preference = 5, mail exchanger =gmail-smtp-in.l.google.com

From the above example we can say that  4 MX records used for gmail
domain, the number associat with mx reference the preference of mail
server. Lower the number, higher the preference. So
gmail-smtp-in.l.google.com is the first server which received the mail at
first.

3. NS Record using -query=ns

NS (Name Server) records maps a domain to a list of DNS servers
authoritative for that domain. Here is example of name server which are
associated with jpudasaini.com.np doamain.

C:\Users\jpudasaini>nslookup -query=ns jpudasaini.com.np 8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
jpudasaini.com.np       nameserver = ns4.afraid.org
jpudasaini.com.np       nameserver = ns2.afraid.org
jpudasaini.com.np       nameserver = ns1.afraid.org

4. SOA Record using -query=soa

 C:\Users\jpudasaini>nslookup -query=soa jpudasaini.com.np 8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
jpudasaini.com.np
        primary name server = ns1.afraid.org
        responsible mail addr = dnsadmin.afraid.org
        serial  = 1511030001
        refresh = 86400 (1 day)
        retry   = 7200 (2 hours)
        expire  = 2419200 (28 days)
        default TTL = 3600 (1 hour)

SOA record (start of authority) which provides the authoritative
information, as well as e-mail address, serial no of the respective
domain.


5. Reserve DNS lookup

The reverse DNS look-up using IP Adress as argument to nslookup
C:\Users\jpudasaini>nslookup 216.239.32.21 8.8.8.8
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Name:    any-in-2015.1e100.net
Address:  216.239.32.21


6. Using Specific DNS Server

Make query using particular name server instead of using default DNS server.


C:\Users\jpudasaini>nslookup jpudasaini.com.np ns1.afraid.org
Server:  UnKnown
Address:  50.23.197.95

Name:    jpudasaini.com.np
Address:  216.239.32.21

EoMPLS Configuration

March 08, 2016
EoMPLS is point to point L2 VPN services which is used to transport all Ethernet frame received on particular Ethernet or VLAN,  its also called Any Transport over MPLS(ATOM) means this technology can connect like Frame-Relay, PPP, Ethernet,ATM etc.

IOS used
c7200-adventerprisek9-mz.151-4.M

Logical Topology
Make sure MPLS with IGP  is confugure as shown in a diagram. I'm not going to configure MPLS here. This tutorial only show how to configure xconnect tunnel peer with other side customer faces interface in our network diagram we interconnect PE1 fa1/0 with PE2 fa0/0 interfaces.

Config of PE1

PE1#sh run
Building configuration...

Current configuration : 1337 bytes
!
upgrade fpd auto
version 15.1
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname PE1
!

ip cef

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf network point-to-point
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.252
 ip ospf 1 area 0
 duplex half
 mpls ip
!
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto
 xconnect 3.3.3.3 15 encapsulation mpls
!

router ospf 1


mpls ldp router-id Loopback0 force
======================================
PE1#sh mpls l2transport vc

Local intf     Local circuit              Dest address    VC ID      Status
-------------  -------------------------- --------------- ---------- ----------
Fa1/0          Ethernet                   3.3.3.3         15         DOWN
PE1#
*Mar  8 07:49:39.887: %LDP-5-NBRCHG: LDP Neighbor 3.3.3.3:0 (2) is UP
 
PE1#sh mpls l2transport vc

Local intf     Local circuit              Dest address    VC ID      Status
-------------  -------------------------- --------------- ---------- ----------
Fa1/0          Ethernet                   3.3.3.3         15         UP



PE1#sh mpls l2transport vc detail
Local interface: Fa1/0 up, line protocol up, Ethernet up
  Destination address: 3.3.3.3, VC ID: 15, VC status: up

pc1

PC1> ping 10.10.10.11
84 bytes from 10.10.10.11 icmp_seq=1 ttl=64 time=39.002 ms
84 bytes from 10.10.10.11 icmp_seq=2 ttl=64 time=39.002 ms
84 bytes from 10.10.10.11 icmp_seq=3 ttl=64 time=39.002 ms
84 bytes from 10.10.10.11 icmp_seq=4 ttl=64 time=40.002 ms
84 bytes from 10.10.10.11 icmp_seq=5 ttl=64 time=31.001 ms

PC1> sh ip

NAME        : PC1[1]
IP/MASK     : 10.10.10.10/24
===============================================================

pc2
====
PC2> ping 10.10.10.10
84 bytes from 10.10.10.10 icmp_seq=1 ttl=64 time=40.002 ms
84 bytes from 10.10.10.10 icmp_seq=2 ttl=64 time=40.002 ms
84 bytes from 10.10.10.10 icmp_seq=3 ttl=64 time=41.002 ms
84 bytes from 10.10.10.10 icmp_seq=4 ttl=64 time=59.003 ms
84 bytes from 10.10.10.10 icmp_seq=5 ttl=64 time=41.003 ms

PC2> sh ip

NAME        : PC2[1]
IP/MASK     : 10.10.10.11/24

=================================================================

PE1#sh mpls ldp neighbor all
    Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 1.1.1.1.646 - 2.2.2.2.47031
        State: Oper; Msgs sent/rcvd: 36/35; Downstream
        Up time: 00:24:20
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 192.168.12.1
        Addresses bound to peer LDP Ident:
          192.168.12.1    1.1.1.1         192.168.13.1
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 3.3.3.3.61604 - 2.2.2.2.646
        State: Oper; Msgs sent/rcvd: 21/22; Downstream
        Up time: 00:11:25
        LDP discovery sources:
          Targeted Hello 2.2.2.2 -> 3.3.3.3, active, passive
        Addresses bound to peer LDP Ident:
          3.3.3.3         192.168.13.2

Configuring a Basic MPLS VPN

March 08, 2016
It's been a long time I'm away from blogging due to some R&D on the network with Juniper boxes. On this tutorial I'm going to configure very basic MPLS VPN configuration in GNS3. After that we go for EoMPLS configuration.

This is the logical topology for this tutorial.
Here I only post the configuration file from PE other router configuration is almost same. Here is the points should be remember.

1. Make sure IGP with MPLS is configure on PE,P, it shouldn't be configure on customer facing interface.
2. Make sure all loopback interface is reachable. 
3. Configure VRF with RD and RT, then applied it on right interface.
4. Configure MP-BGP on PE and peer it.
5. Make sure to redistribute the CE IGP protocol into the BGP and vice versa.

Below command can be copy paste into your router. Before that make sure you had make change necessary things.

Config from PE1

PE1#sh run
Building configuration...

Current configuration : 2126 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname PE1
!
ip cef
ip tcp synwait-time 5
!
!
!
!
ip vrf CustA
 rd 100:1
 route-target export 1:100
 route-target import 1:100
!
no ip domain lookup
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf network point-to-point
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 192.168.11.2 255.255.255.252
 ip ospf 1 area 0
 duplex auto
 speed auto
 mpls ip
!
interface FastEthernet0/1
 ip vrf forwarding CustA
 ip address 192.168.13.1 255.255.255.252
 duplex auto
 speed auto
!
!
router eigrp 1
 auto-summary
 !
 address-family ipv4 vrf CustA
 redistribute bgp 1 metric 1500 2000 200 100 15000
 network 192.168.13.0
 no auto-summary
 autonomous-system 100
 exit-address-family
!
router ospf 1
 log-adjacency-changes
!
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
 neighbor 3.3.3.3 activate
 neighbor 3.3.3.3 send-community both
 exit-address-family
 !
 address-family ipv4 vrf CustA
 redistribute eigrp 100
 no auto-summary
 no synchronization
 exit-address-family
 =============
CE1#ping 192.168.24.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.24.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/70/92 ms

CE1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     192.168.13.0/30 is subnetted, 1 subnets
C       192.168.13.0 is directly connected, FastEthernet0/1
     192.168.24.0/30 is subnetted, 1 subnets
D       192.168.24.0 [90/307200] via 192.168.13.1, 00:50:22, FastEthernet0/1


Juniper DHCP Server Configuration

September 01, 2015
We already configure our QEMU in GNS3 and run our vSRX Router. Now its time to configure DHCP server in our vSRX router. Lets began.
Logical Diagram for this tutorial



To configure DHCP server

Assign Lowest and highest IP range
root# set system services dhcp pool 192.168.1.0/24 address-range low 192.168.1.50 high 192.168.1.200

Assign DNS server (in my case I had used Router interface IP)
root# set system services dhcp pool 192.168.1.0/24 name-server 192.168.1.1

Assign IP address of the router
root# set system services dhcp pool 192.168.1.0/24 router 192.168.1.1

Assign the lease time
root# set system services dhcp pool 192.168.1.0/24 default-lease-time 3600



Assign DHCP as an allowed inbound service for the interface which we are going to enable DHCP.

root# set security zones security-zone untrust interfaces ge-0/0/1 host-inbound-traffic system-services dhcp

Assign IP address to the client faced interface.
root# set interfaces ge-0/0/1 unit 0 family inet address 192.168.1.1/24



Check our client get the IP Address from the server.


How to statically assign IP with fixed MAC address

root#set system service dhcp static-binding 00:50:79:66:68:00 fixed-address 192.168.1.100

PC1>show ip

Request DHCP IP

PC1>dhcp -d




Enjoy

vSRX GNS3 QEMU

September 01, 2015
In this tutorial I'm going to run vSRX JunOS in QEMU and configure it as DHCP Server. Lets began with installing vSRX into QEMU.

I have try vSRX to run into Vbox but never succeeded. So I better to choose QEMU otherwise waste of time.

In my case I had used junos-vsrx-12.1X46-D10.2-domestic to mount into QEMU. Search for it.
Now we have to convert our .vdi file into .image, for that use following command

cd d:\junos\
c:\Program Files\GNS3\qemu\>qemu-img.exe convert -O qcow2 d:\junos\junos-vsrx-12.1X46-D10.2-domestic-disk1.vdi d:\junos\junos-vsrx-12.1X46-D10.2-domestic.img

We just made our image ready to run into QEMU. Go the GNS3

Note: Strongly recommended to use QEMU in linux and enable KVM otherwise it eats up all your CPU and RAM.

-nographic -smp 2 -enable-kvm

>edit>preference>choose "QEMU VMs"
Click on "New" Choose "Default " Gave Name "vSRX" (in my case).






I'll use following topology to configure DHCP server for the tutorial. 



Now we ready to move on the next step. Configuration DHCP








Juniper Message from syslogd

September 01, 2015
While doing some lab test, this weird syslogd message appear every seconds on the console terminal, so it was very difficult to complete the lab.


This messages are due the following syslog configuration . 


So for now we are going to de-activate it to generating the message

#deactivate system syslog user * 
#commit

vSphere Client Displays Empty Inventory

May 27, 2015
Suddenly my home datacenter  vsphere lab show empty inventory in vSphere client. There was no any host at all. I have three ( Cisco IOU, CentOS 7, Ubuntu server) host configure for lab  purpose. So I must recover those host to complete my lab because I almost completed all labs.  Thus here is process how to retrieve those lost host from vSphere client in vSphere 6 database.


Step 1:
Login to the vSphere client choose your database from Configuration Tab > right click database and choose "Browse Dababase".

Step 2: Now next window open the database page. From here open your host folder then choose ".vmx" right click and choose "Add to inventory" then follow the onscreen instruction.


Next window 



Select the database


Next click to finish


Now your server is in the inventory list, you can run the server. In my case its my CentOS 7 server, it will run smoothly. 






Huawei Switch Show Commands

May 25, 2015
Here are basic show commands used in Huawei switch. For configuration of Huawei switch click here.

1. Show VLANs
<sw1>display vlan

8. Show port base VLAN
<sw1>display port vlan  
Port                    Link Type    PVID  Trunk VLAN List
-------------------------------------------------------------------------------
Eth-Trunk0              hybrid       1     -                                
GigabitEthernet0/0/1    trunk        1     1
GigabitEthernet0/0/2    hybrid       1     -                                
GigabitEthernet0/0/3    access       301   -                                
GigabitEthernet0/0/4    access       302   -                                
GigabitEthernet0/0/5    hybrid       1     -                                
GigabitEthernet0/0/6    hybrid       1     -                                
GigabitEthernet0/0/7    hybrid       1     -                                
GigabitEthernet0/0/8    hybrid       1     -


2. View Configuration
[sw1]display current-configuration configuration
!Software Version V200R003C00SPC300
#
sysname sw1
#
vlan batch 301 to 302
#
stp region-configuration
 region-name JR
 instance 1 vlan 20 to 30
 active region-configuration
#
vlan 30
 description fiber
vlan 20
 description Wireless
[sw1-mst-region]active region-configuration

[sw1]display stp instance 0 interface GigabitEthernet 0/0/1 brief
 MSTID   Port                        Role  STP State     Protection
    0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE



interface Eth-Trunk 1
port link-type trunk
port trunk allow-pass vlan 20 30
mode lacp

int gi0/0/5
eth-trunk1
undo negotiation auto

int gi0/0/6
eht-trunk1
undo negotiation auto


3. Show interface configuration
[sw1]display interface Eth-Trunk 1
Eth-Trunk1 current state : UP
Line protocol current state : UP




4. LACP port status

[sw1]display eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1                   WorkingMode: LACP                              
Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP      
System Priority: 32768      System ID: 30d1-7eea-c824                      
Least Active-linknumber: 1  Max Active-linknumber: 8                      
Operate status: up          Number Of Up Port In Trunk: 2                  
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
GigabitEthernet0/0/5   Selected 1GE      32768   1      305     10111100  1  
GigabitEthernet0/0/6   Selected 1GE      32768   2      305     10111100  1  

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
GigabitEthernet0/0/5   32768    001b-0c17-b780  32768   515    1       10111100
GigabitEthernet0/0/6   32768    001b-0c17-b780  32768   514    1       10111100
VID  Status  Property      MAC-LRN Statistics Description  
--------------------------------------------------------------------------------
1    enable  default       enable  disable    VLAN 0001                      
301  enable  default       enable  disable    fiber                          
302  enable  default       enable  disable    Wireless


5. Show interface vlan

[sw1]display int Vlanif 25
Vlanif25 current state : UP
Line protocol current state : UP
Last line protocol up time : 2014-07-21 18:57:40 UTC-05:13
Description:
Route Port,The Maximum Transmit Unit is 1500
Internet Address is 10.10.10.11/24
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 30d1-7eea-c824
Current system time: 2014-07-21 19:01:47-05:13
    Input bandwidth utilization  : --
    Output bandwidth utilization : --

6.  [sw1]ping 10.10.10.10  
  PING 10.10.10.10: 56  data bytes, press CTRL_C to break
    Reply from 10.10.10.10: bytes=56 Sequence=1 ttl=255 time=4 ms
    Reply from 10.10.10.10: bytes=56 Sequence=2 ttl=255 time=5 ms
    Reply from 10.10.10.10: bytes=56 Sequence=3 ttl=255 time=5 ms
    Reply from 10.10.10.10: bytes=56 Sequence=4 ttl=255 time=7 ms
    Reply from 10.10.10.10: bytes=56 Sequence=5 ttl=255 time=5 ms

  --- 10.10.10.10 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 4/5/7 ms

Huawei Switch Configuration Commands

May 25, 2015
Here are some Huawei switch configuration command and verification command is here.


1. Enter int to the privilege mode
<sw1>system view

2. Create the VLAN
[sw1]vlan 30
[sw1]des fiber

3. Configure interface trunk
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk

4. Configure interface access
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/4]port link-type access

5. Assign vlan to that port
[sw1]vlan 30
[sw1-vlan30]port GigabitEthernet 0/0/3
[sw1]vlan 30
[sw1-vlan30]port GigabitEthernet 0/0/4

6. Change port speed and duplex
[sw1]interface GigabitEthernet 0/0/3
[sw1-GigabitEthernet0/0/3]undo negotiation auto
[sw1-GigabitEthernet0/0/3]speed ?
  10                10M port speed mode
  100               100M port speed mode
  1000              1000M port speed mode
  auto-negotiation  Auto negotiation
[sw1-GigabitEthernet0/0/3]speed 100
[sw1]int gi0/0/4
[sw1-GigabitEthernet0/0/4]undo negotiation auto
[sw1-GigabitEthernet0/0/4]speed 100

[sw1-GigabitEthernet0/0/4]duplex ?
  full  Full-Duplex mode
  half  Half-Duplex mode
[sw1-GigabitEthernet0/0/4]duplex full


7. Configure VLAN and add VLAN in trunk port
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 301 302
Info: This operation may take a few seconds. Please wait for a moment...done.

8. MST Configuration

[sw1]stp region-configuration
Info: Please activate the stp region-configuration after it is modified.
[sw1-mst-region]region-name JP
[sw1-mst-region]instance 1 vlan instance 1 vlan 10 20 30 to 50 600 to 616
[sw1-mst-region]instance 0 vlan 302

9. Create management interface
[sw1]interface Vlanif 25
Error: Can not create this interface because the interface number of this type has reached its maximum.
[sw1]undo interface Vlanif 1
[sw1-Vlanif25]ip add 10.10.10.11 255.255.255.0
[sw1-Vlanif25]ip route-static 0.0.0.0 0.0.0.0 129.102.0.2


10. Configure SSH

[sw1]rsa local-key-pair create
The key name will be: sw1_Host
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
       it will take a few minutes.
Input the bits in the modulus[default = 2048]:1024
Generating keys...
.....++++++
..........++++++
.................+++++
...+++++

11. Create local user
[sw1]aaa
[sw1-aaa]local-user jpudasaini password ?
  cipher               User password with cipher text
  irreversible-cipher  User password with irreversible-cipher text
  <cr>

[sw1-aaa]local-user jpudasaini password
Please configure the login password (8-16)
It is recommended that the password consist of at least 2 types of characters, including lowercase letters, uppercase letters, numerals and special characters.
Please enter password:
Please confirm password:
Info: Add a new user.

[sw1-aaa]local-user jpudasaini service-type ssh telnet

12. Configure telnet session
[sw1]stelnet server enable
[sw1]ssh authentication-type default password
[sw1]ssh user jpudasaini
[sw1]ssh user jpudasaini authentication-type password
[sw1]ssh user jpudasaini service-type stelnet


[sw1]user-interface vty 0 4
[sw1-ui-vty0-4]authentication-mode aaa
[sw1-ui-vty0-4]protocol inbound ssh



[sw1-aaa]local-user jpudasaini privilege level 15
[sw1-aaa]local-user jpudasaini service-type ssh
[sw1]ssh authentication-type default password

13. DHCP Snooping enable
[huawei-sw1]dhcp enable
[huawei-sw1]dhcp snooping enable ipv4
[huawei-sw1]dhcp server detect

[huawei-sw1]dhcp snooping check dhcp-rate enable
<huawei-sw1>display dhcp snooping
[huawei-sw1]dhcp snooping check dhcp-rate 50

14. Apply to VLAN
[huawei-sw1]vlan 301
[huawei-sw1-vlan301]dhcp snooping enable

15. Apply to Interface
[huawei-sw1-GigabitEthernet0/0/3]dhcp snooping enable
[huawei-sw1-GigabitEthernet0/0/3]dhcp snooping check dhcp-rate enable


16. Apply to Trunk port
[huawei-sw1-GigabitEthernet0/0/4]dhcp snooping trusted


17. Verify Command
[huawei-sw1]display dhcp snooping configuration    
#
dhcp snooping enable
dhcp snooping check dhcp-rate enable
dhcp snooping check dhcp-rate 50
dhcp server detect
#
vlan 301
 dhcp snooping enable
#
interface GigabitEthernet0/0/3
 dhcp snooping enable
 dhcp snooping check dhcp-rate enable
#
interface GigabitEthernet0/0/4
 dhcp snooping trusted

show command juniper switch

April 21, 2015
Here are some useful command in day to day life while troubleshooting the juniper switch. 

1. show mac add of specific vlan
  root@jpudasaini#show ethernet-switching table vlan 608

2. compare configure before commit
  root@jpudasaini#show | compare

3. check mac add
  root@jpudasaini#show ethernet-switching table brief

4. show perticular Mac in Juniper
  root@jpudasaini#show ethernet-switching table | match d4ca.6dea.d420

5. show port description/status
  root@jpudasaini#show interfaces descriptions statistics

6. Show configuration in configuration mode
  root@jpudasaini#show configuration | display set

7. show correctness of the command before commit
  root@jpudasaini#commit check

8. Show Link Layer detection Protocol 
  root@jpudasaini#show protocols lldp 

9. Show vlan in configuration mode
root@jpudasaini#show vlans | display set

Juniper switch Basic Configuration Commands

December 31, 2014
Hello fellow blog reader, after long gap I'm going to write this thread regarding the basic Juniper command and configuration. I try to include as much as troubleshooting/configuration command during day to day work.
I would like to thank to Srijan pointing the error on LACP command.

1. Set username for login
root@jpudasaini#set system root-authentication encrypted-password
New password:
Retype new password:

root@jpudasaini#set system login user jay full-name jaypudasaini uid 400 class super-user authentication encrypted-password


2. Hostname configuration.
root@switch#set system host-name jpudasaini
root@jpudasaini#

3. Set Tacplus authentication for juniper switch.
root@jpudasaini# set system authentication-order tacplus
root@jpudasaini# set system authentication-order password
root@jpudasaini# set system root-authentication encrypted-password "you password here"
root@jpudasaini# set system tacplus-server 10.10.10.10(your tacplus server IP) secret "your server password here"
root@jpudasaini#set system tacplus-options service-name test

4. Configuration VLAN(Group)
root@jpudasaini#set vlans Cust-Fiber vlan-id 500-550
root@jpudasaini#set vlans Cust-Wireless vlan-id 551-575
    single vlan
root@jpudasaini#set vlans Cust-A vland-id 25

5. Trunk Port Configuration
root@jpudasaini#set interfaces ge-0/0/9 description connect-to-sw2
root@jpudasaini#set interfaces ge-0/0/9 unit 0 family ethernet-switching port-mode trunk
root@jpudasaini#set interfaces ge-0/0/9 unit 0 family ethernet-switching vlan members Cust-Fiber

6. Access Port Configuration
root@jpudasaini#set interfaces ge-0/0/0 description Link-to-sw3
root@jpudasaini#set interfaces ge-0/0/0 unit 0 family ethernet-switching port-mode access
root@jpudasaini#set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members 25

7. Port Channel Configuration
root@jpudasaini#set chassis aggregated-devices ethernet device-count 10
root@jpudasaini#set interfaces ae0 description TR-2-Jpudasaini-Sw2
root@jpudasaini#set interfaces ae0 aggregated-ether-options lacp active
root@jpudasaini#set interfaces ae0 unit 0 family ethernet-switching port-mode trunk
root@jpudasaini#set interfaces ae0 unit 0 family ethernet-switching vlan members Cust-Fiber
root@jpudasaini#set interfaces ae0 unit 0 family ethernet-switching vlan members Cust-Wireless

8. Port Channel Assign to the Physical Port
root@jpudasaini#set interfaces ge-0/0/16 description test-sw1
root@jpudasaini#set interfaces ge-0/0/16 ether-options 802.3ad ae0
root@jpudasaini#set interfaces ge-0/0/17 description test-sw1
root@jpudasaini#set interfaces ge-0/0/17 ether-options 802.3ad ae0

9. Configuration management IP for switch.
root@jpudasaini#set interfaces vlan unit 20 family inet address 10.10.10.11/24

10. Configuration snmp.
root@jpudasaini#set snmp name Test-SNMP
root@jpudasaini#set snmp description test-sw2
root@jpudasaini#set snmp location "Jpudasaini-NOC"
root@jpudasaini#set snmp contact "system@jpudasaini.com.np"
root@jpudasaini#set snmp client-list list0 10.10.10.0/24
root@jpudasaini#set snmp community ax3R5vgW authorization read-only
root@jpudasaini#set snmp community ax3R5vgW client-list-name jpudasaini

11. Enable LLDP
root@jpudasaini# set protocols lldp interface all
root@jpudasaini#set protocols lldp-med interface all

12. Configure port as L3
root@jpudasaini#set interface ge-0/0/23 unit 0 family ethernet-switching port-mode trunk
root@jpudasaini#set interface ge-0/0/23 unit 0 family ethernet-switching vlan member 25
root@jpudasaini#set vlan Mgmt vlan-id 25
root@jpudasaini#set vlan Mgmt l3-interface vlan.25
root@jpudasaini#set interface vlan.250 family inet address xxx.xxx.xxx.xxx

13.Rate Limit
 Configure the policer

root@jpudasaini# set firewall policer Policer_2M if-exceeding bandwidth-limit 1M
root@jpudasaini# set firewall policer Policer_2M if-exceeding burst-size-limit 2k
root@jpudasaini# set firewall policer Policer_2M then discard

Configure the firewall filter

root@jpudasaini# set firewall family ethernet-switching filter Limit term 1 then accept
root@jpudasaini# set firewall family ethernet-switching filter Limit term 1 then policer Poicer_2M

Apply filter on interface (can be any interface as required)

root@jpudasaini# set interface ge-0/0/24.0 family ethernet-switching filter input Limit

Note: Remember that EX series switches apply rate limit only on ingress. 

Cisco Protected Port

October 29, 2014
I can see in my network any customer can communicate to any one on the same VLAN. Basically when ever any unknown packets ingress into the switch. Switch found no record in CAM table, so that frame flood every port of the respected VLAN, except the frame received port. Such a communication can very dangerous for the service provider and its customer. Because any one can sniff or send information to other customer in same VLAN. 

Broadcast packet also flooded into the network that can bottleneck our network. The way to protect such a bottleneck of the network we can configure switch port as protected port thus no port can directly communicated in a same broadcast domain.

Command:
interface fa0/2
switchchport mode access
switchport access vlan 30
switchport protected

This way we can protect the user in same VLAN. Protected port only be configured in edge port not the trunk port or L3 connected port. Now the protected port prevent any unicast, broadcast or multicast packet entering to the same switch interface. But traffic forwarded to same domain can be communicated through L3 device like router. 

How To Configure RSPAN on Cisco Switch

October 08, 2014
Sometime I need to analyze network traffic from remote switch. Thus RSPAN is life saver. Go to the site and capturing the packets and analyze the packets is very time consuming. So here a small tutorial which explain how to configure packets with RSPAN.

SW1(This is the remote switch, Which is the source for our packets.)

sw1(config)#vlan 444
sw1(config-vlan)#remote-span
sw1(config)#monitor session 1 source interface Fa1/0/1 - 16
sw1(config)#monitor session 1 destination remote vlan 444



SW2(The destination switch where you going sniff the packets send my remote switch on case sw1.)
sw2(config)#vlan 444
sw2(config-vlan)#name RSPAN_VLAN
sw2(config-vlan)#remote-span

sw2(config)#monitor session 1 destination interface Gi0/17
sw2(config)#monitor session 1 source remote vlan 444

Now you can capture remote packets in port 17.

All these tutorial tested on cisco 3750 switch.

Cisco IOS Upgrade

September 30, 2014
All these tasks have been done in production environment. I upgraded almost 50 switch IOS in production environment. In my case I don't removed working IOS from the 2950 switch. You may encounter low flash memory during the up-gradation of the new IOS. If that happen do see at the bottom of this tutorial where I had mention how to recover some more space for IOS up-gradation.

Step1:
Fist of all create tftp server in one of the updated IOS switch.
sw2(config)#tftp-server c2950-i6k2l2q4-mz.121-22.EA14.bin

Step2:
Then go to the remote switch where you want to upgrade IOS with new version.

sw1#copy tftp: flash:
Address or name of remote host [100.100.255.47]?
Source filename [100.100.255.47]? c2950-i6k2l2q4-mz.121-22.EA14.bin
Destination filename [c2950-i6k2l2q4-mz.121-22.EA14.bin]?
Accessing tftp://100.100.255.47/c2950-i6k2l2q4-mz.121-22.EA14.bin...
Loading c2950-i6k2l2q4-mz.121-22.EA14.bin from 100.100.255.47 (via Vlan2): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 3722814 bytes]

3722814 bytes copied in 143.124 secs (26011 bytes/sec)

Step3.
Check your copied IOS in the switch.

sw1(config)#do dir flash:
Directory of flash:/

    2  -rwx         864  Mar 01 1993 05:45:31 +05:45  vlan.dat
    3  -rwx       13499  Sep 23 2014 22:17:39 +05:45  config.text
    4  -rwx        1952  Sep 23 2014 22:17:39 +05:45  private-config.text
    5  -rwx     3722112  Mar 01 1993 07:33:24 +05:45  c2950-i6k2l2q4-mz.121-22.EA12
    6  -rwx        5871  Mar 01 1993 06:18:00 +05:45  sw1-config
    7  -rwx          43  Mar 01 1993 07:37:36 +05:45  env_vars
    8  -rwx     3722814  Sep 24 2014 12:30:41 +05:45  c2950-i6k2l2q4-mz.121-22.EA14.bin
  305  -rwx        5168  Mar 01 1993 08:37:25 +05:45  running-config1
  306  -rwx        1048  Sep 23 2014 22:17:39 +05:45  multiple-fs

7741440 bytes total (263680 bytes free)

Step5.
Verify the IOS if corrupted while copying form remote system to the destination system.

sw1#verify /md5 flash:c2950-i6k2l2q4-mz.121-22.EA14.bin
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Done!
verify /md5 (flash:c2950-i6k2l2q4-mz.121-22.EA14.bin) = 8d3250ee253b81b7fe2762e281773fbc

Step6.
Now boot system

sw1(config)#boot system c2950-i6k2l2q4-mz.121-22.EA14.bin

Step7.
Write into the memory, otherwise your system may not boot from the new IOS or if you removed working IOS you system may not found any IOS.

sw1#wr memory
Building configuration...
[OK]

sw1#reload
System configuration has been modified. Save? [yes/no]: y
Building configuration...
[OK]

Step8.
Now check your system boot from new IOS

sw1#sh ver | inc image
System image file is "flash:/c2950-i6k2l2q4-mz.121-22.EA14"
Proceed with reload? [confirm]


How to recover extra space in 2950 switch.

In case you may have little space in switch, your new IOS have "3722814" size and switch only left "2220544" bytes free, in my case I don't need html file so I delete it form the switch.
sw1#dir flash:
Directory of flash:/

    2  -rwx     3722112  Apr 08 2013 11:13:12 +05:45  c2950-i6k2l2q4-mz.121-22.EA12
    3  -rwx         796  Mar 01 1993 05:45:28 +05:45  vlan.dat
    4  drwx        4224  Mar 14 2008 11:52:14 +05:45  html
   79  -rwx        1048  Sep 23 2014 17:05:12 +05:45  multiple-fs
   81  -rwx       12534  Sep 23 2014 17:05:12 +05:45  config.text
   83  -rwx        1958  Sep 23 2014 17:05:12 +05:45  private-config.text

7741440 bytes total (2220544 bytes free)

sw1#delete /f /r flash:html
Delete filename [html]? 

Mikrotik Hotspot Redirect After Login

August 22, 2014
This tutorial assumed you already create Hotspot in your router. If you don't know how to create a hotspot in Mikrotik router, click here and create the Hotspot. .

After successfully creating the hotspot server go to "Files" Menu of  the main Window of Mikrotik router Copy "hotspot" folder into your PC.


Open "alogin" file with text editor


Replace "link-redirect" text with your desire URL




Now you're done! After successfully logging into the Hotspot server your client automatically redirects to your external link. 

Don't forget to copy this folder into Mikrotik Router "Files" Menu. You can also drag and drop this folder into "Files" menu. 

Recover password Cisco Catalyst Switch 2950/2970

August 21, 2014

Power of the switch. Hold down the mode button located on the left side of the front panel, reconnect the power cable to the switch. After few seconds you can see switch: prompt: then release the Mode button when the Status (STAT) LED goes out. (When you release the Mode button, the SYST LED blinks amber).

1. The following instructions appear:
  The system has been interrupted prior to initializing the
   flash filesystem.  The following commands will initialize
   the flash filesystem, and finish loading the operating
   system software:
       flash_init
       load_helper
       boot
   switch:

2. Now follow the following command

switch: flash_init
switch: dir flash
switch: rename flash:config.text flash:config.old
switch: boot

3. Enter "n" at the prompt to start the setup program

--- System Configuration Dialog ---
   At any point you may enter a question mark '?' for help.
   Use ctrl-c to abort configuration dialog at any prompt.
   Default settings are in square brackets '[]'.
   Continue with configuration dialog? [yes/no]: n

    !--- Press Return or Enter.
 
    Switch>
 
    !--- The Switch> prompt is displayed.

      switch>en
      switch#

4. Type rename flash:config.old flash:config.text to rename the configuration file with its original name.

    Switch#rename flash:config.old flash:config.text
                Destination filename [config.text]
    Switch#

5. Copy the configuration file into memory

       Switch#copy flash:config.text system:running-config

6. Change the password


      Switch#configure terminal
      Switch(config)#no enable secret
      Switch(config)#enable secret Cisco
      Switch(config)#end

7. Write the into the memory.

          Switch#write memory
                 Building configuration...
                 [OK]
        Switch#