赞
踩
#进入命令行控制模式
system-view
# 对设备命名
sysname coreswitch1
# 创建VLAN
vlan 2
quit
# 将端口指定到VLAN中
interface GigabitEthernet 0/0/1
port link-type access
port default vlan 2
quit
如下图PC1不能和PC2通信,PC1能和PC3通信,PC2不能和PC4通信
如下图PC1不能和PC2通信,PC1能和PC3通信,PC2能和PC4通信
涉及的命令(用于参考)
# 创建端口组1,把端口1到端口10都加入到端口组中,然后把组1中的端口都加入到Vlan2中
port-group 1
group-member GigabitEthernet0/0/1 to GigabitEthernet 0/0/10
port link-type access
# vlan2不能不存在(不存在则创建),不然会报错
port default vlan 2
quit
system-view
sysname R1
#进入端口
interface GigabitEthernet 0/0/1
#配置端口ip地址
ip address 192.168.1.254 24
quit
interface GigabitEthernet 0/0/0
ip address 192.168.2.1 24
quit
#配置静态路由
ip route-static 192.168.3.0 24 192.168.2.2
system-view
sysname R2
interface GigabitEthernet 0/0/1
ip address 192.168.3.254 24
quit
interface GigabitEthernet 0/0/0
ip address 192.168.2.2 24
quit
#配置静态路由
ip route-static 192.168.1.0 24 192.168.2.1
PC1
PC2
AR1
AR2
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
AR1
system-view
sysname R1
interface GigabitEthernet 0/0/1
ip address 192.168.1.254 24
quit
interface GigabitEthernet 0/0/0
ip address 192.168.2.1 24
quit
#动态路由配置
#数字表示进程号
rip 1
network 192.168.1.0
network 192.168.2.0
quit
system-view
sysname R2
interface GigabitEthernet 0/0/1
ip address 192.168.3.254 24
quit
interface GigabitEthernet 0/0/0
ip address 192.168.2.2 24
quit
#动态路由配置
#数字表示进程号
rip 1
network 192.168.2.0
network 192.168.3.0
quit
PC1
PC2
AR1
AR2
system-view sysname R1 interface GigabitEthernet 0/0/1 ip address 192.168.1.254 24 quit interface GigabitEthernet 0/0/0 ip address 192.168.2.1 24 quit #动态路由配置 #数字表示进程号 ospf 1 #数字表示网络区域 area 0 network 192.168.1.0 0.0.0.255 area 1 network 192.168.2.0 0.0.0.255 quit quit
system-view
sysname R2
interface GigabitEthernet 0/0/1
ip address 192.168.3.254 24
quit
interface GigabitEthernet 0/0/0
ip address 192.168.2.2 24
quit
ospf 1
area 1
network 192.168.2.0 0.0.0.255
area 0
network 192.168.3.0 0.0.0.255
quit
quit
PC1
PC2
AR1
AR2
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
SW1
system-view sysname SW1 vlan bat 10 20 30 interface GigabitEthernet 0/0/2 port link-type access port default vlan 10 interface GigabitEthernet 0/0/3 port link-type access port default vlan 20 interface GigabitEthernet 0/0/4 port link-type access port default vlan 30 interface GigabitEthernet 0/0/1 #设置连接方式为trunk port link-type trunk #允许所有的vlan通过 port trunk allow-pass vlan all quit
system-view sysname R1 interface GigabitEthernet 0/0/0.1 ip address 192.168.1.254 24 dot1q termination vid 10 # 开启广播功能 arp broadcast enable interface GigabitEthernet 0/0/0.2 ip address 192.168.2.254 24 #设置Vlan的ID dot1q termination vid 20 arp broadcast enable interface GigabitEthernet 0/0/0.3 ip address 192.168.3.254 24 dot1q termination vid 30 arp broadcast enable
PC1
PC2
PC3
SW1
AR1
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
SW1
system-view
sysname SW1
vlan batch 10 20
interface Vlanif 10
ip address 192.168.1.254 24
interface Vlanif 20
ip address 192.168.2.254 24
interface GigabitEthernet 0/0/1
port link-type trunk
port trunk allow-pass vlan all
quit
system-view
sysname SW2
vlan batch 10 20
interface GigabitEthernet 0/0/1
port link-type trunk
port trunk allow-pass vlan all
interface GigabitEthernet 0/0/2
port link-type access
port default vlan 10
interface GigabitEthernet 0/0/3
port link-type access
port default vlan 20
quit
运行命令截图
SW1
SW2
运行成功截图
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
R1
system-view
sysname R1
user-interface console 0
#设置密码为一二三,同时密码为密文
set authentication password cipher 123
#设置用户级别
user privilege level 3
quit
R1
PC1
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
R1
system-view
sysname R1
user-interface console 0
authentication-mode aaa
quit
aaa
local-user huawei password cipher 123
local-user huawei privilege level 3
quit
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
R1(先运行R2的代码,因为是用R1连接R2)
system-view
sysname R1
interface GigabitEthernet 0/0/0
ip address 192.168.1.1 24
quit
quit
telnet 192.168.1.2
system-view
sysname R2
interface GigabitEthernet 0/0/0
ip address 192.168.1.2 24
quit
#零是开始的,四为结束的,意思为五个会话
user-interface vty 0 4
set authentication password cipher 123
user privilege level 3
quit
运行命令截图
R1
R2
运行成功截图
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
R1
system-view sysname R1 #开启 dhcp enable #创建地址池 ip pool 1 network 192.168.1.0 mask 255.255.255.0 #配置网关 gateway-list 192.168.1.254 #排除这个区间的地址不分配 excluded-ip-address 192.168.1.2 192.168.1.253 dns-list 8.8.8.8 #定义使用周期为两天 lease day 2 quit interface GigabitEthernet 0/0/0 ip address 192.168.1.254 24 #全局配置 dhcp select global quit
运行命令截图
PC1
运行成功截图
最后配置形成的拓扑图
每个设备需要运行的命令(可直接复制执行)
SW1
system-view
sysname SW1
interface Eth-Trunk 1
#配置为手工方式
mode manual load-balance
#配置链路聚合的物理端口
trunkport gigabitethernet 0/0/1 to 0/0/2
port link-type trunk
port trunk allow-pass vlan all
quit
system-view
sysname SW2
interface Eth-Trunk 1
mode manual load-balance
trunkport gigabitethernet 0/0/1 to 0/0/2
port link-type trunk
port trunk allow-pass vlan all
quit
运行命令截图
运行成功截图
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。