Olive邏輯路由器互連與Loopback0 設定練習

Olive邏輯路由器互連與Loopback0 設定練習_第1张图片






Lab練習目的
1. 了解邏輯路由器介面分配方式
2. 學習設定邏輯路由器R1, R2, R3
3. 基本check指令

1. 了解邏輯路由器介面分配方式
先講概念
參考如下附圖, 此為我VMware setting

Olive邏輯路由器互連與Loopback0 設定練習_第2张图片

VMware內分配4張網卡
Network Adapter 是計劃給實體路由器使用
Network Adapter 1是計劃給邏輯路由器R1使用
Network Adapter 2是計劃給邏輯路由器R2使用
Network Adapter 3是計劃給邏輯路由器R3使用

Network Adapter 為Bridged mode
以後實體路由器可以與本機PC或其他VMware互連

Network Adapter 1, 2, 3 屬於VMnet1 (DHCP disable)
讓R1-3的介面互連但又透過VLAN來區隔

所以連進實體路由器之後 會看到如下顯示
em0便是VMware的Network Adapter
em1便是VMware的Network Adapter 1
em2便是VMware的Network Adapter 2
em3便是VMware的Network Adapter 3

root> show interfaces terse
Interface               Admin Link Proto    Local                 Remote
cbp0                    up    up  
demux0                  up    up  
dsc                     up    up  
em0                     up    up  
em1                     up    up  
em2                     up    up  
em3                     up    up  
gre                     up    up  
ipip                    up    up  
irb                     up    up  
lo0                     up    up  
lo0.16384               up    up   inet     127.0.0.1           --> 0/0
lo0.16385               up    up   inet     128.0.0.4           --> 0/0
                                  inet6    fe80::20c:290f:fc76:19b8
lsi                     up    up  
mtun                    up    up  
pimd                    up    up  
pime                    up    up  
pip0                    up    up  
pp0                     up    up  
tap                     up    up  

root>

注意:
同一個em介面 可以同時給多個邏輯路由器使用
但不可以有重複VLAN-ID
例如: R1 可以用em1, R2也可以用em1
但如果R1 link to R2
R1 em1.12 (VLAN-ID 12) link to R2 em1.12 (VLAN-ID 12)
這樣是不可以的
因為em1 重複了兩個相同的VALN-ID 12在R1 & R2


2. 學習設定邏輯路由器R1, R2, R3

a. 設定root密碼, 不然無法commit
set system root-authentication plain-text-password

b. Enable em1-3 support 802.1q vlan tag function
set interfaces em1 vlan-tagging
set interfaces em2 vlan-tagging    
set interfaces em3 vlan-tagging  

c. Setting R1 link (VLAN 12) and loopback0.1
set logical-systems R1 interfaces em1 unit 12 vlan-id 12
set logical-systems R1 interfaces em1 unit 12 family inet address 8.8.12.1/24
set logical-systems R1 interfaces lo0 unit 1 family inet address 1.1.1.1/32

d. Setting R2 link (VLAN 12 & VLAN 23) and loopback0.2
set logical-systems R2 interfaces em2 unit 12 vlan-id 12
set logical-systems R2 interfaces em2 unit 12 family inet address 8.8.12.2/24
set logical-systems R2 interfaces em2 unit 23 vlan-id 23
set logical-systems R2 interfaces em2 unit 23 family inet address 8.8.23.2/24
set logical-systems R2 interfaces lo0 unit 2 family inet address 2.2.2.2/32

e. Setting R3 link (VLAN23) and loopback0.3
set logical-systems R3 interfaces em3 unit 23 vlan-id 23
set logical-systems R3 interfaces em3 unit 23 family inet address 8.8.23.3/24
set logical-systems R3 interfaces lo0 unit 3 family inet address 3.3.3.3/32


3. 基本check指令

a. Check interface
root> show interfaces terse
Interface               Admin Link Proto    Local                 Remote
cbp0                    up    up  
demux0                  up    up  
dsc                     up    up  
em0                     up    up  
em1                     up    up  
em1.12                  up    up   inet     8.8.12.1/24    
em2                     up    up  
em2.12                  up    up   inet     8.8.12.2/24    
em2.23                  up    up   inet     8.8.23.2/24    
em3                     up    up  
em3.23                  up    up   inet     8.8.23.3/24    
gre                     up    up  
ipip                    up    up  
irb                     up    up  
lo0                     up    up  
lo0.1                   up    up   inet     1.1.1.1             --> 0/0
lo0.2                   up    up   inet     2.2.2.2             --> 0/0
lo0.3                   up    up   inet     3.3.3.3             --> 0/0
lo0.16384               up    up   inet     127.0.0.1           --> 0/0
lo0.16385               up    up   inet     128.0.0.4           --> 0/0
                                  inet6    fe80::20c:290f:fc76:19b8
