华为路由器配置入门三

华为路由器配置入门三

思路(实际工作中只需3、4、5、6即可):

1.用ENSP搭建这样一个网络结构环境(不一定是ENSP,这一步很重要。实际工作可能比这复杂,但技术不复杂,要好好屡屡,这既是理思路,也是留存文档的建立)

2.由4台PC,2台交换机,2台路由器构建

3.配置路由器:改路由器名字,配置console控制口密码,配置接口地址;(网络部分基本配置)

4.交换机配置console口密码(网络部分基本配置)

5.配置4台PC的IP地址(工作站基本配置)

6.配置2台路由器路由(网络路由联通配置)

 第一、配置路由器:改路由器名字,配置console控制口密码,配置接口地址;

1.配置第一台路由器console口登录密码(这步不能忘,防止人为通过console线直接连接登录改动参数配置):

system-view 由用户模式进入系统模式

user-interface console 0  进入console口0

set authentication password cipher abc123  配置console口登录密码

sysname Router1  将路由器名词改成Router1

[Router1]  interface GigabitEthernet0/0/1   

GigabitEthernet0/0/1]  ip address 192.168.100.254 24   //配IP地址

 

[Router1]interface GigabitEthernet 0/0/0

[Router1-GigabitEthernet0/0/0]ip address 192.168.12.1 24  //配IP地址

 

[Router1]  display ip interface brief   //查询各接口IP地址配置情况
*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.12.1/24     up      up
GigabitEthernet0/0/1    192.168.100.254/24    up      up
GigabitEthernet0/0/2    unassigned          down         down
NULL0          unassigned          up         up(s)

 

2.配置第二台路由器console口登录密码:

system-view 由用户模式进入系统模式

user-interface console 0  进入console口0

set authentication password cipher abc123  配置console口登录密码

sysname Router2  将路由器名词改成Router2

[Router2]  interface GigabitEthernet 0/0/0

[Router2-GigabitEthernet0/0/0]  ip address 192.168.12.2 24

 

[Router2]  interface GigabitEthernet 0/0/1

[Router2-GigabitEthernet0/0/1]  ip address 192.168.200.254 24

 

[Router2]  display ip interface brief    //查询各接口IP地址配置情况
*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.12.2/24         up           up
GigabitEthernet0/0/1    192.168.200.254/24        up           up
GigabitEthernet0/0/2    unassigned         down           down
NULL0          unassigned            up          up(s)

  

第二、修改交换机名称及配置console口密码

1、第一台交换机配置

system-view //由用户模式进入系统模式

sysname SW1  //修交换机提示符名称

user-interface console 0  //进入console口0

authentication-mode password  //进入密码认证模式 (这点与路由器有点不同)

set authentication password cipher abc123  //配置console口登录密码

 

2、第二台交换机配置

system-view //由用户模式进入系统模式

sysname SW2   //修交换机提示符名称

user-interface console 0  //进入console口0

authentication-mode password  //进入密码认证模式 (这点与路由器有点不同)

set authentication password cipher abc123  //配置console口登录密码

 

第三、配置4台PC的IP地址(依照设计图配置,网关为路由器的本网段接口地址;)

       

第四、配置2台路由器(打通两台路由器之间的静态路由)

1.配置第一台路由器路由表  (以PC1为出发点,本条路由为去的路由)

[Router1]  ip route-static 192.168.200.0  255.255.255.0  192.168.12.2

 注:当拿到PING包时,即从PC1电脑来的包,是要去192.168.200.*非直连网段数据包,如何处理?根据网络结构可知,路由拿到这种包,不认识,给谁?

根据协议学习到直连网段,Router1它只知道处理192.168.100.*和192.168.12.*数据包,所以只能人为指定给吓一跳:就是交给邻居的接口192.168.12.2 (next hop个人认为用我们中国的人话,应该翻成邻接口,更便于初学者理解。next door就是隔壁邻居,当然理解了啥名都行)

2.配置第二进制台路由器路由表  (以PC1为出发点,本条路由为回的路由)

[Router2]  ip route-static 192.168.100.0  255.255.255.0  192.168.12.1

注:如果不配这条静态路由,有去,回来时目标地址是192.168.100.*的数据包,数据包可以到达192.168.12.*网段,但不知给谁?就扔了。以下是从192.168.12.*网段抓的数据,能看到192.168.200.3原来的目标电脑192.168.200.3,收到ping包,已经回应,目标电脑变成源电脑就是回应的证据。但是拿到数据不知给谁?这是就知道配置这条静态路由的重要性。

这里要强调的是,相连的路由器彼此是知道领接口的MAC物理地址的(通过相关协议学习拿到的),但是路由器是不可能在没有路由表的指示的情况下(即不在人可控的情况下),将数据发出去的,要不就乱套了。

 

  

3.测试工作站之间的连通性(从PC1 ping PC3)

PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe70:2b5d
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.100.1  //当前电脑
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.100.254
Physical address..................: 54-89-98-70-2B-5D
DNS server........................:

 

PC>ping 192.168.200.3   //另一网段电脑,连通正常

Ping 192.168.200.3: 32 data bytes, Press Ctrl_C to break
From 192.168.200.3: bytes=32 seq=1 ttl=126 time=63 ms
From 192.168.200.3: bytes=32 seq=2 ttl=126 time=78 ms

--- 192.168.200.3 ping statistics ---
3 packet(s) transmitted
2 packet(s) received
33.33% packet loss
round-trip min/avg/max = 63/70/78 ms

 

注:<Router1>display  ip  routing-table

Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11

Destination/Mask       Proto    Pre    Cost     Flags       NextHop      Interface

127.0.0.0/8           Direct    0      0           D      127.0.0.1      InLoopBack0
127.0.0.1/32              Direct    0      0      D      127.0.0.1      InLoopBack0
127.255.255.255/32       Direct    0      0      D      127.0.0.1      InLoopBack0
192.168.12.0/24        Direct    0      0      D      192.168.12.1     GigabitEthernet0/0/0
192.168.12.1/32        Direct    0      0      D      127.0.0.1      GigabitEthernet0/0/0
192.168.12.255/32         Direct    0      0      D      127.0.0.1      GigabitEthernet0/0/0
192.168.100.0/24        Direct    0       0      D      192.168.100.254    GigabitEthernet0/0/1
192.168.100.254/32       Direct    0      0      D       127.0.0.1     GigabitEthernet0/0/1
192.168.100.255/32       Direct    0      0      D       127.0.0.1               GigabitEthernet0/0/1
192.168.200.0/24        Static    60     0      RD    192.168.12.2         GigabitEthernet0/0/0 (本路由器的物理出接口)
255.255.255.255/32       Direct    0      0      D        127.0.0.1              InLoopBack0

 

posted on 2022-06-03 20:21  人生不开窍  阅读(1225)  评论(0编辑  收藏  举报

导航