Command Juniper and Cisco bài 1

 Phần 1: Các lệnh cơ bản

- Bảng các lệnh cơ bản

STT

Lession

Junipter command

IOS command

Fundamental

1

Set the Hostname

vMX-1 (ttyd0)

login: lab

Password:

lab@vMX-1> configure

lab@vMX-1# set system host-name vMX-R1

lab@vMX-1# commit and-quit

 

Router>enanble

Router#configure terminal

Router(config)#hostname R10

R10(config)#

2

Verify Hostname

lab@vMX-R1> show configuration system | match host-name

R10#show running-config | include hostname

3

Create a User with a Plain-text Password

lab@vMX-R1> configure  

lab@vMX-R1#set system login user Admin class super-user full-name "Admin" authentication plain-text-password   

New password:

Retype new password:

lab@vMX-R1# commit and-quit

R10#config terminal

R10(config)#username plaintextuser password p@$sw0Rd

R10(config)#end

4

Create a user with an Encrypted Password

 

R10#config terminal

R10(config)#username encrypteduser secret p@$sw0Rd

R10(config)#end

5

Verify the Users Have Been Created

lab@vMX-R1> show configuration system login

lab@vMX-R1> show configuration | display set

lab@vMX-R1# show | display set

R10#show running-config | include username

6

Configure SSHv2

lab@vMX-R1> configure

lab@vMX-R1# set system services ssh

lab@vMX-R1# commit and-quit

R10#config terminal

R10(config)#ip domain-name cisco.com

R10(config)#crypto key generate rsa modulus 1024

R10(config)#ip ssh version 2

R10(config)#end

7

Verify SSHv2

lab@vMX-R1> show configuration system services       

R10#show ip ssh

8

Configure an IP Address on an Interface

lab@vMX-R1> configure

lab@vMX-R1# set interfaces ge-0/0/0 unit 0 family inet address 192.0.2.11/24

lab@vMX-R1# commit and-quit

R10#configure terminal

R10(config)#interface e0/0

R10(config-if)#ip add 192.0.2.10 255.255.255.0

R10(config-if)#no shut

R10(config-if)#end

9

Verify the IP Address

lab@vMX-R1> show configuration interfaces ge-0/0/0

lab@vMX-R1> show interfaces terse ge-0/0/0

R10#show ip interface brief Ethernet 0/0

 
- Topo lab

R10#show ip interface brief Ethernet 0/0
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.0.2.10      YES manual up                    up      
R10# ping 192.0.2.10                    
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.0.2.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/5 ms
R10# ping 192.0.2.11                    
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.0.2.11, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms
R10#
............
lab@vMX-R1> show interfaces terse ge-0/0/0           
Interface               Admin Link Proto    Local                 Remote
ge-0/0/0                up    up
ge-0/0/0.0              up    up   inet     192.0.2.11/24   
                                   multiservice

lab@vMX-R1> ping 192.0.2.11 count 2           
PING 192.0.2.11 (192.0.2.11): 56 data bytes
64 bytes from 192.0.2.11: icmp_seq=0 ttl=64 time=0.152 ms
64 bytes from 192.0.2.11: icmp_seq=1 ttl=64 time=0.104 ms

--- 192.0.2.11 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.104/0.128/0.152/0.024 ms

lab@vMX-R1> ping 192.0.2.10 count 4         
PING 192.0.2.10 (192.0.2.10): 56 data bytes
64 bytes from 192.0.2.10: icmp_seq=0 ttl=255 time=1.718 ms
64 bytes from 192.0.2.10: icmp_seq=1 ttl=255 time=1.391 ms
64 bytes from 192.0.2.10: icmp_seq=2 ttl=255 time=5.901 ms
64 bytes from 192.0.2.10: icmp_seq=3 ttl=255 time=3.488 ms

--- 192.0.2.10 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.391/3.124/5.901/1.791 ms
 
Phần 2: Cấu hình cơ bản
- Cấu hình Dynamic routing OSPF

STT

Lession

Junipter command

IOS command

Single Area OSPF

1

Set IP addresses on the interfaces

lab@vMX-R1> configure

lab@vMX-R1# set interfaces ge-0/0/1 unit 0 family inet address 10.42.12.1/24

lab@vMX-R1# set interfaces ge-0/0/2 unit 0 family inet address 10.42.13.1/24

lab@vMX-R1# set interfaces lo0.0 family inet address 1.1.1.1/32

lab@vMX-R1# commit and-quit

...

lab@vMX-R2> configure

lab@vMX-R2 set interfaces ge-0/0/1 unit 0 family inet address 10.42.12.2/24

lab@vMX-R2 set interfaces ge-0/0/0 unit 0 family inet address 10.42.23.2/24

