制作波尔多液化学式:CCNA實驗:全面的三層交換機配置實例

CISCO認證考試網 鯉魚小編 更新時間:2019-02-20

比較全面的三層交換機配置實例(帶命令解釋喲!)

Enable //進入私有模式

Configure terminal //進入全局模式

service password-encryption //對密碼進行加密

hostname Catalyst 3550-12T1 //給三層交換機定義名稱

enable password 123456. //enable密碼

Enable secret 654321 //enable的加密密碼(應該是亂碼而不是654321這樣)

Ip subnet-zero //允許使用全0子網(默認都是打開的)

Ip name-server 172.16.8.1 172.16.8.2 //三層交換機名字Catalyst 3550-12T1對應的IP地址是172.16.8.1

Service dhcp //提供DHCP服務

ip routing //啟用三層交換機上的路由???/span>

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 //進入???/span>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 //進入???/span>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 //進入???/span>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 //進入???/span>0上的吉比特以太口8,9,10

switchport mode access //定義這些接口的工作模式為訪問模式

switchport access vlan 8 //把這些接口都分配到vlan8

no shutdown

spanning-tree portfast //在這些接口上使用portfast(使用portfast以后,在生成樹的時候不參加運算,直接成為轉發狀態)

interface gigabitethernet 0/11 //進入???/span>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地址和子網掩碼

 

standby 1 ip 172.16.1.9 //開啟了冗余熱備份(HSRP),冗余熱備份組1,虛擬路由器的IP地址為172.16.1.9

standby 1 priority 110 preempt //定義這個三層交換機在冗余熱備份組1中的優先級為110,preempt是用來開啟搶占模式

interface vlan 2 //同上

ip address 172.16.2.252 255.255.255.0

no shutdown

standby 2 ip 172.16.2.254

standby 2 priority 110 preempt

ip access-group 101 in //在入方向上使用擴展的訪問控制列表101

interface vlan 3 //同上

ip address 172.16.3.252 255.255.255.0

no shutdown

standby 3 ip 172.16.3.254

standby 3 priority 110 preempt

ip access-group 101 in

interface vlan 4 //同上

ip address 172.16.4.252 255.255.255.0

no shutdown

standby 4 ip 172.16.4.254

standby 4 priority 110 preempt

ip access-group 101 in

interface vlan 5

ip address 172.16.5.252 255.255.255.0

no shutdown

standby 5 ip 172.16.5.254

standby 5 priority 110 preempt

ip access-group 101 in

interface vlan 6

ip address 172.16.6.252 255.255.255.0

no shutdown

standby 6 ip 172.16.6.254

standby 6 priority 100 preempt

interface vlan 7

ip address 172.16.7.252 255.255.255.0

no shutdown

standby 7 ip 172.16.7.254

standby 7 priority 100 preempt

interface vlan 8

ip address 172.16.8.252 255.255.255.0

no shutdown

standby 8 ip 172.16.8.254

standby 8 priority 100 preempt

interface vlan 9

ip address 172.16.9.252 255.255.255.0

no shutdown

standby 9 ip 172.16.9.254

standby 9 priority 100 preempt

access-list 101 deny ip any 172.16.7.0 0.0.0.255 //擴展的訪問控制列表101

access-list 101 permit ip any any

Interface vlan 1 //進入vlan1這個邏輯接口

Ip helper-address 172.16.8.1 //可以轉發廣播(helperaddress的作用就是把廣播轉化為單播,然后發向172.16.8.1

Interface vlan 2

Ip helper-address 172.16.8.1

Interface vlan 3

ip helper-address 172.16.8.1

interface vlan 4

ip helper-address 172.16.8.1

interface vlan 5

ip helper-address 172.16.8.1

interface vlan 6

ip helper-address 172.16.8.1

interface vlan 7

ip helper-address 172.16.8.1

interface vlan 9

ip helper-address 172.16.8.1

router rip //啟用路由協議RIP

version 2 //使用的是RIPv2,如果沒有這句,則是使用RIPv1

network 172.16.0.0 //宣告直連的網段

exit

ip route 0.0.0.0 0.0.0.0 172.16.9.250 //缺省路由,所有在路由表中沒有辦法匹配的數據包,都發向下一跳地址為172.16.9.250這個路由器

line con 0

line aux 0

line vty 0 15 //telnet線路(路由器只有5個,是0-4

password 12345678 //login密碼

login

end

copy running-config startup-config 保存配置

相關推薦:

從四個方面來看MCSE與CCNA的差異