Cấu hình Juniper cơ bản

Thứ ba - 11/04/2023 06:42 1.008 0
Juniper network
Juniper network

CẤU HÌNH JUNIPER CƠ BẢN

Bật nguồn Switch và chờ đến khi đèn POWER sáng màu xanh lá, khi đó trên phần mềm terminal sẽ hiển thị màn hình đăng nhập.
Với cấu hình mặc định, đăng nhập với username và password default của switch Juniper là root và password để trống.
Kể từ phiên bản Junos OS Release 7.6 trở đi, sau khi đăng nhập bạn cần thiết lập mật khẩu cho tài khoản root hoặc tạo các tài khoản khác để quản lý switch.
Tài khoản root mặc định không cho phép truy cập switch thông qua telnet hoặc SSH. Để truy cập qua SSH chúng ta cần phải cấu hình cho phép dịch vụ SSH trên tài khoản root

Tại dấu nhắc %, gõ cli và nhấn Enter để truy cập vào mode CLI operational. Tại đây chúng ta có thể kiểm tra cấu hình, ping, cài đặt thời gian... Sử dụng lệnh ? để xem các câu lệnh trong mode này.

Để cấu hình và quản lý switch, chúng ta cần truy cập vào mode configuration (ký hiệu bằng dâu #). Sử dụng lệnh configure hoặc edit để vào mode configuration
 

LƯU CẤU HÌNH VÀ THOÁT

Khi gõ xong các câu lệnh trên switch Juniper, các câu lệnh này chưa được thực thi ngay. Để lưu cấu hình và thực thi các câu lênh, sử dụng lệnh commit trong mode configuration
root# commit

Để thoát khỏi mode configuration, thực hiện 1 trong 2 cách sau:

Lưu cấu hình và thoát:
root# commit and-quit
commit complete
Exiting configuration mode
root@>

Không lưu cấu hình và thoát
root# exit
Exiting configuration mode
root@>

https://supportportal.juniper.net/s/article/SRX-Getting-Started-Configure-Ethernet-ports-for-switching?language=en_US#cli_config

1.1 Cấu hình password root:
set system root-authentication plain-text-password
New password:xxxxxx
Retype new password:xxxxxx

1.2 Cấu hình hostname:
set system host-name DEVICE-NAME

1.3 Cấu hình login banner:
set system login message “Webcome to”

1.4 Cấu hình timezone:
set system time-zone GMT+7

1.5 Cấu hình name-server:
set system name-server 8.8.8.8
set system name-server 4.2.2.2

1.6 Tạo user quản trị: Lưu ý ở đây mình tạo user admin có full quyền quản trị (tương đương với user root)
set system login user admin uid 2000
set system login user admin class super-user
set system login user admin authentication plain-text-password
New password:xxxxxx
Retype new password:xxxxxx


BẬT CÁC DỊCH VỤ

2.1 SSH, TELNET
set system services ssh
set system services telnet


2.2 WEB MANAGEMENT
Cấu hình chỉ cho truy cập vào web-management từ interface ge-0/0/1.0 (chỉ cho phép truy cập từ Inside)
set system services web-management http interface ge-0/0/1.0
set system services web-management https system-generated-certificate
set system services web-management https interface ge-0/0/1.0
set system services web-management session idle-timeout 60

2.3 Cấu hình DHCP cho Client Inside:
Cấu hình cho các Client trong Inside nhận DHCP từ Jupiter SRX
set system services dhcp pool 10.1.1.0/24 address-range low 10.1.1.192 high 10.1.1.250
set system services dhcp pool 10.1.1.0/24 name-server 8.8.8.8
set system services dhcp pool 10.1.1.0/24 name-server 4.2.2.2
set system services dhcp pool 10.1.1.0/24 router 10.1.1.1


III. Cấu hình địa chỉ IP:

set interfaces ge-0/0/1 unit 0 family inet address 10.1.1.1/24
set interfaces ge-0/0/2 unit 0 family inet address 10.2.2.1/24


SWITCHING

Cấu hình mặc định ban đầu bao gồm Vlan được xác định trước có tên vlan-trust và VLAN interface có tên vlan.0 được gán cho địa chỉ IP là 192.168.1.1/24 và dưới dạng interface Layer 3. VLAN interface được gán cho vùng bảo mật tin cậy (trust security zone), cho phép tất cả các dịch vụ và giao thức

1. Vlan nội bộ (vlan-trust) được xác định để cho phép chuyển đổi một số giao diện
user@host# set vlans vlan-trust vlan-id 3

- Chỉ định giao diện VLAN interface làm interface Layer 3 cho Vlan tin cậy vlan được xác định trước
user@host# set vlans vlan-trust l3-interface vlan.0

- Cấu hình IP cho VLAN interface
user@host# set interfaces vlan unit 0 family inet address 192.168.1.1/24

- Chỉ định tất cả physical interface ngoại trừ ge-0/0/0 cho một phạm vi giao diện có tên giao diện-tin cậy (interfaces-trust)
user@host# set interfaces interface-range interfaces-trust member ge-0/0/1
user@host# set interfaces interface-range interfaces-trust member fe-0/0/2
user@host# set interfaces interface-range interfaces-trust member fe-0/0/3
user@host# set interfaces interface-range interfaces-trust member fe-0/0/4
user@host# set interfaces interface-range interfaces-trust member fe-0/0/5
user@host#  set interfaces interface-range interfaces-trust member fe-0/0/6
user@host#  set interfaces interface-range interfaces-trust member fe-0/0/7

- Assign the interface range to the VLAN vlan-trust
user@host# set interfaces interface-range interfaces-trust unit 0 family ethernet-switching vlan members vlan-trust

- Gán VLAN interface cho vùng bảo mật (security zone) và chỉ định các giao thức và dịch vụ máy chủ lưu trữ được phép. (Đây là tường lửa, vì vậy giao diện được ánh xạ tới vùng tin cậy nơi tất cả các dịch vụ được bật.)
user@host# set security zones security-zone trust interfaces vlan.0
user@host# set security zones security-zone trust host-inbound-traffic system-services all
user@host# set security zones security-zone trust host-inbound-traffic protocols all

Cấu hình hai giao diện thành VLAN riêng biệt
Điều quan trọng cần lưu ý là các giao diện đó phải được xóa khỏi phạm vi giao diện trước khi chúng có thể được thêm vào các Vlan khác để chuyển đổi (bước 1 bên dưới). 

1 - Trước khi bạn có thể thêm một giao diện để chuyển đổi, bạn có thể phải xóa các nhiệm vụ. Chạy lệnh sau để xem nó được cấu hình như thế nào:
user@host# run show configuration | match <interface> | display set     <run set="" display="" ge-0="" match="" configuration="" show="">

Nếu giao diện là thành viên của một nhóm giao diện đang được sử dụng, bạn cần gỡ bỏ nó:
user@host# delete interfaces interface-range <interface-range-name> member <interface>

Nếu có một địa chỉ IP được gán cho giao diện, bạn phải xóa nó:
user@host# delete interfaces <interface> unit 0 family inet

2 - Specify a new VLAN, which will be used for switching, in this case vlan 100:
user@host# set vlans vlan-100 vlan-id 100

3 - Chỉ định giao diện Vlan này làm Giao diện lớp 3 của bạn trên Vlan này:
set vlans vlan-100 l3-interface vlan.100

4 - Cấu hình IP cho VLAN
user@host# set interfaces vlan unit 100 family inet address 192.168.10.1/24

5 - Gán các giao diện vật lý fe-0/0/2 và fe-0/0/3 cho một dải giao diện có tên là interfaces-vlan100
user@host# set interfaces interface-range interfaces-vlan100 member fe-0/0/2
user@host# set interfaces interface-range interfaces-vlan100 member fe-0/0/3

6 - Chỉ định phạm vi giao diện cho VLAN mong muốn. (Mặc định cho các giao diện chuyển mạch mới là port mode = access (untagged))
user@host# set interfaces interface-range interfaces-vlan100 unit 0 family ethernet-switching vlan members vlan-100 

7 - Nó là một bức tường lửa, vì vậy giao diện VLAN cũng phải nằm trong một vùng
user@host# set security zones security-zone trust interfaces vlan.100

8 - Cho phép các dịch vụ trên giao diện VLAN nếu muốn:
user@host# set security zones security-zone trust interfaces vlan.100 host-inbound-traffic system-services <service>
user@host# set security zones security-zone trust host-inbound-traffic protocols <protocol>


Verification & Troubleshooting

Các lệnh sau hữu ích để xác minh và khắc phục sự cố chuyển mạch Ethernet và VLAN:
user@host> show ethernet-switching mac-learning-log          
Technical documentation reference:   show ethernet-switching mac-learning-log
http://www.juniper.net/techpubs/en_US/junos12.1x46/topics/reference/command-summary/show-ethernet-switching-mac-learning-log.html
user@host> show ethernet-switching table              
Technical documentation reference:   show ethernet-switching table 
http://www.juniper.net/techpubs/en_US/junos12.1x46/topics/reference/command-summary/show-ethernet-switching-table.html
user@host> show vlans
user@host> show vlans <vlan> extensive
user@host> show ethernet-switching table interface <interface>
user@host> monitor interface <vlan interface>

Tổng số điểm của bài viết là: 0 trong 0 đánh giá

Click để đánh giá bài viết
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây