实验
实验要求:
在R1配置默认路由,R2,R3配置静态路由,使得内网1.0和2.0网段可以访问server。
配置步骤:
(1)配置PC1和PC2以及服务器server的IP地址和子网掩码
①配置PC1的IP为192.168.1.10,子网掩码为255.255.255.0,网关为192.168.1.1
②配置PC2的IP为192.168.2.10,子网掩码为255.255.255.0,网关为192.168.2.1
③配置server的IP为10.0.0.2,子网掩码为255.0.0.0,网关为10.0.0.1
(2)配置路由器R1
①进入系统视图
②改路由器名称为R1
③接口IP设置
接口g0/0/0 ip address 192.168.1.1 24
接口g0/0/1 ip address 192.168.2.1 24
接口g0/0/2 ip address 192.168.10.1 24
④设置默认路由
ip route-static 0.0.0.0 0 192.168.10.2
⑤保存设置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
Apr 5 2021 17:00:18-08:00 R1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.2.1 24
Apr 5 2021 17:00:51-08:00 R1 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]interface g0/0/2
[R1-GigabitEthernet0/0/2]ip address 192.168.10.1 24
[R1-GigabitEthernet0/0/2]
Apr 5 2021 17:01:27-08:00 R1 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R1-GigabitEthernet0/0/2]quit
[R1]ip route-static 0.0.0.0 0 192.168.10.2
[R1]quit
<R1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<R1>
(3)配置路由器R2
①进入系统视图
②改路由器名称为R2
③接口IP设置
接口g0/0/0 ip address 192.168.10.2 24
接口g0/0/1 ip address 192.168.20.1 24
④设置静态路由
ip route-static 10.0.0.0 8 192.168.20.2
ip route-static 192.168.1.0 24 192.168.10.1
ip route-static 192.168.2.0 24 192.168.10.1
⑤保存设置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.10.2 24
Apr 5 2021 17:06:21-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.20.1 24
Apr 5 2021 17:06:47-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]quit
[R2]ip route-static 10.0.0.0 8 192.168.20.2
[R2]ip route-static 192.168.1.0 24 192.168.10.1
[R2]ip route-static 192.168.2.0 24 192.168.10.1
[R2]quit
<R2>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<R2>
(4)配置路由器R3
①进入系统视图
②改路由器名称为R3
③接口IP设置
接口g0/0/0 ip address 192.168.20.2 24
接口g0/0/1 ip address 10.0.0.1 8
④设置静态路由
ip route-static 192.168.1.0 24 192.168.20.1
ip route-static 192.168.2.0 24 192.168.20.1
⑤保存设置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.20.2 24
Apr 5 2021 17:15:19-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 10.0.0.1 8
Apr 5 2021 17:16:03-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]quit
[R3]ip route-static 192.168.1.0 24 192.168.20.1
[R3]ip route-static 192.168.2.0 24 192.168.20.1
[R3]quit
<R3>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<R3>;
(5)主机PC1和主机PC2ping通服务器server测试
①PC1 ping sercer 测试
ping 10.0.0.2
②PC2 ping sercer 测试
ping 10.0.0.2