天天看點

三層交換機配置執行個體及說明

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    //啟用三層交換機上的路由子產品

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

interface Port-channel 1         //進入虛拟的以太通道組1

Interface gigabitethernet 0/1    //進入子產品0上的吉比特以太口1

channel-group 1 mode on          //把這個接口放到快速以太通道組1中

Interface gigabitethernet 0/2    //同上channel-group 1 mode on

port-channel load-balance src-dst-ip  //定義快速以太通道組的負載均衡方式(依靠源和目的IP的方式)

interface gigabitethernet 0/3         //進入子產品0上的吉比特以太口3

interface gigabitethernet 0/4   //同上

interface gigbitethernet 0/5    //同上

interface gigbitethernet 0/6    //同上

interface gigbitethernet 0/7     //進入子產品0上的吉比特以太口7

no shutdown

spanning-tree vlan 6-9 cost 1000    //在生成樹中,vlan6-9的開銷定義為10000

interface range gigabitethernet 0/8 – 10   //進入子產品0上的吉比特以太口8,9,10

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

interface gigabitethernet 0/11  //進入子產品0上的吉比特以太口11

interface gigabitethernet 0/12  //同上

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

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

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

standby 4 ip 172.16.4.254

standby 4 priority 110 preempt

interface vlan 5

ip address 172.16.5.252 255.255.255.0

standby 5 ip 172.16.5.254

standby 5 priority 110 preempt

interface vlan 6

ip address 172.16.6.252 255.255.255.0

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

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

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

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    //可以轉發廣播(helper-address的作用就是把廣播轉化為單點傳播,然後發向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

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    儲存配置

本文轉自 qinling_bai 51CTO部落格,原文連結:http://blog.51cto.com/22494/14928,如需轉載請自行聯系原作者

繼續閱讀