Lab 2.2 Cấu hình Qualified to Hop trên Juniper

  • Thread starter Thread starter root
  • Ngày gửi Ngày gửi

root

Specialist
I. Mô hình
- Mô hình



- Yêu cầu
  • Cấu hình IP và định tuyến như trong sơ đồ
  • Cấu hình để các client bên trong ra được internet qua ISP1
  • Khi interface ge-0/0/0 trên Router JunOS gặp sự cố thì client vẫn đi internet bình thường thông qua ISP-2
II. Triển khai
1. Cấu hình IP và Route trên 2 Router ISP
- Ở đây mình sẽ dùng 2 Router 3745 IOS của Cisco để làm 2 Router ISP

[TABLE="class: outer_border, width: 800"]
[TR]
[TD]// Cấu hình IP, Route trên Router ISP 1
ISP_1(config)#int f0/0
ISP_1(config-if)#ip address dhcp
ISP_1(config-if)#no shut

ISP_1(config)#int f0/1
ISP_1(config-if)#ip address 10.1.1.254 255.255.255.0
ISP_1(config-if)#no shut
ISP_1(config-if)#exit

ISP_1(config)#ip route 192.168.10.0 255.255.255.0 10.1.1.1

// Cấu hình IP, Route trên Router ISP 2
ISP_2(config)#int f0/0
ISP_2(config-if)#ip address dhcp
ISP_2(config-if)#no shut

ISP_2(config)#int f0/1
ISP_2(config-if)#ip address 10.2.2.254 255.255.255.0
ISP_2(config-if)#no shut
ISP_2(config-if)#exit

ISP_2(config)#ip route 192.168.10.0 255.255.255.0 10.2.2.1[/TD]
[/TR]
[/TABLE]

2. Cấu hình IP trên JunOS
- Nếu cần bạn có thể sử dụng lệnh sau để đưa cấu hình Router Juniper về cấu hình mặc định ban đầu của nó

[TABLE="class: outer_border, width: 500"]
[TR]
[TD]root# load factory-default[/TD]
[/TR]
[/TABLE]

- Cấu hình IP cho các interface và đưa các interface vào các ZONE phù hợp
[TABLE="class: outer_border, width: 800"]
[TR]
[TD]// Cấu hình interface ge-0/0/0 nằm trong zone OUTSIDE-1
root# set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.1/24
root# delete security zones security-zone untrust interfaces ge-0/0/0.0
root# set security zones security-zone OUTSIDE-1 interfaces ge-0/0/0 host-inbound-traffic system-services ping

// Cấu hình interface ge-0/0/1 nằm trong zone OUTSIDE-2
root# set interfaces ge-0/0/1 unit 0 family inet address 10.2.2.1/24
root# set security zones security-zone OUTSIDE-2 interfaces ge-0/0/1 host-inbound-traffic system-services ping

// Cấu hình interface ge-0/0/1 nằm trong zone INSIDE
root# set interfaces ge-0/0/2 unit 0 family inet address 192.168.10.1/24
root# set security zones security-zone INSIDE interfaces ge-0/0/2 host-inbound-traffic system-services ping[/TD]
[/TR]
[/TABLE]

- Cấu hình policy cho phép zone INSIDE truy cập ra OUTSIDE-1 và OUTSIDE-2

[TABLE="class: outer_border, width: 850"]
[TR]
[TD]root# set security policies from-zone INSIDE to-zone OUTSIDE-1 policy INSIDE-OUTSIDE1 match source-address any
root# set security policies from-zone INSIDE to-zone OUTSIDE-1 policy INSIDE-OUTSIDE1 match destination-address any
root# set security policies from-zone INSIDE to-zone OUTSIDE-1 policy INSIDE-OUTSIDE1 match application any
root# set security policies from-zone INSIDE to-zone OUTSIDE-1 policy INSIDE-OUTSIDE1 then permit


