思科三层交换机的详细配置命令是什么?

思科三层交换机的详细配置命令是什么?,第1张

三层交换机基本配置
实验名称
三层交换机端口配置。
实验目的
配置开启三层交换机的三层功能,实现路由作用。
背景描述
公司现有1台三层交换机,要求你进行测试,该交换机的三层功能是否工作正常
技术原理
三层交换机是在二层交换的基础上实现了三层的路由功能。三层交换机基于“一次路由,多次交换”的特性,在局域网环境中转发性能远远高于路由器。而且三层交换机同时具备二层的功能,能够和二层的交换机进行很好的数据转发。三层交换机的以太网接口要比一般的路由器多很多,更加适合多个局域网段之间的互联。
三层交换机的所有端口在默认情况下都属于二层端口,不具备路由功能。不能给物理端口直接配置IP地址。但可以开启物理端口的三层路由功能。
三层交换机默认开启了路由功能,可利用ip
routing命令进行控制。
实现功能
开启三层交换机物理端口的路由功能。
实验设备
S3550-24或S3550-48(1台),直连线(1条)
实验步骤
步骤1
开启三层交换机的路由功能。
Switch>enable
Switch#configure
terminal
Switch(config)#hostname
S3550-24
S3550-24(config)#ip
routing
!开启三层交换机的路由功能
步骤2
配置三层交换机端口的路由功能。
S3550-24(config)#interface
fastethernet
0/5
S3550-24(config-if)#no
switchport
!开启端口的三层路由功能
S3550-24(config-if)#ip
address
19216851
2552552550
!
给端口配置IP地址
S3550-24(config-if)#no
shutdown
S3550-24(config-if)#end
步骤3
验证、测试配置。
S3550#show
ip
interface
!查看接口状态信息
Interface
:
Fa0/5
Description
:
FastEthernet100BaseTX
0/5
OperStatus
:
up
!接口状态是UP
ManagementStatus
:
Enabled
Primary
Internet
address:
19216851/24
Broadcast
address
:
255255255255
PhysAddress
:
00d0f8ffbd43
S3550#show
interfaces
f0/5
!查看接口状态信息
Interface
:
FastEthernet100BaseTX
0/5
Description
:
AdminStatus
:
up
!接口状态是UP
OperStatus
:
up
Medium-type
:
copper
Hardware
:
10/100BaseTX
Mtu
:
1500
LastChange
:
0d:0h:32m:49s
AdminDuplex
:
Auto
OperDuplex
:
Unknown
AdminSpeed
:
Auto
OperSpeed
:
Unknown
FlowControlAdminStatus
:
Off
FlowControlOperStatus
:
Off
Priority
:
0
Broadcast
blocked
:DISABLE
Unknown
multicast
blocked
:DISABLE
Unknown
unicast
blocked
:DISABLE
ARP
Timeout
:
3600
sec
Primary
Internet
address:
19216851/24
PhysAddress
:
00d0f8ffbd43
ManagementStatus:Enabled
Broadcast
address
:
255255255255
主机测试:将PC1的IP地址设为19216852/24,在PC1上ping
19216851。
ping
19216851
Pinging
19216851
with
32
bytes
of
data:
Reply
from
19216851:
bytes=32
time<1ms
TTL=64
Reply
from
19216851:
bytes=32
time<1ms
TTL=64
Reply
from
19216851:
bytes=32
time<1ms
TTL=64
Reply
from
19216851:
bytes=32
time<1ms
TTL=64
Ping
statistics
for
19216851:
Packets:
Sent
=
4,
Received
=
4,
Lost
=
0
(0%
loss),
Approximate
round
trip
times
in
milli-seconds:
Minimum
=
0ms,
Maximum
=
0ms,
Average
=
0ms
参考配置
S3550-24#show
running-config
System
software
version
:
102
Build
Oct
17
2005
Release
Building
configuration
Current
configuration
:
145
bytes
version
10
hostname
Switch
vlan
1
interface
FastEthernet
0/5
no
switchport
ip
address
19216851
2552552550
!
end

注释后的配置命令如下:
Building configuration
Current configuration:1381 bytes
!
version 122
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
!//开启三层交换机的路由功能
Ip routing
!
!
!
!//将连接访问口层的端口配置为连接,并将二层的工作端口转换为三层的工作端口
interface FastEthernet0/1
no switchport
ip address 19216811 2552552550
duplex auto
speed auto
!//将连接层的端口配置为将2层的端口转换为3层端口
Interface FastEthernet0/2
no switchport
ip address 19216831 2552552550
duplex auto
speed auto
!
Interface Fast Ethernet 0/3
!
Interface Fast Ethernet 0/4
!
Interface Fast Ethernet 0/5
!
Interface Fast Ethernet 0/6
!
Interface Fast Ethernet 0/7
!
Interface Fast Ethernet 0/8
!
Interface Fast Ethernet 0/9
!
Interface Fast Ethernet 0/10
!
Interface Fast Ethernet 0/11
!
Interface Fast Ethernet 0/12
!
Interface Fast Ethernet 0/13
!
Interface Fast Ethernet 0/14
!
Interface Fast Ethernet 0/15
!
Interface Fast Ethernet 0/16
!
Interface Fast Ethernet 0/17
!
Interface Fast Ethernet 0/18
!
Interface Fast Ethernet 0/19
!
Interface Fast Ethernet 0/20
!
Interface Fast Ethernet 0/21
!
Interface Fast Ethernet 0/22
!
Interface Fast Ethernet 0/23
!
Interface Fast Ethernet 0/24
!//配置接入核心路由器的端口G0/1
Interface Gigabit Ethernet 0/1
No switchport
Ip address 192168101 255255255252
duplex auto
speed auto
!
Interface Vlanl
no ip address
shut down
!//使用 RIP版本2路由协议,在 RIP路由中加入三个直接网段
router rip version 2
network 19216810
network 19216830
network

(config)#ip dhcp pool cisco  配置一个dhcp的地址池,名字叫做cisco  这个名字可以随便写;

(dhcp-config)#network 19216830 2552552550  这个dhcp地址池 给19216830 这个地址段分配ip地址,范围是 19216831  1921683254;

(dhcp-config)#default-router 19216831    分配的默认网关是 19216831;

(config )#dns server 这个命令的配置模式是错误的 应该是(dhcp-config)#dns server  +ip地址  这个ip地址是isp厂商的dns服务器地址;

(dhcp-config)#lease 0  8  0  (第一个0是天,第二个8 是8小时,第三个0是 分钟) 这个命令的意思是租约时间,即分配给主机地址的租约时间,这里设置的是8个小时;

(config)#ip dhcp excluded-address 19216831 192168310 ;

(config)#ip dhcp excluded-address 1921683101 1921683254;

这两个命令的意思是 ip地址19216831  和1921683101到1921683254  不在地址分配范围之内,也就是说分配地址的时候后,dhcp服务器不分配给主机这些地址。

你要在想配置地址的端口上执行
no
switchport
命令,然后就可以配置IP了,默认情况下,三层交换机的端口是工作在二层状态下的,执行上面的命令后就关闭了二层功能,启用三层功能,此时才可以添加地址。

可以,首先你要指定该接口为3层口
由于不知道你的设备是什么设备,我就以cisco的交换机为例
interface f0/0
no switchport 这条命令后
ip address 即可


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/13346786.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-19
下一篇 2023-07-19

发表评论

登录后才能评论

评论列表(0条)

保存