这个学期开了一门名为《网络互联及路由器技术教程与实训》的课,本来是一门很有意思的课,被老师讲的枯燥无味,上课时实在是没办法听,只好睡觉了 (课下再自己看,哎!)。^_^ 记得刚刚学过两个路由器的联通的配置及路由表配置,今天实在闲着无聊,在网上看了些资料,把两个局域网通过路由器联通的试验做了一下。现学现卖哟~~
我使用的是Boson NetSim 的虚拟环境配置的:
首先用Boson Network Designer 设计一个网络,选择路由器时选择具有Ethernet和 Serial端口的。
我设计的网络如下:
设计好之后保存,然后用Boson NetSim打开,选择router1 配置如下:
Press Enter to Start
Router>
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname r1
r1(config)#interface Serial 0
r1(config-if)#ip address 10.0.0.1 255.0.0.0
r1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
r1(config-if)#clock rate 64000
r1(config-if)#interface Ethernet 0
r1(config-if)#ip address 192.0.0.1 255.255.255.0
r1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
r1(config-if)#end
r1#write memory
Building configuration...
[OK]
然后配置 pc1:
Boson BOSS 5.0
Copyright 1998-2003 Boson Software, Inc.
Use the command help to get started
Press Enter to begin
C:>
C:>winipcfg
C:>ipconfig
HELP
Manipulates ip address for Workstation.
IPCONFIG [/ip] [/dg]
/ip Adds the ip address and subnet mask to the workstation
/dg Adds the default gateway to the workstation
Examples:
¢ ipconfig /ip 157.1.1.12 255.0.0.0
¢ ipconfig /dg 157.1.1.1
Boson BOSS 5.0 IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : boson.com
IP Address. . . . . . . . . . . . : 192.0.0.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.0.0.1
You can also use winipcfg to configure the IP Address
现在可以测试一下pc1 和router1 之间是否可以通讯:

呵呵,能够ping 通。
下面配置router2,基本和router1一样:
Press Enter to Start
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0
Router(config-if)#ip addr 10.0.0.2 255.0.0.0
Router(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Serial0, changed state to up
Router(config-if)#int e0
Router(config-if)#ip addr 200.0.0.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Router(config-if)#end
Router#writ m
Building configuration...
[OK]
配置pc2:

好了,到这里就基本配置完成了,但是从pc1 ping router2 却不通,为什么呢?呵呵,还少一个路由表的配置:
打开router1
在全局模式下输入:ip route 200.0.0.0 255.255.255.0 10.0.0.2
然后保存,进入router2,输入:ip route 192.0.0.0 255.255.255.0 10.0.0.1
保存一下,ok!
静态路由的的配置命令格式是 ip route [要访问的网络地址] [这个地址的子网掩码] [下一跳的ip地址] ,一定要记住哟!
好了,现在测试一下pc1 和pc2是否能ping 通:在pc1下:
在pc2下:
ok……
回复