CCNA学习-路由交换-接口的简单配置

接口配置是最重要的路由器配置之一,因为若没有接口,路由器几乎就毫无用处。另外,要与其他设备通信,接口配置必须绝对精确。配置接口时,我们需要指定网络层地址、介质类型和带宽,还需使用其他管理命令。

启用接口

要禁用接口,我们可使用接口配置命令 shutdown; 要启用接口,我们可使用命令 no shutdown
如果接口被禁用,则在命令 show interfaces (简写为 sh int) 的输出中,该接口显示为管理性关闭 (down ):

Todd#sh int f0/1
FastEthernet0/1 is administratively down , line protocol is down
[output cut] 

另一种检查接口状态的方式是使用命令 show running-config。默认情况下,所有接口都被禁用。要启用接口,我们可使用命令 no shutdown (简写为 no shut):

Todd#config t
Todd(config)#int fOjl
Todd(config-if)#no shutdown
Todd(config-if)#
* July 17 15:05:08.455: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
Todd(config-if)#do show int f0/1
FastEthernet0/1 is up , line protocol is up
[output cut]

给接口配置IP地址

接口模式下使用命令 ip address:

Todd(config)#int f0/1
Todd(config-if)#ip address 172.16.10.2 255.255.255.0
Todd(config-if)#no shutdown

别忘了使用命令 no shutdown 启用接口。别忘了查看命令 show interface int 的输出,看接口是否被管理性关闭。命令 show running-config 也提供这种信息。
/n

接口添加辅助IP地址:

如果要给接口配置第二个地址,就需要使用命令 secondary

Todd(config-if)#ip address 172.16.20.2 255.255.255.0 secondary
Todd(config-if)#^Z
Todd(config-if)#do sh run
Building configuration...
[output cut]
interface FastEthernet0/1
   ip address 172.16.20.2 255.255.255.0 secondary
   ip address 172.16.10.2 255.255.255.0
   duplex auto
   speed auto
!

猜你喜欢

转载自blog.51cto.com/14416969/2421051
今日推荐