【正文】
間如何實現(xiàn)三層(網(wǎng)絡(luò)層)交換呢?這時就要給各VLAN分配網(wǎng)絡(luò)(IP)地址了。給VLAN分配IP地址分兩種情況,其一,給VLAN所有的節(jié)點分配靜態(tài)IP地址;其二,給VLAN所有的節(jié)點分配動態(tài)IP地址。下面就這兩種情況分別介紹。 假設(shè)給VLAN ,網(wǎng)絡(luò)地址為:, VLAN MARKET ,網(wǎng)絡(luò)地址為:, VLAN , …… (1)給VLAN所有的節(jié)點分配靜態(tài)IP地址。 首先在核心交換機上分別設(shè)置各VLAN的接口IP地址。核心交換機將vlan做為一種接口對待,就象路由器上的一樣,如下所示: switch(config)interface vlan 10 switch (configif)ip address VLAN10接口IP switch (config)interface vlan 11 switch (configif)ip address VLAN11接口IP switch (config)interface vlan 12 switch (configif)ip address VLAN12接口IP再在各接入VLAN的計算機上設(shè)置與所屬VLAN的網(wǎng)絡(luò)地址一致的IP地址,并且把默認網(wǎng)關(guān)設(shè)置為該VLAN的接口地址。這樣,所有的VLAN也可以互訪了。第5章交換機HSRP配置『兩臺交換機主備的配置流程』通常一個網(wǎng)絡(luò)內(nèi)的所有主機都設(shè)置一條缺省路由,主機發(fā)往外部網(wǎng)絡(luò)的報文將通過缺省路由發(fā)往該網(wǎng)關(guān)設(shè)備,從而實現(xiàn)了主機與外部網(wǎng)絡(luò)的通信。當該設(shè)備發(fā)生故障時,本網(wǎng)段內(nèi)所有以此設(shè)備為缺省路由下一跳的主機將斷掉與外部的通信。HSRP就是為解決上述問題而提出的,它為具有多播或廣播能力的局域網(wǎng)(如以太網(wǎng))設(shè)計。VRRP可以將局域網(wǎng)的一組交換機(包括一個Master即活動交換機和若干個Backup即備份交換機)組織成一個虛擬路由器,這組交換機被稱為一個備份組。虛擬的交換機擁有自己的真實IP地址(這個IP地址可以和備份組內(nèi)的某個交換機的接口地址相同),備份組內(nèi)的交換機也有自己的IP地址。局域網(wǎng)內(nèi)的主機僅僅知道這個虛擬路由器的IP地址(通常被稱為備份組的虛擬IP地址),而不知道具體的Master交換機的IP地址以及Backup交換機的IP地址。局域網(wǎng)內(nèi)的主機將自己的缺省路由下一跳設(shè)置為該虛擬路由器的IP地址。于是,網(wǎng)絡(luò)內(nèi)的主機就通過這個虛擬的交換機與其它網(wǎng)絡(luò)進行通信。當備份組內(nèi)的Master交換機不能正常工作時,備份組內(nèi)的其它Backup交換機將接替不能正常工作的Master交換機成為新的Master交換機,繼續(xù)向網(wǎng)絡(luò)內(nèi)的主機提供路由服務(wù),從而實現(xiàn)網(wǎng)絡(luò)內(nèi)的主機不間斷地與外部網(wǎng)絡(luò)進行通信。Catalyst 3560 HSRP配置命令請見下表。 Command Purpose Step 1 configure terminal Enter global configuration mode. Step 2 interface interfaceid Enter interface configuration mode, and enter the Layer 3 interface on which you want to enable HSRP. Step 3 standby [groupnumber] ip [ipaddress [secondary]] Create (or enable) the HSRP group using its number and virtual IP address. ? (Optional) groupnumber—The group number on the interface for which HSRP is being enabled. The range is 0 to 255。 the default is 0. If there is only one HSRP group, you do not need to enter a group number. ? (Optional on all but one interface) ipaddress—The virtual IP address of the hot standby router interface. You must enter the virtual IP address for at least one of the interfaces。 it can be learned on the other interfaces. ? (Optional) secondary—The IP address is a secondary hot standby router interface. If neither router is designated as a secondary or standby router and no priorities are set, the primary IP addresses are pared and the higher IP address is the active router, with the next highest as the standby router. Step 4 end Return to privileged EXEC mode. Step 5 show standby [interfaceid [group]] Verify the configuration. Step 6 copy runningconfig startupconfig (Optional) Save your entries in the configuration file. Command Purpose Step 1 configure terminal Enter global configuration mode. Step 2 interface interfaceid Enter interface configuration mode, and enter the HSRP interface on which you want to set priority. Step 3 standby [groupnumber] priority priority [preempt [delay delay]] Set a priority value used in choosing the active router. The range is 1 to 255。 the default priority is 100. The highest number represents the highest priority. ? (Optional) groupnumber—The group number to which the mand applies. ? (Optional) preempt—Select so that when the local router has a higher priority than the active router, it assumes control as the active router. ? (Optional) delay—Set to cause the local router to postpone taking over the active role for the shown number of seconds. The range is 0 to 3600(1 hour)。 the default is 0 (no delay before taking over). Use the no form of the mand to restore the default values. Step 4 standby [groupnumber] [priority priority] preempt [delay delay] Configure the router to preempt, which means that when the local router has a higher priority than the active router, it assumes control as the active router. ? (Optional) groupnumber—The group number to which the mand applies. ? (Optional) priority—Enter to set or change the group priority. The range is 1 to 255。 the default is 100. ? (Optional) delay—Set to cause the local router to postpone taking over the active role for the number of seconds shown. The range is 0 to 3600 (1 hour)。 the default is 0 (no delay before taking over). Use the no form of the mand to restore the default values. Step 5 standby [groupnumber] track type number [interfacepriority] Configure an interface to track other interfaces so that if one of the other interfaces goes down, the device39。s Hot Standby priority is lowered. ? (Optional) groupnumber—The group number to which the mand applies. ? type—Enter the interface type (bined with interface number) that is tracked. ? number—Enter the interface number (bined with interface type) that is tracked. ? (Optional) interfacepriority—Enter the amount by which the hot standby priority for the router is decremented or incremented when the interface goes down or es back up. The default value is 10. Step 6 end Return to privileged EXEC mode. Step 7 show runningconfig Verify the configuration of the standby groups. Step 8 copy runningconfig startupconfig (Optional) Save your entries in the configuration file【SwitchA相關(guān)配置】Switch configure terminalSwitch(config) interface VLAN 100Switch(configif) ip address Switch(configif) standby 1 ip Switch(configif) standby 1 priority 110 Switch(configif) standby 1 preempt Switch(configif) end【SwitchB相關(guān)配置】Switch configure terminalSwitch(config) interface VLAN100Switch(configif) ip address Switch(configif) standby 1 ip Switch(configif) standby 1 preempt Switch(configif) end【補充說明】l 優(yōu)先級的取值范圍為0到255(數(shù)值越大表明優(yōu)先級越高),但是可配置的范圍是1到254。優(yōu)先級0為系統(tǒng)保留給特殊用途來使用,255則是系統(tǒng)保留給IP地址擁有者。缺省情況下,優(yōu)先級的取值為100。第6章路由協(xié)議配置靜態(tài)路由靜態(tài)路由是一種特殊的路由,它由管理員手工配置而成。通過靜態(tài)路由的配置可建立一個互通的網(wǎng)絡(luò),但這種配置缺點在于:當一個網(wǎng)絡(luò)故障發(fā)生后,靜態(tài)路由不會自動發(fā)生改變,必須有管理員的介入。在組網(wǎng)結(jié)構(gòu)比較簡單的網(wǎng)絡(luò)中,只需配置靜態(tài)路由就可以實現(xiàn)網(wǎng)絡(luò)互連,仔細設(shè)置和使用靜態(tài)路由可以防止路由振蕩,缺點是有可能會產(chǎn)生路由黑洞。靜態(tài)路由包括可達路由的屬性,正常的路由都屬于可達路由這種情況,即IP報文按照目的地標示的路由被送往下一跳,這是靜態(tài)路由的一般用法?!維witch相關(guān)配置】Switch configure terminal Enter configuration mands, one per line.End with CNTL/Z.Switch(config) ip routing Switch(config)ip route next-network next-address舉例:Switch(config)ip route RIP路由RIP是一種基于距離矢量(DistanceVector)算法的協(xié)議,它使用UDP報文進行路由信息的交換。RIP每隔30秒鐘發(fā)送一次路由刷新報文,如果在180秒內(nèi)收不到從某一網(wǎng)絡(luò)鄰居發(fā)來的路由刷新報文,則將該網(wǎng)絡(luò)鄰居的所有路由標記為不可達。如果在300秒之內(nèi)收不到從某一網(wǎng)上鄰居發(fā)來的路由刷新報文,則將該網(wǎng)上鄰居的路由從路由表中清除。RIP1不具備報文加密驗證功能,而在RIP2中實現(xiàn)了該功能。RIP使用跳數(shù)(Hop Count)來衡量到達信宿機的距離,稱為路由權(quán)(Routing Metric)。在RIP中,路由器到與它直接相連網(wǎng)絡(luò)的跳數(shù)為0,通過一個路由器可達的網(wǎng)絡(luò)的跳數(shù)為1,其余依此類推。為限制收斂時間,RIP規(guī)定metric取值0~15之間的整數(shù),大于或等于16的跳數(shù)被