lab@vMX-R2 set interfaces lo0 unit 0 family inet address 2.2.2.2/32

lab@vMX-R2# commit and-quit

...

R3#config terminal

R3(config)#interface e0/0

R3(config-if)#ip add 10.42.23.3 255.255.255.0

R3(config)#interface e0/1

R3(config-if)#ip add 10.42.13.3 255.255.255.0

R3(config)#interface loopback 0

R3(config-if)#ip add 3.3.3.3 255.255.255.255

R3(config-if)#no shut

R3(config-if)#end

2

Verify

Ping R1 to R2 and R1 to R3

lab@vMX-R1> ping 10.42.12.2 rapid

PING 10.42.12.2 (10.42.12.2): 56 data bytes

!!!!!

--- 10.42.12.2 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max/stddev = 1.562/3.064/8.883/2.910 ms

lab@vMX-R1> ping 10.42.12.2 count 2

PING 10.42.12.2 (10.42.12.2): 56 data bytes

64 bytes from 10.42.12.2: icmp_seq=0 ttl=64 time=3.796 ms

64 bytes from 10.42.12.2: icmp_seq=1 ttl=64 time=8.828 ms

 

--- 10.42.12.2 ping statistics ---

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max/stddev = 3.796/6.312/8.828/2.516 ms

 

lab@vMX-R1> ping 10.42.13.3 count 2   

PING 10.42.13.3 (10.42.13.3): 56 data bytes

64 bytes from 10.42.13.3: icmp_seq=0 ttl=255 time=1.553 ms

64 bytes from 10.42.13.3: icmp_seq=1 ttl=255 time=6.429 ms

 

--- 10.42.13.3 ping statistics ---

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max/stddev = 1.553/3.991/6.429/2.438 ms

Ping R2 to R3 and R2 to R1

lab@vMX-R2> ping 10.42.23.3 count 2

PING 10.42.23.3 (10.42.23.3): 56 data bytes

64 bytes from 10.42.23.3: icmp_seq=0 ttl=255 time=2.306 ms

64 bytes from 10.42.23.3: icmp_seq=1 ttl=255 time=6.864 ms

 

--- 10.42.23.3 ping statistics ---

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max/stddev = 2.306/4.585/6.864/2.279 ms

 

lab@vMX-R2> ping 10.42.12.1 count 2   

PING 10.42.12.1 (10.42.12.1): 56 data bytes

64 bytes from 10.42.12.1: icmp_seq=0 ttl=64 time=2.562 ms

64 bytes from 10.42.12.1: icmp_seq=1 ttl=64 time=6.215 ms

 

--- 10.42.12.1 ping statistics ---

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max/stddev = 2.562/4.388/6.215/1.827 ms

 

Ping R3 to R2 and R3 to R1

R3#ping 10.42.23.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.42.23.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 3/3/4 ms

R3#ping 10.42.13.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.42.13.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms

 

3

Configure OSPF

lab@vMX-R1> configure

lab@vMX-R1# set protocols ospf area 0 interface ge-0/0/1.0 

lab@vMX-R1# set protocols ospf area 0 interface ge-0/0/2.0   

lab@vMX-R1# commit and-quit

...

lab@vMX-R2> configure

lab@vMX-R2# set protocols ospf area 0 interface ge-0/0/0.0

lab@vMX-R2# set protocols ospf area 0 interface ge-0/0/1.0   

lab@vMX-R2# commit and-quit

...

R3(config)#router ospf 1

R3(config-router)#net 10.42.23.2 0.0.0.0 area 0

R3(config-router)#net 10.42.12.2 0.0.0.0 area 0

R3(config-router)#end

R3(config)#interface range e0/0-1

R3(config-if-range)#ip ospf 1 area 0

R3(config-if-range)#end

4

Verify OSPF Configuration

lab@vMX-R1> show ospf neighbor                 

Address          Interface              State     ID               Pri  Dead

10.42.12.2       ge-0/0/1.0             Full      2.2.2.2          128    34

10.42.13.3       ge-0/0/2.0             Full      3.3.3.3            1    36

lab@vMX-R2> show ospf neighbor   

Address          Interface              State     ID               Pri  Dead

10.42.23.3       ge-0/0/0.0             Full      3.3.3.3            1    35

10.42.12.1       ge-0/0/1.0             Full      1.1.1.1          128    39

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           0   FULL/  -        00:00:35    10.42.23.2      Ethernet0/0

1.1.1.1           0   FULL/  -        00:00:38    10.42.13.1      Ethernet0/1

5

Configurea passive interface for loopback 0

lab@vMX-R1> configure