lsi                     up    up  
mtun                    up    up        
pimd                    up    up  
pime                    up    up  
pip0                    up    up  
pp0                     up    up  
tap                     up    up  

root>


a. R1 ping R2 interface
root> ping 8.8.12.2 logical-system R1 rapid    
PING 8.8.12.2 (8.8.12.2): 56 data bytes
!!!!!
--- 8.8.12.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.134/0.220/0.463/0.123 ms

root>

b. R1 ping R1 loopbacklo0.1
root> ping 1.1.1.1 logical-system R1 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 = 0.022/0.030/0.057/0.014 ms

root>

c. R2 ping R1 interface
root> ping 8.8.12.1 logical-system R2 rapid    
PING 8.8.12.1 (8.8.12.1): 56 data bytes
!!!!!
--- 8.8.12.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.137/0.167/0.231/0.034 ms

root>

d. R2 ping R3 interface
root> ping 8.8.23.3 logical-system R2 rapid    
PING 8.8.23.3 (8.8.23.3): 56 data bytes
!!!!!
--- 8.8.23.3 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.131/0.221/0.507/0.145 ms

root>

e. R2 ping R2 loopbacklo0.2
root> ping 2.2.2.2 logical-system R2 rapid    
PING 2.2.2.2 (2.2.2.2): 56 data bytes
!!!!!
--- 2.2.2.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.023/0.036/0.058/0.014 ms

root>

f. R3 ping R2 interface
root> ping 8.8.23.2 logical-system R3 rapid    
PING 8.8.23.2 (8.8.23.2): 56 data bytes
!!!!!
--- 8.8.23.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.141/0.156/0.199/0.022 ms

root>

g. R3 ping R3 loopbacklo0.3
root> ping 3.3.3.3 logical-system R3 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.022/0.029/0.050/0.011 ms

root>


Final config:
root# show    
## Last changed: 2014-02-07 15:19:47 UTC
version 12.1R1.9;
system {
   root-authentication {
       encrypted-password "$1$Luohd5lf$6ikSsNi1iEX/147eHbqm7."; ## SECRET-DATA
   }
   syslog {
       user * {
           any emergency;
       }
       file messages {
           any notice;
           authorization info;
       }
       file interactive-commands {
           interactive-commands any;
       }
   }
}
logical-systems {
   R1 {
       interfaces {
           em1 {
               unit 12 {              
                   vlan-id 12;
                   family inet {
                       address 8.8.12.1/24;
                   }
               }
           }
           lo0 {
               unit 1 {
                   family inet {
                       address 1.1.1.1/32;
                   }
               }
           }
       }
   }
   R2 {
       interfaces {
           em2 {
               unit 12 {
                   vlan-id 12;
                   family inet {
                       address 8.8.12.2/24;
                   }                  
               }
               unit 23 {
                   vlan-id 23;
                   family inet {
                       address 8.8.23.2/24;
                   }
               }
           }
           lo0 {
               unit 2 {
                   family inet {
                       address 2.2.2.2/32;
                   }
               }
           }
       }
   }
   R3 {
       interfaces {
           em3 {
               unit 23 {
                   vlan-id 23;
                   family inet {      
                       address 8.8.23.3/24;
                   }
               }
           }
           lo0 {
               unit 3 {
                   family inet {
                       address 3.3.3.3/32;
                   }
               }
           }
       }
   }
}
interfaces {
   em1 {
       vlan-tagging;
   }
   em2 {
       vlan-tagging;
   }
   em3 {
       vlan-tagging;                  
   }
}

[edit]
root#


Final config (display set)
root# show | display set
set version 12.1R1.9
set system root-authentication encrypted-password "$1$Luohd5lf$6ikSsNi1iEX/147eHbqm7."
set system syslog user * any emergency
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set logical-systems R1 interfaces em1 unit 12 vlan-id 12
set logical-systems R1 interfaces em1 unit 12 family inet address 8.8.12.1/24
set logical-systems R1 interfaces lo0 unit 1 family inet address 1.1.1.1/32
set logical-systems R2 interfaces em2 unit 12 vlan-id 12
set logical-systems R2 interfaces em2 unit 12 family inet address 8.8.12.2/24
set logical-systems R2 interfaces em2 unit 23 vlan-id 23
set logical-systems R2 interfaces em2 unit 23 family inet address 8.8.23.2/24
set logical-systems R2 interfaces lo0 unit 2 family inet address 2.2.2.2/32
set logical-systems R3 interfaces em3 unit 23 vlan-id 23
set logical-systems R3 interfaces em3 unit 23 family inet address 8.8.23.3/24
set logical-systems R3 interfaces lo0 unit 3 family inet address 3.3.3.3/32
set interfaces em1 vlan-tagging
set interfaces em2 vlan-tagging
set interfaces em3 vlan-tagging

[edit]
root#