三層交換機配置例項及說明
阿新 • • 發佈:2019-02-05
這個不像路由器那個,那個是show run出來的,這個就是自己直接寫的了。是我在畢業設計中,使用在匯聚層的三層交換機的配置。
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
Exit
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
no shutdown
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地址和子網掩碼
no shutdown
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 //可以轉發廣播(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
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 儲存配置
-----------------------------------------------------------------------------
你配的是cisco 3550 三層交換機(做匯聚層),我看了一些高校的匯聚層都是光交換機,接入層才用cisco 3550 ,我很想學學,不知你有沒有一個完成的例項:從骨幹層(雙樹或者環形)到匯聚層,再到接入層的網路配置,謝謝。
--------------------------------------------------------------------------------
一個Catalyst 3550至少要3-5萬,如果這個學校有1000個點,你算算需要多少個48口的3550?需要多少人民幣呢?所以不現實。而且Catalyst 3550是模組化的裝置,可以加入光纖模組,同樣可以支援光纖。而且配置中已經有gigabitethernet做為上行鏈路了。
核心層一般都是雙樹+快速以太通道做為冗餘和容錯的方式,環行一般用於都會網路等,通常是FDDI。因為FDDI的雙環結構提供充分的冗餘,而且當環斷了以後,還可以自己成為小環,提高了容錯性。
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
Exit
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
no shutdown
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地址和子網掩碼
no shutdown
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 //可以轉發廣播(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
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 儲存配置
-----------------------------------------------------------------------------
你配的是cisco 3550 三層交換機(做匯聚層),我看了一些高校的匯聚層都是光交換機,接入層才用cisco 3550 ,我很想學學,不知你有沒有一個完成的例項:從骨幹層(雙樹或者環形)到匯聚層,再到接入層的網路配置,謝謝。
--------------------------------------------------------------------------------
一個Catalyst 3550至少要3-5萬,如果這個學校有1000個點,你算算需要多少個48口的3550?需要多少人民幣呢?所以不現實。而且Catalyst 3550是模組化的裝置,可以加入光纖模組,同樣可以支援光纖。而且配置中已經有gigabitethernet做為上行鏈路了。
核心層一般都是雙樹+快速以太通道做為冗餘和容錯的方式,環行一般用於都會網路等,通常是FDDI。因為FDDI的雙環結構提供充分的冗餘,而且當環斷了以後,還可以自己成為小環,提高了容錯性。