都是很简单的实验,拓扑图我懒得发上来了。。。有错误请指出
上机实验
 
 
本章共有10个上机实验小节。默认读者已经掌握了IP地址的作用、VLAN、3层交换和2层交换的区别、常用路由协议等知识。如还不是十分了解,请在阅读本章前参考其他书籍了解并学习他们。
本章中所有实验在一般情况下都应在PC端通过Console线与设备相连进行操作(这种操作方法请参见2.4节)。但是由于这样做不便于操作管理而且不易合理分配资源,所以本章所有实验默认情况下均使用CCS2000客户端进行远程控制操作(这种操作方法请参见1.5节,其实这种连接方法的控制效果和本地串口连接设备Console口相同),请同学先行掌握他的使用。CCS2000的一个缺点是无法用TAB键缺省输入,可以用CCS2000对设备进行初始化操作后再用Telnet进行远程管理。
 
4.1  3928交换机的基本操作
 
3928交换机是中兴公司的3层交换设备。使用CCS2000客户端将1#—5#中任意1台空闲的3928加入到队列中,连接设备串口。
 
基本操作:
3928#show running-config             //查看配置信息
3928#show logfile                   //查看交换机日志
3928#show logging alarm             //查看系统警告信息
3928>enable                       //进入特权模式
3928#configure terminal              //进入全局配置模式
3928(config)#enable secret zxr10       //设置enable密码为zxr10
3928(config)#username zxr10 password zxr10     // 配置一个用户名密码都是zxr10的用户,
                                             远程登陆可用
3928(config)#who                 //查看当前用户
3928(config)#show username      //查看配置的用户信息,可显示用户名和密码
3928(config)#interface           //进入端口配置模式
3928(config-if)#shutdown/no shutdown    //关闭/打开以太网端口
3928(config-if)#negotiation auto/no negotiation auto    //打开/关闭以太网端口自动协商
3928(config-if)#duplex            //设置以太网端口双工模式
3928(config-if)#speed            //设置以太网端口速率
3928(config-if)#flowcontrol        //设置以太网端口流量控制
3928(config-if)#jumbo-frame/no jumbo-frame      //允许/禁止巨帧通过以太网端口
3928(config-if)#byname           //设置端口别名
3928(config-if)#broadcast-limit        //设置以太网口广播风暴抑制,当设置为100M时,表示不抑制
 
 
4.2  1800路由器的基本操作
 
    使用CCS2000客户端将1#—5#中任意1台空闲的1800加入到队列中,连接设
备串口。
 
基本操作:
1800>enable                         //进入特权配置模式\
1800#show ip route                   //查看路由表
1800#configure terminal               //进入全局配置模式
1800(config)#show running-config       //查看当前路由器配置信息
1800(config)#enable secret zxr10        //设置enable密码为zxr10
1800(config)#username zxr10 password zxr10  //将远程telnet用户名密码都设为zxr10
1800(config)#show interface            //查看所有端口信息
1800(config)#show interface fei_2/1      //查看端口fei_2/1的信息
1800(config)#interface                 //进入端口配置模式
1800(config-if)#arp                    //set ARP timeout
1800(config-if)#backup                 //backup a line
1800(config-if)#clear                   //clear MAC binding
1800(config-if)#custom-queue-list        //assign a custom queue list to an interface
1800(config-if)#description              //interface specific descrition
1800(config-if)#dhcp                   //set dhcp configure
1800(config-if)#duplex                 //configure duplex operation
1800(config-if)#end                    //exit to exec mode
1800(config-if)#exit                    //exit from interface configuration mode
1800(config-if)#h323-gateway           //configure H323 Gateway
1800(config-if)#interface               //set an interface characters
1800(config-if)#ip                     //interface Internet Protocol config commands
1800(config-if)#isis                    //ISIS interface commands
1800(config-if)#keepalive               //keepalive period(default 10 seconds)
1800(config-if)#load-interval            //set the interface statistics interval
1800(config-if)#mpls                  //configure MPLS interface parameters
1800(config-if)#no                    //Negate a command or set its defaults
1800(config-if)#peer                  //peer parameters for interfaces
1800(config-if)#priority-group           //assign a priority group to an interface
1800(config-if)#rate-limit               //rate limit
1800(config-if)#rmon                  //Remote Monitoring
1800(config-if)#set                   //binding MAC address
1800(config-if)#shutdown              //shutdown the selected interface
1800(config-if)#speed                 //configure speed operation
1800(config-if)#user-interface           //user interface
1800(config-if)#vrrp                   //VRRP interface configuration commands
1800(config-if)#description ZTE          //接口描述信息
 
 
4.3  2826交换机VLAN配置
 