lab@vMX-R1# set protocols ospf area 0 interface lo0.0 passive

lab@vMX-R1# commit and-quit

lab@vMX-R2> configure

lab@vMX-R2# set protocols ospf area 0 interface lo0.0

lab@vMX-R2# commit and-quit

R3(config)#router ospf 1

R3(config)#network 1.1.1.1 0.0.0.0 area 0

R3(config-router)#passive-interface loopback 0

R3(config-router)#and

6

Verify Loopback Interface

ab@vMX-R1> show ospf interface brief | match lo0.0

lo0.0               DRother 0.0.0.0         0.0.0.0         0.0.0.0            0

lab@vMX-R1> show route protocol ospf terse 2.2.2.2

 

inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

 

A V Destination        P Prf   Metric 1   Metric 2  Next hop        AS path

* ? 2.2.2.2/32         O  10          1            >10.42.12.2

lab@vMX-R2> show ospf interface brief | match lo0.0

lo0.0               Waiting 0.0.0.0         0.0.0.0         0.0.0.0            0

show ip ospf interface lo0

show ip route 2.2.2.2

show ip route 3.3.3.3

show ip route 1.1.1.1 ( trên vMX-R1)

7

Configure the OSPF Router-id Manually

lab@vMX-R1> configure

lab@vMX-R1# set routing-options router-id 11.11.11.11

lab@vMX-R1# commit and-quit

lab@vMX-R2> configure

lab@vMX-R2# set routing-options router-id 22.22.22.22

lab@vMX-R2# commit

R3(config)#router ospf 1

R3(config-router)#router-id 3.3.3.3

R3(config-router)#end

R3#clear ip ospf process

8

Verify OSPF Router-id Has Been Manually Assigned

lab@vMX-R2> show ospf overview | match "Router ID"

  Router ID: 22.22.22.22

lab@vMX-R1> show ospf overview | match "Router ID"

  Router ID: 11.11.11.11

R3#show ip protocols | include ID

  Router ID 3.3.3.3

R3# show ip ospf neighbor

9

Verify all

Ping R2 to R3 and R2 to R1

lab@vMX-R2> show route protocol ospf terse 3.3.3.3   

 

inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

 

A V Destination        P Prf   Metric 1   Metric 2  Next hop        AS path

* ? 3.3.3.3/32         O  10          2            >10.42.23.3

 

lab@vMX-R2> ping 3.3.3.3 rapid

PING 3.3.3.3 (3.3.3.3): 56 data bytes

!!!!!

--- 3.3.3.3 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max/stddev = 3.630/4.614/6.275/0.937 ms

lab@vMX-R2> show route protocol ospf terse 1.1.1.1   

 

inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

 

A V Destination        P Prf   Metric 1   Metric 2  Next hop        AS path

* ? 1.1.1.1/32         O  10          1            >10.42.12.1

 

lab@vMX-R2> ping 1.1.1.1 rapid                       

PING 1.1.1.1 (1.1.1.1): 56 data bytes

!!!!!

--- 1.1.1.1 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max/stddev = 2.929/3.742/5.249/0.839 ms

Ping R1 to R3 and R1 to R2

lab@vMX-R1> show route protocol ospf terse 3.3.3.3   

 

inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

 

A V Destination        P Prf   Metric 1   Metric 2  Next hop        AS path

* ? 3.3.3.3/32         O  10          2            >10.42.13.3

 

lab@vMX-R1> ping 3.3.3.3 rapid                                               

PING 3.3.3.3 (3.3.3.3): 56 data bytes

!!!!!

--- 3.3.3.3 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max/stddev = 0.708/10.619/48.717/19.053 ms

 

 

Ping R3 to R2 and R3 to R1

R3#show ip route 2.2.2.2

Routing entry for 2.2.2.2/32

  Known via "ospf 1", distance 110, metric 10, type intra area

  Last update from 10.42.23.2 on Ethernet0/0, 00:04:29 ago

  Routing Descriptor Blocks:

  * 10.42.23.2, from 22.22.22.22, 00:04:29 ago, via Ethernet0/0

      Route metric is 10, traffic share count is 1

R3#ping 2.2.2.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/4 ms

R3#show ip route 1.1.1.1

Routing entry for 1.1.1.1/32

  Known via "ospf 1", distance 110, metric 10, type intra area

  Last update from 10.42.13.1 on Ethernet0/1, 00:04:56 ago

  Routing Descriptor Blocks:

  * 10.42.13.1, from 11.11.11.11, 00:04:56 ago, via Ethernet0/1

      Route metric is 10, traffic share count is 1

R3#ping 1.1.1.1        

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/3 ms

 


- Topo lab cấu hình Dynamic routing OSPF





Nhận xét