文章目录
- 视图
- 命令
- 搭建一个简单的网络
- 搭建http服务
- 搭建DNS解析域名服务
- 搭建DHCP服务器
视图
<Huawei> #用户视图 只能看配置信息,不能进行配置操作
<Huawei>system-view #使用这个命令进入全局配置视图
[Huawei] #全局类配置的视图
[Huawei]interface GigabitEthernet 0/0/0 #使用这个命令进入0/0/0接口视图
[Huawei-GigabitEthernet0/0/0] #接口视图
命令
CTRL+Z 切回用户视图
display ip interface brief 显示路由器接口简单的信息
sysname Huawei 更改设备名,必须进入系统视图才可以修改
ip address 192.168.1.1 255.255.255.0 配置网关
q 退出当前视图,进入上一级
undo ip 192.168.1.1 删除该条配置
display this 查看当前视图配置信息
display current-configuration 查看当前路由器缓存中的配置信息
save 将配置信息存入闪存,必须在用户视图下进行操作,断电就不会丢失信息了
display saved-configuration 查看当前闪存中的配置信息
reset saved-configuration 重置配置文件
搭建一个简单的网络
配置IP顺序
先给网关配
给路由器的两个接口配ip
<Huawei>system-view #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]interface GigabitEthernet 0/0/0 #进入0号接口
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.0 #给0号接口配ip
[Huawei-GigabitEthernet0/0/0]
Sep 9 2021 22:58:27-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q #退出0号接口
[Huawei]interface GigabitEthernet 0/0/1 #进入1号接口
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24 #给1号接口配ip
Sep 9 2021 23:00:19-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]display ip interface brief #展示接口
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/24 up up #0号接口已经通了
GigabitEthernet0/0/1 192.168.2.1/24 up up #1号接口已经通了
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[Huawei-GigabitEthernet0/0/1]
点开PC4
PC>ping 192.168.1.2 #ping另一个广播域可以通
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: bytes=32 seq=1 ttl=127 time=63 ms
From 192.168.1.2: bytes=32 seq=2 ttl=127 time=15 ms
From 192.168.1.2: bytes=32 seq=3 ttl=127 time=63 ms
From 192.168.1.2: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.1.2: bytes=32 seq=5 ttl=127 time=47 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/53/78 ms
PC>ping 192.168.2.3 #ping同一个广播域也通
Ping 192.168.2.3: 32 data bytes, Press Ctrl_C to break
From 192.168.2.3: bytes=32 seq=1 ttl=128 time=32 ms
From 192.168.2.3: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.2.3: bytes=32 seq=3 ttl=128 time=31 ms
From 192.168.2.3: bytes=32 seq=4 ttl=128 time=31 ms
From 192.168.2.3: bytes=32 seq=5 ttl=128 time=32 ms
--- 192.168.2.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/31/32 ms
搭建http服务
在http服务器上:
在Client上:
搭建DNS解析域名服务
域名解析流程:
我的电脑会先去查本地域名服务器(递归),能不能查到,能查到,就给我,不能查到:本地域名服务器就会去找(迭代),先找根域名服务器,找不到,就告诉本地服务器一个地址,然后本地服务器又去找顶级域名服务器,找不到,就告诉本地域名服务器,然后本地域名服务器又去找权限域名服务器,最后找到了,然后就告诉了我的电脑
在和Client一个域内,新建一个服务器,用来做DNS解析
在Client端:写入DNS解析服务器的地址
测试:
解析成功!
搭建DHCP服务器
把路由器作为DHCP服务器,在上面进行如下配置:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]dhcp enable #开启dhcp服务
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip pool pool_one #创建一个名叫pool_one地址池
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-pool_one]network 192.168.1.0 mask 24 #给pool_one地址池放入地址
[Huawei-ip-pool-pool_one]gateway-list 192.168.1.1 #配置网关
[Huawei-ip-pool-pool_one]dns-list 114.114.114.114 8.8.8.8 #配置dns
[Huawei-ip-pool-pool_one]q
[Huawei]ip pool pool_two #创建第二个名叫pool_two的地址池
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-pool_two]network 192.168.2.0 mask 24 #填入地址范围
[Huawei-ip-pool-pool_two]gateway-list 192.168.2.1 #网关
[Huawei-ip-pool-pool_two]dns-list 144.144.144.144 8.8.8.8 #dns
[Huawei-ip-pool-pool_two]q
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global #dhcp选择端口
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]dhcp select global #dhcp选择端口
在pc1上测试:
打开dhcp:
成功!