2826交换机是中兴公司的2层交换设备。使用CCS2000客户端将1#—5#中任意2台空闲的2826加入到队列中,连接设备串口。分别命名为2826A和2826B,用交叉网线连接两台交换机以太网口。任意4台PC编号PC1到PC4,PC1和PC2配线架上的接口用网线连接2826A的以太网口,PC3和PC4连接2826B。具体实验拓扑图如下:
 
2826A具体配置:
zte>en
zte#conf  t
zte(cfg)#hostname 2826A
2826A(cfg)#set vlan 2 add port 16 tag          //在VLAN 2中加入端口16,并打tag
2826A(cfg)#set vlan 2 add port 1 untag         //在VLAN 2中加入端口1,不打tag
2826A(cfg)#set vlan 3 add port 16 tag
2826A(cfg)#set vlan 3 add port 2 untag
2826A(cfg)#set port 1 pvid 2                 //设置端口1的PVID为2
2826A(cfg)#set port 2 pvid3
2826A(cfg)#set vlan 2-3 enable               //使能VLAN 2和3
 
2826B具体配置:
zte>en
zte#conf  t
zte(cfg)#hostname 2826B
2826B(cfg)#set vlan 2 add port 16 tag          //在VLAN 2中加入端口16,并打tag
2826B(cfg)#set vlan 2 add port 2 untag         //在VLAN 2中加入端口1,不打tag
2826B(cfg)#set vlan 3 add port 16 tag
2826B(cfg)#set vlan 3 add port 4 untag
2826B(cfg)#set port 2 pvid 2                 //设置端口1的PVID为2
2826B(cfg)#set port 4 pvid3
2826B(cfg)#set vlan 2-3 enable               //使能VLAN 2和3
 
实验结果验证:
PC1和PC3能够互相ping通;
PC2和PC4能够互相ping通;
PC1和PC4不能互相ping通,PC2和PC3不能互相ping通。
 
实验结论:
同一vlan下的设备可以互通,不通vlan下的设备不能互通;通过端口打TAG可以传递多个VLAN信息。
 
 
4.4  3928交换机VLAN配置
 
3928交换机是中兴公司的3层交换设备。使用CCS2000客户端将1#—5#中任意2台空闲的3928加入到队列中,连接设备串口。分别命名为3928A和3928B,用交叉网线连接两台交换机快速以太网口。任意4台PC编号PC1到PC4,PC1和PC2配线架上的接口用网线连接3928A的快速以太网口,PC3和PC4连接3928B。具体实验拓扑图如下:

3928A具体配置:
3928A(config)#vlan 10                     //创建vlan 10
3928A(config-vlan)#exit
3928A(config)#vlan 20
3928A(config-vlan)#exit
3928A(config)#interface fei_1/1
3928A(config-if)#switchport access vlan 10    //把端口fei_1/1加入vlan 10,模式为access
3928A(config-if)#exit
3928A(config)#interface fei_1/2
3928A(config-if)#switchport access vlan 20    //把端口fei_1/2加入vlan 20,模式为access
3928A(config-if)#exit
3928A(config)#interface fei_1/16
3928A(config-if)#switchport mode trunk
3928A(config-if)#switchport trunk vlan 10     //把端口fei_1/16以trunk模式加入vlan10,20
3928A(config-if)#switchport trunk vlan 20
 
 
 
