2010年9月15日星期三

路由器的高级配置

西安交通大学实验报告

课程:网络技术实验
完成时间:2010年5月12日
实验名称:路由器的高级配置

实验内容

    使用Boson NetSim软件模拟出路由器的环境,并测试路由器的各种指令。

    使用Boson NetSim Designer软件设计一个只含有两个路由器的网络,将这两个路由器的Ethernet端口用双绞线相连。



    进入Boson NetSim软件的命令行模式,开始对路由器进行配置。

    在Router1的命令行下,进行如下操作(#号后为注释,下同):
Router>enable
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname Router1           # 设置主机名为Router1
Router1(config)#interface e0              # 配置e0接口
Router1(config-if)#no shutdown            # 设置以太网端口不掉线
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Router1(config-if)#description Ethernet interface on Router1
                                          # 设置描述
Router1(config-if)#end                    # 退出配置模式,回到特权模式
Router1#show interfaces                   # 查看所有端口的状态
Serial0/0 is administratively down, line protocol is down
  Hardware is HD64570
  MTU 1500 bytes, BW 1544 Kbit, DLY 1000 usec, rely 255/255, load 1/255
  Encapsulation HDLC, loopback not set, keepalive set (10 sec)
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 1000 bits/sec, 2 packets/sec
  5 minute output rate 1000 bits/sec, 2 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 input packets with dribble condition detected
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
Serial1/0 is administratively down, line protocol is down
  Hardware is HD64570
  MTU 1500 bytes, BW 1544 Kbit, DLY 1000 usec, rely 255/255, load 1/255
  Encapsulation HDLC, loopback not set, keepalive set (10 sec)
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 1000 bits/sec, 2 packets/sec
  5 minute output rate 1000 bits/sec, 2 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 input packets with dribble condition detected
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
Ethernet0 is up, line protocol is up
  Hardware is Lance, address is 000C.3070.1825 (bia 000C.3070.1825)
  Description: Ethernet interface on Router1
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set, keepalive set (10 sec)
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 0/75, 0 drops
  5 minute input rate 1000 bits/sec, 2 packets/sec
  5 minute output rate 1000 bits/sec, 2 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 input packets with dribble condition detected
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
    对Router2进行类似配置:
Router>enable
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname Router2
Router2(config)#interface e0
Router2(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Router2(config-if)#end
    在Router1上运行cdp协议,尝试发现周围主机(Router2):
Router1#show cdp interface #使用cdp协议检测以太网端口
Serial0/0 is down, line protocol is down
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Serial1/0 is down, line protocol is down
encapsulation HDLC
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet0 is up, line protocol is up
encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds

Router1#show cdp neighbors # 使用cdp协议发现邻居
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S -Switch, H - Host, i - IGMP, r - Repeater
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
Router2             Eth0           173          R         2611      Eth 0

Router1#show cdp neighbors detail
                           # 显示发现邻居的详细信息,包含运行的OS和版本
-------------------------
Device ID: Router2
Entry address(es):
Platform: Boson 2611 , Capabilities: Router
Interface: Eth0, Port ID (outgoing port): Eth 0
Holdtime:  166 sec

Version :
Boson Operating System Software
Software, Version 12.1(16), RELEASE SOFTWARE (fc2)
Copyright (c) 1986-2001 by Systems, Inc.
Compiled Fri 02-Mar-01 17:34 by dchih


Router1#show cdp entry Router2
-------------------------
Device ID: Router2
Entry address(es):
Platform: Boson 2611 , Capabilities: Router
Interface: Eth0, Port ID (outgoing port): Eth 0
Holdtime:  175 sec

Version :
Boson Operating System Software
Software, Version 12.1(16), RELEASE SOFTWARE (fc2)
Copyright (c) 1986-2001 by Systems, Inc.
Compiled Fri 02-Mar-01 17:34 by dchih


Router1#show cdp # 查看cdp协议本身的信息
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is enabled
    配置Router1的IP地址信息:
Router1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#interface e0
Router1(config-if)#ip address 192.168.0.1 255.255.255.0
                              # 配置IP地址,同时提供子网掩码
Router1(config-if)#no shutdown
Router1(config-if)#end
    对Router2进行类似配置:
Router2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router2(config)#interface e0
Router2(config-if)#ip address 192.168.0.2 255.255.255.0
Router2(config-if)#end
    使用show ip interface命令查看Router2的接口信息:
Router2#show ip interface
Serial0/0 is administratively down, line protocol is down
  Internet protocol processing disabled
Serial1/0 is administratively down, line protocol is down
  Internet protocol processing disabled
Ethernet0 is up, line protocol is up
  Internet address is 192.168.0.2/24
  Broadcast address is 255.255.255.0
  MTU 1500 bytes,
  Helper address is not set
  Directed broadcast forwarding is disabled
  Outgoing access list is not set
  Inbound  access list is not set
  Proxy ARP Is Enabled
  Security Level Is Default
  Split horizon Is Enabled
  ICMP redirects are always sent
  ICMP unreachables are always sent
  ICMP mask replies are never sent
  IP fast switching is enabled
  IP fast switching on the same interface is enabled
  IP Null turbo vector
  IP multicast fast switching is enabled
  IP multicast distributed fast switching is disabled
  router Discovery Is disabled
  IP output packet accounting is disabled
  IP access violation accounting is disabled
  TCP/IP header compression is disabled
  RTP/IP header compression is disabled
  Probe proxy name replies are disabled
  Policy routing Is disabled
  Network address translation is disabled
  WCCP Redirect outbound is disabled
  WCCP Redirect exclude is disabled
  BGP Policy Mapping is disabled
    在Router2上执行ping命令,验证线路畅通情况
Router2# ping 192.168.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
    在Router1上操作ARP表:
Router1#clear arp     # 清空ARP表
Router1#show arp      # 查看当前ARP表,查看不到Router2的ARP信息
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.0.1             -   000C.3070.1825  ARPA   Ethernet0

Router1#ping 192.168.0.2 # 发现Router2并存入ARP表

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Router1#show arp      # 此时可以看到Router2的ARP信息
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.0.1             -   000C.3070.1825  ARPA   Ethernet0
Internet  192.168.0.2             15   000C.5580.7189  ARPA   Ethernet0
    在Router1上操作主机表:
Router1#ping Router2 # 主机表里没有Router2的记录,ping命令失败
% Unrecognized host or address, or protocol not running.

Router1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip host Router2 192.168.0.2
                     # 手动在主机表中增加一条记录
Router1(config)#end
Router1#ping Router2 # ping命令成功执行

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
(完)

笔记:


# Router1
enable
conf t
hostname Router1
interface e0
no shutdown # 不关闭以太网端口零
description Ethernet interface on Router 1 # 设置描述
end # 退出配置模式,回到特权模式
show interfaces # 查看所有端口的状态


# Router2
enable
conf t
hostname Router2
interface e0
no shutdown
end

# Router1
show cdp interface # 使用cdp协议检测以太网端口
show cdp neighbors # 使用cdp协议发现邻居
show cdp neighbors detail # 显示发现邻居的详细信息,包含运行的OS和版本
show cdp entry Router2 # ???
show cdp # 查看cdp协议本身的信息

conf t
interface e0
ip address 202.117.35.1 255.255.255.0 # 配置IP地址,同时提供子网掩码
no shutdown # 配置不掉线
end

# Router2
conf t
interface e0
ip address 202.117.35.2 255.255.255.0 # 2~254
end

show ip interface # 查看接口信息

ping 202.117.35.1 # 验证线路畅通情况

# Router1
ping 202.117.35.2
clear arp # 清空arp表
show arp # 查看不到Router2的ARP信息
ping 202.117.35.2 # 发现Router2并存入ARP表
show arp # 此时可以看到Router2的ARP信息


# 配置主机表
conf t
ip host Router2 202.117.35.2 # 在主机表中增加一条记录
end

ping Router2 # ping命令成功

没有评论:

发表评论