綜合二
一.設備初始化(以R1為例)
Router>enable
Router#configure terminal
Router (config) #hostname R1
Rl (config) #no ip domain-lookup 關閉域名解析
R1 (config) #enable secret jwcisco
Rl(config)#line console 0 //console口配置
Rl (config-line) #exec-timeout 10 4
Rl (config-line)#logging synchronous
Rl (config-line) #password jwccna
Rl (config-line) #login
Rl (config-line)#line vty 0 4
Rl (config-line) #exec-timeout 5 2
Rl (config-line)#logging synchronous 配置光標跟蹤
Rl (config-line) #password jwccna
Rl (config-line)#login
二.區域划分(以SW3為例)
Sw3 (config)#vlan 90 創建vlan
Sw3(config-vlan) #name ADMIN //vlan名稱
Sw3 (config-vlan) #int vlan90
Sw3 (config-if) #ip address 192.168.90.1 255.255.255.0
三.Vtp配置(SW1服務器配置)
swl (config)#vtp mode server//設置vtp模式
sw1 (config)#vtp domain jsj 域名
Swl (config)#vtp password l4wg 密碼
其余交換機客戶端配置(以SW2為例)
Sw2(config)#vtp mode client
Sw2 (config)#vtp domain jsj
Sw2(config)#vtp password l4wg
四.配置各vlan的主次根橋(以SW1為例)
sw1 (config)#spanning-tree vlan 2 root primary SW1配置為vlan2的主根橋
sw1 (config)#spanning-tree vlan i root primary
sw1 (config)#spanning-tree vlan 3 root primary
sw1 (config)#spanning-tree vlan 90 root primary
sw1 (config) #spanning-tree vlan 4 root secondary 配置為vlan4的次根橋
Swl (config)#spanning-tree vlan 5 root secondary
五.單臂路由及配置接口地址(以R1為例)
Rl(config-if)#int f0/0.99
Rl(config-subif) #encapsulation dotlo 99
Rl (config-subif)#ip address 192.168.99.254 255.255.255.0
Rl (config-subif)#int f0/0.100
Rl (config-subif) #encapsulation dot1o 100
Rl (config-subif)#ip address 192.168.100.254 255.255.255.0
Rl (config-subif)#exit
R1(config)#int f0/0
R1(config-if)# no shutdown
六.鏈路匯聚(以SW2為例)
Sw2 (config) #interface range f0/ 3-4
sw2 (config-if-range)#switchport trunk encapsulation dotlq
Sw2 (config-if-range)|#switchport mode trunk
sw2 (config-if-range)#channe1-group 1 mode on
sw2 (config)#interface port-channel 1
sw2 (config-if)#switchport mode trunk
七.HSRP配置(以SW1為例)
SW1(config)#int vlan2
SW1(config-if)#standby 2 ip 192.168.2.254
SW1(config-if)#standby 2 priority 150 優先級
SW1(config-if)#standby 2 preempt 搶占
SW1(config-if)#standby 2 track f0/1 跟蹤端口
SW1(config-if)#standby 2 track f0/24
八.EIGRP配置 (路由器以R1為例)
R1 (config) #router eigrp 100
R1 (config-router) #no auto-summary
R1 (config-router) #network 112.10.12.0 0.0.0.7
R1 (config-router) #network 178.20.12.0 0.0.0.7
R1 (config-router) #network 192.168.99.0 0.0.0.255
R1 (config-router) #network 192.168.100.0 0.0.0.255
EIGRP配置 (交換機以SW1為例)
SW1 (config)router eigrp 100
SW1 (config-router) #ip routing
SW1 (config-router) #network 192.168.2.0 0.0.0.255
SW1 (config-router) #network 192.168.90.0 0.0.0.255
SW1 (config-router) #passive-interface f0/2
九.浮動路由和靜態路由配置(以R1為例)
R1 (config) #ip route 0.0.0.0 0.0.0.0 f0/1 100 送出接口
R1 (config) #ip route 0.0.0.0 0.0.0.0 s0/0/0 下一跳地址
十.PAT配置(以R2為例)
R2(config)#ip nat pool NAT 112.10.12.3 112.10.12.4 netmask 255.255.255.248//配置地址池和掩碼
R2(config)#ip nat inside source list ACCESS pool NAT overload//配置NAT
十二.標准訪問控制列表(ACL)配置(以R2為例)
R2(config) #access-list 2 permit 192.168.2.0 0.0.0.255 //只允許vlan2的網段訪問
R2 (config) #access-list 2 deny any //禁止其他網段訪問
R2 (config)#int s0/0/1
R2 (config-if)ip access-group 2 in
十一.SSH配置(以SW2為例)
SW2(config)#ip domain-name cisco //配置域名
SW2(config)#crypto key generate rsa //加密密鑰生成
SW2(config)#ip ssh version 2 //啟用版本2
SW2(config)#username jw001 secret 888 用戶名為jw001,密碼為888
SW2(config)#line vty 0 15 進入vty進程
SW2(config-line)#transport input ssh 僅允許以SSH的方式登錄
SW2(config-line)#exit
綜合一
1.設備初始化配置
hostname R1 改名
enable secret ciscocisco 設置特權加密密碼
enable password cisco 設置特權明文密碼
line console 0 進入consolo口
password 123 配置密碼
exec-timeout 0 0 空閑時間永不超時
logging synchronus 設置日志同步
line vty 0 4 (交換機是0 15)進入vty線路
password 123 配置密碼
exec-timeout 0 0 空閑時間永不超時
logging synchronus 設置日志同步
注意把網絡中各個紅色狀態接口no shutdown打開
2. 單臂路由
(1.交換機配置)
Switch(config)#vlan 3 創建vlan 3
Switch(config)#name RSB 給vlan起名稱
Switch(config)#vlan 4 創建vlan 4
Switch(config)#name CWB 給vlan起名稱
Switch(config)#int f0/1
Switch(config-if)#switchport mode access 設置為接入模式
Switch(config-if)#switchport access vlan 3 將f0/2接口划分到vlan 3
Switch(config)#int f0/2
Switch(config-if)#switchport mode access 設置為接入模式
Switch(config-if)#switchport access vlan 4 將f0/3接口划分到vlan 4
Switch(config-if)#exit
Switch(config)#int f0/24
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
(2.路由器配置)
R1(config)#int g0/0/0.3 直接進入.3子接口
Router(config-subif)#encapsulation dot1Q 3 封裝vlan 3
Router(config-subif)#ip address 172.16.3.254 255.255.255.0 給接口配地址
Router(config-subif)#int g0/0/0.4 直接進入.4子接口
Router(config-subif)#encapsulation dot1Q 4 指定一個子接口為vlan 4的接口
Router(config-subif)#ip address 192.16.4.254 255.255.255.0 給接口配地址
Router(config-subif)#exit
Router(config)#interface g0/0/0 進大接口
Router(config-if)#no shutdown 開啟接口
R3路由器也需要配置單臂路由,只是子接口號、地址等信息不同,原理一樣。
3.vtp配置(在交換機上)
SW1 上 :
vtp mode server
vtp domain ccna
vtp password cisco
int f0/24
switchport mode trunk
SW2和SW1原理一樣,注意SW2模式為:vtp mode transparent
4.eigrp配置
router eigrp 1
no auto-summary
passive-interface f0/0
network 宣告直連網段 注意使用通配符掩碼(反掩碼)
5.配置浮動路由
R1:ip route 2.2.2.0 255.255.255.0 f0/1 100 送出接口的
R1: ip route 2.2.2.0 255.255.255.0 192.168.12.2 下一跳地址的
R2:ip route 1.1.1.0 255.255.255.0 f0/1 100 送出接口的
R2: ip route 1.1.1.0 255.255.255.0 192.168.12.1 下一跳地址的
6.配置loopback口地址
int loopback 0
ip address 1.1.1.1 255.255.255.0
7.在eigrp下宣告換回接口
network 1.1.1.0 0.0.0.255
R2和R3同理
宣告技巧:show ip route 查看路由表,看哪些是直連,就宣告直連。
loopback就屬於環回接口,配置地址后也會在路由表中顯示,所以一樣需要宣告。
自己理解的(不准確):配置環回接口后,在路由表中會顯示,相當於創建了一個網段,所以需要宣告
注意:給設備改名,配置各個接口的地址,配置pc的地址,子網掩碼和默認網關都是加分的