3928B具体配置:
3928A(config)#vlan 10                     //创建vlan 10
3928A(config-vlan)#exit
3928A(config)#vlan 20
3928A(config-vlan)#exit
3928A(config)#interface fei_1/1
3928A(config-if)#switchport access vlan 10    //把端口fei_1/1加入vlan 10,模式为access
3928A(config-if)#exit
3928A(config)#interface fei_1/2
3928A(config-if)#switchport access vlan 20    //把端口fei_1/2加入vlan 20,模式为access
3928A(config-if)#exit
3928A(config)#interface fei_1/16
3928A(config-if)#switchport mode trunk
3928A(config-if)#switchport trunk vlan 10     //把端口fei_1/16以trunk模式加入vlan10,20
3928A(config-if)#switchport trunk vlan 20
 
实验结果验证:
PC1和PC2不能互相ping通,PC3和PC4不能互相ping通;
PC1和PC3能互相ping通,PC2和PC4能互相ping通。
 
实验结论:
    同一vlan下的设备可以互通,不同vlan下的设备不能互通;通过trunk端口可以实现vlan透传。
 
 
4.5  3928交换机VLAN路由实验
 
本实验用两种不同的方法实现不同VLAN间可通信。
 
方法1:使用单臂路由
使用CCS2000客户端将1#—5#中任意1台空闲的3928和1台空闲的1800连接设备串口。用网线连接两台设备的快速以太网口。任意2台PC配线架上的接口用网线连接3928的快速以太网口。具体实验拓扑图如下:
 
1800具体配置:
1800(config)#interface fei_0/1.1                     //创建子接口
1800(config-subif)#encapsulation dot1q 20            //封装VLAN ID
1800(config-subif)#ip address 10.40.50.1 255.255.255.192
1800(config-subif)#exit
1800(config)#interface fei_0/1.2
1800(config-subif)#encapsulation dot1q 30
1800(config-subif)#ip address 10.40.50.65 255.255.255.192
1800(config-subif)#exit
 
3982具体配置:
3928(config)#vlan 20                            //创建VLAN 20
3928(config-vlan)#exit
3928(config)#vlan 30
3928(config-vlan)#exit
3928(config)#interface fei_1/1
3928(config-if)#switchport access vlan 20           //端口fei_1/1 以access方式加入
3928(config-if)#exit
3928(config)#interface fei_1/2
3928(config-if)#switchport access vlan 30
3928(config-if)#exit
3928(config)#interface fei_1/3
3928(config-if)#switchport mode trunk             //修改端口的链路类型为trunk模式
3928(config-if)#switchport trunk vlan 20            //端口fei_1/3以trunk方式加入vlan20
3928(config-if)#switchport trunk vlan 30            //端口fei_1/3以trunk方式加入vlan30
3928(config-if)#exit
 
实验结果验证:
两台电脑可以互相ping通。
 
方法2:三层交换机
使用CCS2000客户端将1#—5#中任意1台空闲的3928连接设备串口。任意2台PC配线架上的接口用网线连接3928的快速以太网口。具体实验拓扑图如下:
 
3928具体配置:
3928(config)#vlan 20
3928(config-vlan)#exit
3928(config)#vlan 30
3928(config-vlan)#exit
3928(config)#interface fei_1/1
3928(config-if)#switchport access vlan 20
3928(config-if)#exit
3928(config)#interface fei_1/2
3928(config-if)#switchport access vlan 30
3928(config-if)#exit
3928(config)#interface vlan 20
3928(config-if)#ip address 10.40.50.1 255.255.255.192   //在VLAN接口上配置IP
3928(config-if)#exit
3928(config)#interface vlan 30
3928(config-if)#ip address 10.40.50.65 255.255.255.192
3928(config-if)#exit
 
