CCNA實驗:全面的三層交換機配置實例

字號:

比較全面的三層交換機配置實例(帶命令解釋喲!)
    Enable //進入私有模式
    Configure terminal //進入全局模式
    service password-encryption //對密碼進行加密
    hostname Catalyst 3550-12T1 //給三層交換機定義名稱
    enable password 123456. //enable密碼
    Enable secret 654321 //enable的加密密碼(應該是亂碼而不是654321這樣)
    Ip subnet-zero //允許使用全0子網(wǎng)(默認都是打開的)
    Ip name-server 172.16.8.1 172.16.8.2 //三層交換機名字Catalyst 3550-12T1對應的IP地址是172.16.8.1
    Service dhcp //提供DHCP服務
    ip routing //啟用三層交換機上的路由模塊
    Exit
    Vtp mode server //定義VTP工作模式為sever模式
    Vtp domain centervtp //定義VTP域的名稱為centervtp
    Vlan 2 name vlan2 //定義vlan并給vlan取名(如果不取名的話,vlan2的名字應該是vlan002)
    Vlan 3 name vlan3
    Vlan 4 name vlan4
    Vlan 5 name vlan5
    Vlan 6 name vlan6
    Vlan 7 name vlan7
    Vlan 8 name vlan8
    Vlan 9 name vlan9
    Exit
    interface Port-channel 1 //進入虛擬的以太通道組1
    switchport trunk encapsulation dot1q //給這個接口的trunk封裝為802.1Q的幀格式
    switchport mode trunk //定義這個接口的工作模式為trunk
    switchport trunk allowed vlan all //在這個trunk上允許所有的vlan通過
    Interface gigabitethernet 0/1 //進入模塊0上的吉比特以太口1
    switchport trunk encapsulation dotlq //給這個接口的trunk封裝為802.1Q的幀格式
    switchport mode trunk //定義這個接口的工作模式為trunk
    switchport trunk allowed vlan all //在這個trunk上允許所有的vlan通過
    channel-group 1 mode on //把這個接口放到快速以太通道組1中
    Interface gigabitethernet 0/2 //同上
    switchport trunk encapsulation dotlq
    switchport mode trunk
    switchport trunk allowed vlan all
    channel-group 1 mode on
    port-channel load-balance src-dst-ip //定義快速以太通道組的負載均衡方式(依*源和目的IP的方式)
    interface gigabitethernet 0/3 //進入模塊0上的吉比特以太口3
    switchport trunk encapsulation dotlq //給trunk封裝為802.1Q
    switchport mode trunk //定義這個接口的工作模式為trunk
    switchport trunk allowed vlan all //允許所有vlan信息通過
    interface gigabitethernet 0/4 //同上
    switchport trunk encapsulation dotlq
    switchport mode trunk
    switchport trunk allowed vlan all
    interface gigbitethernet 0/5 //同上
    switchport trunk encapsulation dotlq
    switchport mode trunk
    switchport trunk allowed vlan all
    interface gigbitethernet 0/6 //同上
    switchport trunk encapsulation dotlq
    switchport mode trunk
    switchprot trunk allowed vlan all
    interface gigbitethernet 0/7 //進入模塊0上的吉比特以太口7
    Switchport mode access //定義這個接口的工作模式為訪問模式
    switchport access vlan 9 //定義這個接口可以訪問哪個vlan(實際就是分配這個接口到vlan)
    no shutdown
    spanning-tree vlan 6-9 cost 1000 //在生成樹中,vlan6-9的開銷定義為10000
    interface range gigabitethernet 0/8 – 10 //進入模塊0上的吉比特以太口8,9,10
    switchport mode access //定義這些接口的工作模式為訪問模式
    switchport access vlan 8 //把這些接口都分配到vlan8中
    no shutdown
    spanning-tree portfast //在這些接口上使用portfast(使用portfast以后,在生成樹的時候不參加運算,直接成為轉(zhuǎn)發(fā)狀態(tài))
    interface gigabitethernet 0/11 //進入模塊0上的吉比特以太口11
    switchport trunk encapsulation dotlq //給這個接口封裝為802.1Q
    switchport mode trunk //定義這個接口的工作模式為trunk
    switchport trunk allowed vlan all //允許所有vlan信息通過
    interface gigabitethernet 0/12 //同上
    switchport trunk encapsulation dotlq
    switchport mode trunk
    switchport trunk allowed vlan all
    interface vlan 1 //進入vlan1的邏輯接口(不是物理接口,用來給vlan做路由用)
    ip address 172.16.1.7 255.255.255.0 //配置IP地址和子網(wǎng)掩碼
    no shutdown