search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

Juniper Junos基本vlan設定 – KerKer 的模組世界

邊做邊學,順便留個筆記,若有錯誤請不吝指教。

Junos基本操作及root密碼設定可參考我之前的文章:Juniper Junos基本操作、root密碼設定

所有Juniper相關文章列表:Juniper JunOS 系列文章列表

vlan的設定細節比較多,因此可能無法較為全面的做說明,這邊就以一個常見的拓樸作範例。

在這個拓樸中sw1作為vlan100和vlan200的gateway,vlan1作為管理vlan。sw2使用vlan trunk串接sw1,並讓兩台PC分別連到access vlan100的介面及access vlan200的介面。

我們先到sw1查看初始的vlan設定:

    KerKer@sw1> show configuration vlans 
    default {
        vlan-id 1;
        l3-interface irb.0;
    }

初始的vlan設定僅有vlan1作為default vlan,並將irb.0作為vlan1的l3-interface(在舊的版本中會是vlan.0)

首先先將sw1的管理IP設定到irb.0上,這裡分配10.0.0.1作為sw1的管理IP:

    {master:0}[edit]
    KerKer@sw1# set interfaces irb.0 family inet address 10.0.0.1/24

這裡先分別建立vlan100及vlan200,並以irb.100和irb.200作為l3 interface:

    {master:0}[edit]
    KerKer@sw1# set vlans v100 l3-interface irb.100
    {master:0}[edit]
    KerKer@sw1# set vlans v200 l3-interface irb.200

在irb.100和irb.200兩個介面上設定ip作為vlan100及vlan200的gateway:

    {master:0}[edit]
    KerKer@sw1# set interfaces irb.100 family inet address 192.168.100.254/24  
    {master:0}[edit]
    KerKer@sw1# set interfaces irb.200 family inet address 192.168.200.254/24

將與sw2連接的ge-0/0/0介面設定為trunk,並加入default、v100、v200等三個vlan:

    {master:0}[edit]
    KerKer@sw1# edit interfaces ge-0/0/0 unit 0 family ethernet-switching

    {master:0}[edit interfaces ge-0/0/0 unit 0 family ethernet-switching]
    KerKer@sw1# set vlan members [default v100 v200]

sw2的irb.0介面做相同的設定,這裡分配10.0.0.2作為sw2的管理IP:

    {master:0}[edit]
    KerKer@sw2# set interfaces irb.0 family inet address 10.0.0.2/24

一樣建立vlan100及vlan200,但是不用建立l3 iinterface(要建立也可以但不是必須):

    {master:0}[edit]
    KerKer@sw2# set vlans v100 vlan-id 100 
    KerKer@sw2# set vlans v200 vlan-id 200

將與sw1連接的ge-0/0/0介面設定為trunk,並加入default、v100、v200等三個vlan:

    {master:0}[edit]
    KerKer@sw2# edit interfaces ge-0/0/0 unit 0 family ethernet-switching

    {master:0}[edit interfaces ge-0/0/0 unit 0 family ethernet-switching]
    KerKer@sw2# set vlan members [default v100 v200]

接著分別將連接到兩台PC的介面設定為access vlanl00及access vlan200:

    {master:0}[edit]
    KerKer@sw2# edit interfaces ge-0/0/1 unit 0 family ethernet-switching

    {master:0}[edit interfaces ge-0/0/1 unit 0 family ethernet-switching]
    KerKer@sw2# set interface-mode access vlan members 100 

    {master:0}[edit interfaces ge-0/0/2 unit 0 family ethernet-switching]
    KerKer@sw2# set interface-mode access vlan members 200

到這邊sw1及sw2的設定基本完成了,查看位於vlan100的PC設定:

    C:\Users\Jacky>ipconfig

    Windows IP 設定
    ...
        IPv4 位址 . . . . . . . . . . . . : 192.168.100.1
        子網路遮罩 . . . . . . . . . . . .: 255.255.255.0
        預設閘道 . . . . . . . . . . . . .: 192.168.100.254
    ...

嘗試ping vlan100的gateway:

    C:\Users\Jacky>ping 192.168.100.254

    Ping 192.168.100.254 (使用 32 位元組的資料):
    回覆自 192.168.100.254: 位元組=32 時間=12ms TTL=64
    回覆自 192.168.100.254: 位元組=32 時間=3ms TTL=64
    回覆自 192.168.100.254: 位元組=32 時間=13ms TTL=64
    回覆自 192.168.100.254: 位元組=32 時間=5ms TTL=64

    192.168.100.254 的 Ping 統計資料:
        封包: 已傳送 = 4,已收到 = 4, 已遺失 = 0 (0% 遺失),
    大約的來回時間 (毫秒):
        最小值 = 3ms,最大值 = 13ms,平均 = 8ms

到這邊已經可以確定vlan的設定已經正確完成了!



熱門推薦

本文由 KerKerwebsite 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