默认路由配置(思科)

1. Loop接口介绍(环回接口)

 Loopback接口是虚拟接口,是一种纯软件性质的虚拟接口。任何送到该接口的网络数据报文都会被认为是送往设备自身的。大多数平台都支持使用这种接口来模拟真正的接口。这样做的好处是虚拟接口不会像物理接口那样因为各种因素的影响而导致接口被关闭。事实上,将Loopback接口和其他物理接口相比较,可以发现Loopback接口有以下几条优点:
        (1),Loopback接口状态永远是up的,即使没有配置地址。这是它的一个非常重要的特性。
        (2),Loopback接口可以配置地址,而且可以配置全1的掩码,可以节省宝贵的地址空间。
        (3),Loopback接口不能封装任何链路层协议
对于目的地址不是loopback口,下一跳接口是loopback口的报文,路由器会将其丢弃。对于CISCO路由器来说,可以配置[no] ip unreachable命令,来设置是[否]发送icmp不可达报文,对于VRP来说,没有这条命令,缺省不发送icmp不可达报文 

在配置测试路由器的互通性时,配置环回接口可以可以大大减少终端配置的代码量。一个回环接口相当于在路由器上配置了一台终端设备和交换机,所以我们在测试路由器的联通情况,只需配置回环接口即可。

默认路由配置(思科)_第1张图片

2,路由器配置

Router2接口地址配置

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#inter se2/0
Router(config-if)#ip add 192.168.12.1 255.255.255.0//interface se2/0 address
Router(config-if)#no shut//开启接口

%LINK-5-CHANGED: Interface Serial2/0, changed state to down
Router(config-if)#exit
Router(config)#clock rate 128000
                     ^
% Invalid input detected at '^' marker.
	
Router(config)#inter se2/0
Router(config-if)#clock rate 128000//配置时钟
Router(config-if)#exit
Router(config)#
Router#
%SYS-5-CONFIG_I: Configured from console by console

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#inter lo
Router(config)#inter loopback 0

Router(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

Router(config-if)#ip add 1.1.1.1 255.255.255.0//配置回环接口
Router(config-if)#exit
Router(config)#

Router1接口地址配置

Router>en 
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#inter se2/0
Router(config-if)#ip add 192.168.12.2 255.255.255.0//配置se2/0 接口地址
Router(config-if)#no shut//接口开启

Router(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up

Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up

Router(config-if)#exit
Router(config)#inter se3/0
Router(config-if)#ip add 192.168.23.1 255.255.255.0//配置se3/0接口地址
Router(config-if)#no shut//接口开启

%LINK-5-CHANGED: Interface Serial3/0, changed state to down
Router(config-if)#clock rate 128000//配置时钟
Router(config-if)#exit
Router(config)#inter lo
Router(config)#inter loopback 0

Router(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

Router(config-if)#ip add 2.2.2.2 255.255.255.0
Router(config-if)#exit
Router(config)#

Router0接口地址配置

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#inter se3/0
Router(config-if)#ip add 192.168.23.2 255.255.255.0
Router(config-if)#no shut

Router(config-if)#
%LINK-5-CHANGED: Interface Serial3/0, changed state to up

Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/0, changed state to up

Router(config-if)#

Router2默认路由配置

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 0.0.0.0 255.255.255.0 192.168.12.2
Router(config)#

Router1静态路由配置

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 1.1.1.0 255.255.255.0 192.168.12.1
Router(config)#ip route 3.3.3.0 255.255.255.0 192.168.23.2//配置静态路由
Router(config)#

Router0默认路由配置

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.23.1//配置默认路由,一般位于路由边缘厂配置默认路由
Router(config)#exit
Router#

配置完成图

默认路由配置(思科)_第2张图片

3,测试连通性

Route0 ping Route2


Router#ping 1.1.1.1

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

Router#

Route2 ping Route0

Router#ping 3.3.3.3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

Router#ping 3.3.3.3

我们可以看到route2在ping route0 时并没有ping通,成功率为0 percentage,我们回过期检查发现Route0并没有给配置回环接口配置地址,所以只需在Route0 下添加

Router(config)#inter loopback  0

Router(config-if)#
%LINK-5-CHANGED: Interface Loopback0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

Router(config-if)#ip add 3.3.3.3 255.255.255.0
Router(config-if)#exit
Router(config)#exit

重新测试,Route2 ping Route0,

Router#ping 3.3.3.3

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

Router#

      配置成功!!!

你可能感兴趣的:(网络设备配置,route,switch)