root# set security policies from-zone INSIDE to-zone OUTSIDE-2 policy INSIDE-OUTSIDE2 match source-address any
root# set security policies from-zone INSIDE to-zone OUTSIDE-2 policy INSIDE-OUTSIDE2 match destination-address any
root# set security policies from-zone INSIDE to-zone OUTSIDE-2 policy INSIDE-OUTSIDE2 match application any
root# set security policies from-zone INSIDE to-zone OUTSIDE-2 policy INSIDE-OUTSIDE2 then permit[/TD]
[/TR]
[/TABLE]

- Cấu hình Static Route trên JunOS

[TABLE="class: outer_border, width: 800"]
[TR]
[TD]// Đường số 1 sẽ làm đường chính - Primary
root# set routing-options static route 0.0.0.0/0 next-hop 10.1.1.254

// Đường số 2 sẽ làm đường phụ, chức năng là backup cho đường chính - Backup
root# set routing-options static route 0.0.0.0/0 qualified-next-hop 10.2.2.254 preference 6[/TD]
[/TR]
[/TABLE]

3. Kiểm tra
- Kiểm tra cấu hình định tuyến trên JunOS

Mã:
root# [COLOR=#ff0000][B]show routing-options[/B][/COLOR]
static {
    route 0.0.0.0/0 {
        [COLOR=#ff0000]next-hop 10.1.1.254[/COLOR];
        [COLOR=#ff0000]qualified-next-hop 10.2.2.254[/COLOR] {
          [COLOR=#ff0000]  preference 6[/COLOR];
        }
    }
}
- Kiểm tra bảng định tuyến của JunOS

Mã:
root# run show route


inet.0: 7 destinations, 8 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both


[COLOR=#ff0000]0.0.0.0/0[/COLOR]          *[[COLOR=#ff0000]Static/5[/COLOR]] 00:01:39
                    > [COLOR=#ff0000]to 10.1.1.254 via ge-0/0/0.0[/COLOR]
                    [[COLOR=#ff0000]Static/6[/COLOR]] 00:56:09
                    > [COLOR=#ff0000]to 10.2.2.254 via ge-0/0/1.0[/COLOR]
10.1.1.0/24        *[Direct/0] 00:01:39
                    > via ge-0/0/0.0
10.1.1.1/32        *[Local/0] 00:01:39
                      Local via ge-0/0/0.0
10.2.2.0/24        *[Direct/0] 03:24:40
                    > via ge-0/0/1.0
10.2.2.1/32        *[Local/0] 03:24:40
                      Local via ge-0/0/1.0
192.168.10.0/24    *[Direct/0] 02:04:33
                    > via ge-0/0/2.0
192.168.10.1/32    *[Local/0] 02:04:33
                      Local via ge-0/0/2.0
- Thực hiện tracert route trên Router JunOS các bạn thấy nó đi qua Router ISP 1

Mã:
root# [COLOR=#ff0000][B]run traceroute 8.8.8.8[/B][/COLOR]
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 40 byte packets
 1  10.1.1.254 ([COLOR=#ff0000]10.1.1.254[/COLOR])  38.861 ms  18.279 ms  11.295 ms
 2  * * *
 3  *^C
- Client ping ra internet thành công

Mã:
PC1> ping 8.8.8.8
84 bytes from 8.8.8.8 icmp_seq=1 ttl=126 time=81.457 ms
84 bytes from 8.8.8.8 icmp_seq=2 ttl=126 time=67.304 ms
84 bytes from 8.8.8.8 icmp_seq=3 ttl=126 time=46.943 ms
84 bytes from 8.8.8.8 icmp_seq=4 ttl=126 time=51.639 ms
84 bytes from 8.8.8.8 icmp_seq=5 ttl=126 time=43.099 ms

- PC tracert route 8.8.8.8 cho kết quả đi internet thông qua ISP-1



- Ngừng traffic đi qua interface ge-0/0/0 trên JunOS

[TABLE="class: outer_border, width: 800"]
[TR]
[TD]root# deactivate interfaces ge-0/0/0 unit 0 family inet address 10.1.1.1/24
root#commit[/TD]
[/TR]
[/TABLE]

- Nếu các bạn gặp lỗi sau

Mã:
root# commit
[edit security zones security-zone OUTSIDE-1]
  'interfaces ge-0/0/0.0'
    Interface ge-0/0/0.0 must be configured under interfaces
error: configuration check-out failed


[edit]
- Thì các bạn gõ thêm lệnh sau vào

[TABLE="class: outer_border, width: 800"]
[TR]
[TD]root# delete security zones security-zone OUTSIDE-1 interfaces ge-0/0/0.0
root# deactivate interfaces ge-0/0/0 unit 0 family inet address 10.1.1.1/24
root# commit
commit complete

[edit][/TD]
[/TR]
[/TABLE]

- Kiểm tra lại
Mã:
root# [COLOR=#ff0000][B]show interfaces[/B][/COLOR]
[COLOR=#ff0000][B]inactive[/B][/COLOR]: ge-0/0/0 {
    unit 0 {
        family inet {
            address 10.1.1.1/24;
        }
    }
}
ge-0/0/1 {
    unit 0 {
        family inet {
            address 10.2.2.1/24;
        }
    }
}
ge-0/0/2 {
    unit 0 {
        family inet {
            address 192.168.10.1/24;
        }
    }
}
Mã:
root> [COLOR=#ff0000][B]show interfaces ge-0/0/0 detail[/B][/COLOR]
Physical interface: ge-0/0/0, Enabled, Physical link is Up
  Interface index: 134, SNMP ifIndex: 507, Generation: 137
  Link-level type: Ethernet, MTU: 1514, Link-mode: Full-duplex, Speed: 1000mbps,
  BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled,
  Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled,
  Remote fault: Online
  Device flags   : Present Running
  Interface flags: SNMP-Traps Internal: 0x4000
  Link flags     : None
  CoS queues     : 8 supported, 8 maximum usable queues
  Hold-times     : Up 0 ms, Down 0 ms
  Current address: 00:0c:29:93:15:2b, Hardware address: 00:0c:29:93:15:2b
  Last flapped   : 2014-11-30 11:52:00 UTC (03:12:21 ago)
  Statistics last cleared: Never
  Traffic statistics:
   Input  bytes  :               141492                    0 bps
   Output bytes  :               600912                    0 bps
   Input  packets:                 1435                    0 pps
   Output packets:                 2368                    0 pps
  Active alarms  : None
  Active defects : None
  Interface transmit statistics: [B][COLOR=#ff0000]Disabled[/COLOR][/B]
- Kiểm tra lại các cấu hình định tuyến trong file cấu hình

Mã:
root# [COLOR=#ff0000][B]show routing-options[/B][/COLOR]
static {
    route 0.0.0.0/0 {
        next-hop 10.1.1.254;
        qualified-next-hop 10.2.2.254 {
            preference 6;
        }
    }
}


[edit]
- Bây giờ bảng định tuyến chỉ còn lại 1 default-route

Mã:
root# [COLOR=#ff0000][B]run show route[/B][/COLOR]


inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both


[COLOR=#ff0000]0.0.0.0/0          *[Static/6] 00:40:14[/COLOR]
[COLOR=#ff0000]                    > to 10.2.2.254 via ge-0/0/1.0[/COLOR]
10.2.2.0/24        *[Direct/0] 03:08:45
                    > via ge-0/0/1.0
10.2.2.1/32        *[Local/0] 03:08:45
                      Local via ge-0/0/1.0
192.168.10.0/24    *[Direct/0] 01:48:38
                    > via ge-0/0/2.0
192.168.10.1/32    *[Local/0] 01:48:38
                      Local via ge-0/0/2.0


[edit]
- Thực hiện tracert route trên router JunOS bạn sẽ thấy

Mã:
root# run traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 40 byte packets
 1  [COLOR=#ff0000]10.2.2.254 (10.2.2.254)  31.393 ms  21.991 ms  7.691 ms[/COLOR]
[COLOR=#ff0000] 2  192.168.80.2 (192.168.80.2)  22.972 ms  21.780 ms  27.070 ms[/COLOR]
 3  * * *
 4  * * *
 5  * * *
 6  *^C
[edit]
- Thực hiện Tracert route trên client các bạn sẽ thấy nó sẽ đi ra internet thông qua ISP-2

 
Back
Top