实验结果验证:
两台电脑可以互相ping通。
 
实验结论:
    单臂路由和三层交换方式可以实现不同VLAN的互通。
 
 
4.6  交换机静态路由实验
 
使用CCS2000客户端将1#—5#中任意2台空闲的3928加入到队列中,连接设备串口。分别命名为3928A和3928B,用交叉网线连接两台交换机快速以太网口。任意2台PC编号PC1和PC2,分别连接3928A和3928B的快速以太网口。具体实验拓扑图如下:

3928A具体配置:
3928A(config)#vlan 2
3928A(config-vlan)#switchport pvid fei_2/1              //接PC1
3928A(config-vlan)#exit
3928A(config)#interface vlan 2
3928A(config-if)#ip add 10.1.3.1 255.255.255.0
3928A(config-if)#exit
3928A(config)#interface fei_3/1                       //接3928B
3928A(config-if)#switchport access vlan 3
3928A(config-if)#exit
3928A(config)#interface vlan 3
3928A(config-if)#ip address 192.168.1.1 255.255.255.252
3928A(config-if)#exit
3928A(config)#ip route 10.2.1.0 255.255.255.0 192.168.1.2
3928A(config)#ip route 10.2.2.0 255.255.255.0 192.168.1.2
3928A(config)#ip route 10.2.3.0 255.255.255.0 192.168.1.2
(以上三行命令可用以下缺省路由命令代替:
3928A(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2)
 
 
3928B具体配置
3928B(config)#vlan 2
3928B(config-vlan)#switchport pvid fei_2/1              //接PC2
3928B(config-vlan)#exit
3928B(config)#interface vlan 2
3928B(config-if)#ip add 10.2.3.1 255.255.255.0
3928B(config-if)#exit
3928B(config)#interface fei_3/1                       //接3928A
3928B(config-if)#switchport access vlan 3
3928B(config-if)#exit
3928B(config)#interface vlan 3
3928B(config-if)#ip address 192.168.1.2 255.255.255.252
3928B(config-if)#exit
3928B(config)#ip route 10.1.1.0 255.255.255.0 192.168.1.1
3928B(config)#ip route 10.1.2.0 255.255.255.0 192.168.1.1
3928B(config)#ip route 10.1.3.0 255.255.255.0 192.168.1.1
(以上三行命令可用以下缺省路由命令代替:
3928B(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1)
 
实验结果验证:
显示路由表(show ip route)查看出现那些路由;
观察PC1与PC2直接能否ping通,有无丢包。
 
 
4.7  1800路由器静态路由实验
 
使用CCS2000客户端将1#—5#中任意2台空闲的1800加入到队列中,连接设备串口。分别命名为R1和R2,用交叉网线连接两台路由器快速以太网口。任意3台PC编号PC1、PC2和PC3,PC1连接R1的快速以太网口,PC2,PC3连接R2的快速以太网口。具体实验拓扑图如下:
 
R1具体配置:
R1(config)#interface fei_1/1               //该端口接R2
R1(config-if)#ip address 10.1.1.2 255.255.255.0
R1(config-if)#exit
R1(config)#interface fei_1/2               //该端口接PC1
R1(config-if)#ip address 30.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1   //配置缺省路由
R2具体配置:
R2(config)#interface fei_1/1               //该端口接R1
R2(config-if)#ip address 10.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface fei_1/2               //该端口接PC2
R2(config-if)#ip address 20.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface fei_1/3               //该端口接PC3
R2(config-if)#ip address 40.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#ip route 40.1.1.1 255.255.255.0 10.1.1.2  //配置静态路由
 
实验结果验证:
R1#show ip route            // 查看R1路由表,static表示静态路由
 
IPv4 Routing Table:
Dest           MASK          GW        Interface         Owner   pri     metric
0.0.0.0       0.0.0.0         10.1.1.2        fei_1/1         static     1        0
10.1.1.0     255.255.255.0    10.1.1.2        fei_1/1         direct     0        0
10.1.1.2    255.255.255.255   10.1.1.2        fei_1/1         address   0        0
30.1.1.0     255.255.255.0    30.1.1.1        fei_1/2         direct     0        0
30.1.1.1    255.255.255.0     30.1.1.1        fei_1/2         address   0        0
 
R2#show ip route
 
IPv4 Routing Table:
Dest         MASK        GW     Interface      Owner   pri     metric
10.1.1.0   255.255.255.0   10.1.1.1    fei_0/1       direct     0        0
10.1.1.1  255.255.255.255  10.1.1.2    fei_0/1       address   0        0
20.1.1.0    255.255.255.0   20.1.1.1   fei_1/1       direct     0        0
20.1.1.1  255.255.255.255  20.1.1.1    fei_1/1       address   0        0
30.1.1.0   255.255.255.0   10.1.1.1    fei_0/1       static     1
40.1.1.0   255.255.255.0   40.1.1.1    fei_2/1       direct     0        0
40.1.1.1   255.255.255.0   40.1.1.1    fei_2/1       address   0
 
实验结论:
PC1可以和PC2、PC3互通。
静态路由是网络管理员通过配置命令指定到路由表中的路由信息,它不像动态路由那样根据路由算法建立路由表。当配置动态路由时,有时需要把整个Internet的路由信息发送到一个路由器中,使该路由器难以负荷,此时就可以使用静态路由来解决这个问题。使用静态路由只需要较少的配置就可以避免动态路由的使用。但是在有多个路由器、多条路径的路由环境中,配置静态路由将变得很复杂。
 
 
4.8  1800路由器RIP实验
 
  使用CCS2000客户端将1#—5#中任意2空闲的1800加入到队列中,连接设备串口。分别命名为R1和R2,用交叉网线连接两台路由器快速以太网口。任意2台PC编号PC1和PC2,PC1连接R1的快速以太网口,PC2连接R2的快速以太网口。具体实验拓扑图如下:

R1具体配置:
R1(config)#interface fei_1/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface fei_0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#network 192.168.1.0 0.0.0.255 //将和R2连接的端口加入rip协议中
R1(config-router)#network 192.168.2.0 0.0.0.255//将和PC1连接的端口加入rip协议中R
R1(config-router)#exit
R1(config)#
 
R2具体配置:
R2(config)#interface fei_1/1
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#exit
R2(config)#interface fei_0/1
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#network 192.168.1.0 0.0.0.255 //将和R1连接的端口加入rip协议中
R2(config-router)#network 192.168.3.0 0.0.0.255//将和PC2连接的端口加入rip协议中
R2(config-router)#exit
R2(config)#
 
 
 
实验结果验证:
R1:show ip route
 
IPv4 Routing Table:
Dest        MASK        GW        Interface     Owner   pri     metric
192.168.1.0  255.255.255.0  192.168.1.1   fei_1/1     direct     0       0
192.168.1.1  255.255.255.255 192.168.1.1   fei_1/1     address    0       0
192.168.2.0  255.255.255.0  192.168.2.1    fei_0/1     direct     0       0
192.168.2.1  255.255.255.255 192.168.2.1    fei_0/1    address    0       0
192.168.3.0  255.255.255.0 192.168.1.2    fei_1/1       rip      120      2
 
测试网络互通性,应该是全网互通的。如果不是,请检查您的配置是否与上面的一致。现在我们可以看看RIP是怎样发现路由的,在特权模式下打开RIP协议调试开关,有如下信息在路由器之间传递,它们完成了路由的交换,并形成新的路由。
 
R1#debug ip rip all
 
00:19:36:RIP:building update entries
192.168.2.0/24 via 0.0.0.0,metric 1,tag 0
00:19:36:RIP:Update contains 1 routers
00:19:36:RIP:sending v2 periodic update to 224.0.0.9 via fei_1/1(192.168.1.1)
192.168.1.0/24 via 0.0.0.0,metric 1,tag 0
192.168.3.0/24 via 0.0.0.0,metric 2,tag 0
 
从上面的信息可以看到RIP协议版本为vision 2,这是中兴1800路由器的默认版本。水平分割默认是打开的。关闭水平分割后,可以查看和上面debug信息有何不同。
 
R1(config-if)#no ip split-horizon
R1#debug ip rip all
 
00:35:07:RIP:building update entries
192.168.2.0/24 via 0.0.0.0,metric 1,tag 0
192.168.3.0/24 via 0.0.0.0,metric 3,tag 0
00:35:07:RIP:Update contains 2 routes
00:35:07:Rip:sending v2 periodic update to 224.0.0.9 via fei_1/1(192.168.1.1)
192.168.1.0/24 via 0.0.0.0,metric 1,tag 0
192.168.3.0/24 via 0.0.0.0,metric 2,tag 0
00:35:07:RIP:Update contains 2 routes
00:35:07:RIP:sending v2 periodic update to 224.0.0.9 via fei_0/1(192.168.2.1)
 
在将R1和R2与PC互连得地址改为192.168.2.1/25和192.168.2.129/25后,关掉自动聚合功能。观察关掉自动汇聚前后路由表的变化。
R1(config)#interface fei_0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.128
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#no auto-summary  //关闭自动汇总
R1#show ip router   //关闭前
 
IPv4 Routing Table:
Dest        MASK      GW        Interface       Owner   pri     metric
3.3.3.3  255.255.255.255  3.3.3.3    loopback1      address   0       0
192.168.1.0 255.255.255.0 192.168.1.1   fei_1/1       direct    0       0
192.168.1.1 255.255.255.255 192.168.1.1  fei_1/1      address   0       0
192.168.2.0 255.255.255.0 192.168.2.1   fei_0/1       direct    0       0
192.168.2.1 255.255.255.255 192.168.2.1  fei_0/1      address   0       0
 
R1#show ip router   //关闭后
 
IPv4 Routing Table:
Dest        MASK     GW      Interface      Owner   pri     metric
3.3.3.3   255.255.255.255  3.3.3.3    loopbac    address   0       0
192.168.1.0255.255.255.0 192.168.1.1   fei_1/1     direct    0       0
192.168.1.1 255.255.255.255 192.168.1.1  fei_1/1     address   0       0
192.168.2.0 255.255.255.0 192.168.1.2   fei_1/1       rip     0       0
192.168.2.0 255.255.255.128 192.168.2.1  fei_0/1    direct     0      0
192.168.2.1 255.255.255.255 192.168.2.1   fei_0     address   0       0
 
然后改变协议版本R1(config-router)#version 1并使之生效,并在关闭和启动自动聚合功能下显示路由表信息会发现都没有动态路由产生,知道为什么吗?因为version 1不支可持变长子网掩码,而192.168.2.1与192.168.2.129属于C类地址,自然掩码为24位,属于同一网段的地址。大家可以自己做实验试一试。
 
实验结论:
对接设备的RIP版本要一致。多网段时注意自动汇聚功能。
 
 
4.9  OSPF单区域操作配置
 
使用CCS2000客户端将1#—5#中任意2空闲的1800加入到队列中,连接设备串口。分别命名为R1和R2,用交叉网线连接两台路由器快速以太网口。任意2台PC编号PC1和PC2,PC1连接R1的快速以太网口,PC2连接R2的快速以太网口。具体实验拓扑图如下:
 
R1具体配置:
R1(config)#interface loopback1           //环回地址
R1(config-if)#ip address 10.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#interface fei_1/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface fei_0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 10            //进入ospf路由配置模式,进程号为10
R1(config-router)#router-id 10.1.1.1   //将loopback1配置为ospf的router-id
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0 //将192.168.1.0/24网段加入ospf骨干区域area0
 
R1具体配置:
R1(config)#interface loopback1
R1(config-if)#ip address 10.1.2.1 255.255.255.255
R1(config-if)#exit
R1(config)#interface fei_1/1
R1(config-if)#ip address 192.168.1.2 255.255.255.0
R1(config-if)#exit
R1(config)#interface fei_0/1
R1(config-if)#ip address 192.168.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 10          
R1(config-router)#router-id 10.1.2.1 
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
 
实验结果验证:
R1#show ip ospf neighbor        //查看ospf邻居关系的建立情况
 
OSPF Router with ID(10.1.1.1)(Process ID 100)
Neighbor 10.1.2.1
In the area 0.0.0.0
Via interface fei_1/1 192.168.1.2
Neighbor is DR
State FULL,priority 1,Cost 1
Queue count:Retransmit 0,DD 0,LS Req 0
Dead time:00:00:37
In Full State for 00:00:35    //FULL状态表示建立成功
 
注:如果一台路由器没有手工配置router ID,则系统会从当前接口的IP地址中自动选一个。选择的原则如下:如果路由器配置了loopback接口,则优选loopback接口;如果没有loopback接口,则从已经UP的物理接口中选择接口IP地址最小的一个。对于该原则,大家可以自己在路由器上验证一下。由于自动选举的Router ID会随着IP地址的变化而改变,这样会干扰协议的正常运行。所以强烈建议:手工指定Router ID。
 
R1#show ip route
 
IPv4 Routing Table:
Dest       MASK        GW      Interface       Owner   pri     metric
192.168.1.0  255.255.255.0 192.168.1.1  fei_1/1      direct    0        0
192.168.1.1 255.255.255.255 192.168.1.1 fei_1/1       address   0       0
192.168.2.0  255.255.255.0 192.168.2.1  fei_0/1      direct    0        0
192.168.2.1 255.255.255.255 192.168.2.1  fei_0/1     address   0        0
192.168.3.0 255.255.255.0  192.168.1.2  fei_1/1      ospf     110      20
 
实验结论:
    R1和R2建立ospf邻居,能够互相学习到对方发布到同一区域的路由。
 
 
4.10  OSPF多区域操作配置
 
使用CCS2000客户端将1#—5#中任意2空闲的1800加入到队列中,连接设备串口。分别命名为R1和R2,用交叉网线连接两台路由器快速以太网口。任意2台PC编号PC1和PC2,PC1连接R1的快速以太网口,PC2连接R2的快速以太网口。具体实验拓扑图如下:
 
R1具体配置:
R1(config)#interface loopback1
R1(config-if)#ip address 10.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#interface fei_1/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface fei_0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 10
R1(config-router)#router-id 10.1.1.1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.2.0 0.0.0.255 area 20
 
R2具体配置:
R2(config)#interface loopback1
R2(config-if)#ip address 10.1.2.1 255.255.255.255
R2(config-if)#exit
R2(config)#interface fei_1/1
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#exit
R2(config)#interface fei_0/1
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 10
R2(config-router)#router-id 10.1.1.1
R2(config-router)#network 192.168.1.0 0.0.0.255 area 0
R2(config-router)#network 192.168.3.0 0.0.0.255 area 20
 
实验结果验证:
R1#show ip route
 
IPv4 Routing Table:
Dest         MASK        GW      Interface       Owner   pri    metric
192.168.1.0  255.255.255.0   192.168.1.1   fei_1/1     direct     0       0
192.168.1.1  255.255.255.255 192.168.1.1   fei_1/1    address    0      0
192.168.2.0  255.255.255.0  192.168.2.1  fei_0/1      direct     0       0
192.168.2.1  255.255.255.255 192.168.2.1   fei_0/1     address    0       0
192.168.3.0  255.255.255.0  192.168.1.2  fei_1/1       ospf     110     20
 
实验结论:
    R1能够正确的跨域学习到R2发布的路由。