交换机初始化配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了交换机初始化配置相关的知识,希望对你有一定的参考价值。
参考技术A 1.设置时区 <huawei> clock timezone BJ add 08:002.设置时间 <huawei> clock datetime xx:xx:xx xx-xx-xx
1.进入系统视图 <huawei> system-view
2.设置主机名 [huawei] sysname xxx
3.进入用户视图 [xxx] quit
4.保存配置 <xxx> save
1.设置登陆前的欢迎消息 [ huawei] header login information “hello”
2..设置登陆后的欢迎消息 [ huawei] header login information “hi”
1.进入终端线配置视图 [huawei] user- interface console 0
2.设置终端登录用户级别 [huawei-ui-console0]user privilege level 15 //设置终端用户级别为15级
3.设置终端用户验证方式
(1)不验证 [huawei-ui-console0]authentication-mode none
(2)密码验证
[huawei-ui-console0] authentication-mode password
[huawei-ui-console0] set authentication password cipher/simple XXXXX //设置明文(simple)或密文(cipher)保存的密码XXXXX
(3)用户名+密码验证
[huawei-ui-console0]authentication-mode aaa //设置aaa认证
[huawei-ui-console0]aaa //进入aaa配置
[huawei-aaa]local-user huawei service-type terminal //创建终端登录用户huawei
[huawei-aaa]llocal-user hauwei privilege level <0-15> //设置终端登录用户级别
[huawei-aaa]local-user huawei password cipher/simple xxx //设置终端用户huawei明文或密文密码xxx
(4)设置超时时间 [huawei-ui-console0]idle-timeout 0 5 //设置超时时间为5秒
1.进入远程登录配置视图
[huawei] user-interface vty 0 4 //开启5条虚拟线路(同时允许5用户远程访问设备)
[huawei-ui-vty0]
2.设置远程登录用户级别 [huawei-ui-vty0]user privilege level 15 //设置远程登录用户级别为15级
3.设置终端用户验证方式
(1)不验证 [huawei-ui-vty0] authentication-mode none
(2)密码验证
[huawei-ui-vty0] authentication-mode password
[huawei-ui-vty0] set authentication password cipher/simple XXXXX //设置明文(simple)或密文(cipher)保存的密码XXXXX
(3)用户名+密码验证
[huawei-ui-vty0] authentication-mode aaa //设置aaa认证
[huawei-ui-vty0] aaa //进入aaa配置
[huawei-aaa] local-user huawei service-type telnet //创建远程登录用户huawei
[huawei-aaa] local-user hauwei privilege level <0-15> //设置远程登录用户级别
[huawei-aaa] local-user huawei password cipher/simple huawei //设置远程用户huawei明文或密文密码huawei
4.设置超时时间 [huawei-ui-vty0] idle-timeout 0 5 //设置超时时间为5秒
1.进入管理端口配置视图
[huawei] interface vlan 1[huawei-Vlanif1]
2.清除已有IP地址 [huawei-Vlanif1] undo ip address //清空原有的IP地址
3.设置管理VLAN地址(可二选一)
[huawei-Vlanif1] ip address 192.168.1.100 24 //设置IP地址并指定地址中的网络位(网络前缀)[huawei-Vlanif1] ip address 192.168.1.100 255.255.255.0 //设置IP地址并指定子网掩码
1.显示当前主机ip地址 ipconfig
2.显示交换机管理ip [huawei] display ip inter brief //显示当前设备端口的简要信息
3.测试网络连通性
ping -n 设置发送测试护具包的数量
ping -t 设置测试发送数据包永远不停止,直到使用ctrl+c
ping -l 设置发送测试数据包的大小
<huawei> save
The current configuration will be written to the device.Are you sure to continue?[Y/N] y
<huawei> display current-configuration //查看当前配置
DHCP中继服务
一:实验环境
1.1: 华为ensp软件
1.2: PC机和路由器及交换机
初始化状态的PC机和初始化状态的路由器,交换机
二.实验需求,实现全网互通且DHCP中继在R4上
三:实验过程
3.1:配置设备
在ensp中,将PC机和路由器及交换机准备好,并启动。
3.2配置思路
配置R1
1)配置接口
Int g0/0/0 ; ip add 12.0.0.1 24 ;un sh
Int g0/0/2 ; ip add 14.0.0.1 24 ;un sh
2)配置单臂路由及中继
dhcp enable #系统视图下命令
int g0/0/1.10 ;
ip add 192.168.10.1;
d t v 10 ;
a b e;
dhcp select relay; #配置中继模式
dhcp relay server-ip 14.0.0.2; #配置中继地址
un sh
int g0/0/1.20 ;
ip add 192.168.20.1;
d t v 20 ;a b e;dhcp select relay;
dhcp relay server-ip 14.0.0.2;
un sh
3)配置静态/默认路由ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
配置R2
1) 配置接口
int g0/0/0
ip add 12.0.0.2 24
un sh
int g0/0/1
ip add 15.0.0.1 24
un sh;q
2)配置开启中继模式
dhcp enable
dhcp select relay
dhcp relay server-ip 14.0.0.2 ##指定中继地址
3)配置静态/默认路由(运营商端)
ip route-static 14.0.0.0 24 12.0.0.1
ip route-static 192.168.10.0 24 12.0.0.1
ip route-static 192.168.20.0 24 12.0.0.1
配置R4,提供中继服务
1)配置路由接口
Int g0/0/0
Ip add 14.0.0.2 24
un sh
2)配置DHCP中继服务
dhcp enable
int g0/0/0
ip add 14.0.0.2 24
dhcp select global #在接口上声明去全局模式找配置的DHCP服务
undo sh
配置中继池子,一个网段配置一个
ip pool DHCP15 #进DHCP15,配置PC5 15网段的池子
network 15.0.0.0 mask 24
gateway-list 15.0.0.1
dns-list 8.8.8.8 2.2.2.2
excluded-ip-address 15.0.0.100 15.0.0.254
static-bind ip-address 15.0.0.88 mac-address 5489-98C3-6B6F
ip pool DHCPvlan10 #进DHCPvlan10配置10.0网段池子
network 192.168.10.0 mask 24
gateway-list 192.168.10.1
dns-list 8.8.8.8 2.2.2.2
ip pool DHCPvlan20 #进DHCPvlan20配置20.0网段池子
network 192.168.20.0 mask 24
gateway-list 192.168.20.1
dns-list 8.8.8.8 2.2.2.2
3)配置路由ip route-static 0.0.0.0 0.0.0.0 14.0.0.1
3.3 配置SW1交换机
[SW1] vlan batch 10 20
[SW1] interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 10
[SW1-Ethernet0/0/1]un sh
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]un sh
[SW1] interface Ethernet0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 10
[SW1-Ethernet0/0/3]un sh
[SW1]interface Ethernet0/0/4
[SW1-Ethernet0/0/4]port link-type access
[SW1-Ethernet0/0/4]port default vlan 20
[SW1-Ethernet0/0/4]un sh
[SW1-Ethernet0/0/4]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]un sh
3.4配置R1路由器
3.4.1 配置单臂路由
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 14.0.0.1 24
[R1-GigabitEthernet0/0/2]un sh
[R1-GigabitEthernet0/0/2]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]un sh
[R1]dhcp enable
[R1]int GigabitEthernet 0/0/1.10
[R1-GigabitEthernet0/0/1.10]d t v 10
[R1-GigabitEthernet0/0/1.10]ip address 192.168.10.1 24
[R1-GigabitEthernet0/0/1.10]a b e
[R1-GigabitEthernet0/0/1.10]un sh
[R1-GigabitEthernet0/0/1.10]int GigabitEthernet 0/0/1.20
[R1-GigabitEthernet0/0/1.20]d t v 20
[R1-GigabitEthernet0/0/1.20]ip address 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]a b e
[R1-GigabitEthernet0/0/1.20]un sh
3.4.2配置DHCP中继服务(指定中继路由地址)
[R1-GigabitEthernet0/0/1.20]int GigabitEthernet 0/0/1.10
[R1-GigabitEthernet0/0/1.10]dhcp select relay #选择中继模式
[R1-GigabitEthernet0/0/1.10]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.10]un sh
[R1-GigabitEthernet0/0/1.10]int GigabitEthernet 0/0/1.20
[R1-GigabitEthernet0/0/1.20]dhcp select relay
[R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.20]un sh
3.4.3配置静态路由[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
3.5 配置R2路由器
3.5.1配置接口
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]un sh
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]un sh
3.5.2配置中继服务
[R2]dhcp enable
[R2-GigabitEthernet0/0/1]dhcp select relay
[R2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2
[R2-GigabitEthernet0/0/1]undo sh
[R2-GigabitEthernet0/0/1]q
3.5.3配置路由
[R2]ip route-static 14.0.0.0 24 12.0.0.1
[R2]ip route-static 192.168.10.0 24 12.0.0.1
[R2]ip route-static 192.168.20.0 24 12.0.0.1
3.6 配置R4路由器
3.6.1配置路由接口
Int g0/0/0
Ip add 14.0.0.2 24
un sh
3.6.2配置DHCP中继服务
[R4]dhcp enable #系统模式声明启用DHCP
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 14.0.0.2 24
[R4-GigabitEthernet0/0/0]dhcp select global #在接口上声明去全局模式找配置的DHCP
3.6.3配置的DHCP服务
[R4-GigabitEthernet0/0/0]undo sh
[R4-GigabitEthernet0/0/0]q
[R4]ip pool DHCP15
[R4-ip-pool-DHCP15]network 15.0.0.0 mask 24
[R4-ip-pool-DHCP15]gateway-list 15.0.0.1
[R4-ip-pool-DHCP15]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCP15]excluded-ip-address 15.0.0.100 15.0.0.254
[R4-ip-pool-DHCP15]static-bind ip-address 15.0.0.88 mac-address 5489-98C3-6B6F #此处MAC地址配的是PC5的mac,且配置分配15.0.0.88地址
[R4-ip-pool-DHCP15]dis this
ip pool DHCP15
gateway-list 15.0.0.1
network 15.0.0.0 mask 255.255.255.0
static-bind ip-address 15.0.0.88 mac-address 5489-98c3-6b6f
excluded-ip-address 15.0.0.100 15.0.0.254
dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCP15]q
[R4]ip pool DHCPvlan10
[R4-ip-pool-DHCPvlan10]network 192.168.10.0 mask 24
[R4-ip-pool-DHCPvlan10]gateway-list 192.168.10.1
[R4-ip-pool-DHCPvlan10]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCPvlan10]ip pool DHCPvlan20
[R4-ip-pool-DHCPvlan20]network 192.168.20.0 mask 24
[R4-ip-pool-DHCPvlan20]gateway-list 192.168.20.1
[R4-ip-pool-DHCPvlan20]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCPvlan20]q
[R4]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1
3.7 检查是否满足需求
PC5已经获取指定配置的IP
以上是关于交换机初始化配置的主要内容,如果未能解决你的问题,请参考以下文章