IP地址的配置与运用,全网通

本文展示了路由器配置过程,包括全网可达性设置、IP路由静态分配以及DHCP服务配置。在不同路由器上进行了IP地址的静态路由设置,确保了网络间的数据传输。同时,针对PC3和PC4排除特定IP地址段,以防止冲突。此外,讨论了备用路由路径的设定,以提高网络的可靠性。
摘要由CSDN通过智能技术生成

1.全网可达

 

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]st r1
Please input the username:
Please input the username:r1
Error: Unknown host or wrong IP address.
[Huawei]sy r1
[r1]inter	
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip ad	
[r1-GigabitEthernet0/0/1]ip address 12.1.1.1 24
Nov 13 2022 13:13:21-08:00 r1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r1-GigabitEthernet0/0/1]
[r1-GigabitEthernet0/0/1]
<r1>sy
Enter system view, return user view with Ctrl+Z.
[r1]ip ro	
[r1]ip route
[r1]ip route-static 23.1
                    ^
Error: Wrong parameter found at '^' position.
[r1]ip route-static 23.1.1.0 24  12.1.1.2
[r1]ip ro	
[r1]ip route
[r1]ip route-static 34.1.1.0 24  12.1.1.2
[r1]ip ro	
[r1]ip route
[r1]ip route-static 46.1.1.0 24  12.1.1.2
[r1]dis	
[r1]display  ip ro	
[r1]display  ip routing-table 
[r1]display  ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/1
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
       34.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
       46.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1
[r2]ip ro	
[r2]ip route
[r2]ip route-static 34.1.1.0 24  23.1.1.2
[r2]ip ro	
[r2]ip route
[r2]ip route-static 34.1.1.0 24 32.1.1.1
[r2]ip ro	
[r2]ip route
[r2]ip route-static 46.1.1.0 24 23.1.1.2
[r2]ip ro	
[r2]ip route
[r2]ip route-static 46.1.1.0 24  32.1.1.1
[r2]dis	
[r2]display  ip ro	
[r2]display  ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 17       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/0
       12.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.1.1.0/24  Direct  0    0           D   23.1.1.1        GigabitEthernet
0/0/1
       23.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     23.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       32.1.1.0/24  Direct  0    0           D   32.1.1.2        GigabitEthernet
0/0/2
       32.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     32.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
       34.1.1.0/24  Static  60   0          RD   23.1.1.2        GigabitEthernet
0/0/1
                    Static  60   0          RD   32.1.1.1        GigabitEthernet
0/0/2
       46.1.1.0/24  Static  60   0          RD   23.1.1.2        GigabitEthernet
0/0/1
                    Static  60   0          RD   32.1.1.1        GigabitEthernet
0/0/2
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[r3]ip ro	
[r3]ip route
[r3]ip route-static 12.1.1.0 24 23.1.1.1
[r3]ip ro	
[r3]ip route
[r3]ip route-static 12.1.1.0 24 32.1.1.2
[r3]ip ro	
[r3]ip route
[r3]ip route-static  46.1.1.0 24 34.1.1.2
[r3]dis	
[r3]display ip ro	
[r3]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 12       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Static  60   0          RD   23.1.1.1        GigabitEthernet
0/0/0
                    Static  60   0          RD   32.1.1.2        GigabitEthernet
0/0/1
       23.1.1.0/24  Direct  0    0           D   23.1.1.2        GigabitEthernet
0/0/0
       23.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     23.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       32.1.1.0/24  Direct  0    0           D   32.1.1.1        GigabitEthernet
0/0/1
       32.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     32.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[r4]ip ro	
[r4]ip route
[r4]ip route-static 23.1.1.0 24 34.1.1.1
[r4]ip ro	
[r4]ip route
[r4]ip route-static 32.1.1.0 24 34.1.1.1
[r4]ip ro	
[r4]ip route
[r4]ip route-static 12.1.1.0 24 34.1.1.1
[r4]dis	
[r4]display ip	
[r4]display ip ro	
[r4]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Static  60   0          RD   34.1.1.1        GigabitEthernet
0/0/0
       23.1.1.0/24  Static  60   0          RD   34.1.1.1        GigabitEthernet
0/0/0
       32.1.1.0/24  Static  60   0          RD   34.1.1.1        GigabitEthernet
0/0/0
       34.1.1.0/24  Direct  0    0           D   34.1.1.2        GigabitEthernet
0/0/0
       34.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     34.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       46.1.1.0/24  Direct  0    0           D   46.1.1.1        GigabitEthernet
0/0/2
       46.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     46.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[r6]ip ro	
[r6]ip route
[r6]ip route-static 34.1.1.0 24 46.1.1.1
[r6]ip ro	
[r6]ip route
[r6]ip route-static23.1.1.0 24 46.1.1.1
       ^
Error: Unrecognized command found at '^' position.
[r6]ip route-static 23.1.1.0 24 46.1.1.1
[r6]ip ro	
[r6]ip route
[r6]ip route-static 32.1.1.0 24 46.1.1.1
[r6]ip ro	
[r6]ip route
[r6]ip route-static 12.1.1.0 24 46.1.1.1
[r6]dsi	
[r6]dis	
[r6]display ip ro	
[r6]display ip routing-table 
[r6]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

       12.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       23.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       32.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       34.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       46.1.1.0/24  Direct  0    0           D   46.1.1.2        GigabitEthernet
0/0/0
       46.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     46.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0


2.pc1pc2获取指定ip

[r1]sy dhcp
[dhcp]dhcp en	
[dhcp]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[dhcp]ip po	
[dhcp]ip policy-based-route
[dhcp]ip pool 1
Info: It's successful to create an IP address pool.
[dhcp-ip-pool-1]netqu
                ^
Error: Unrecognized command found at '^' position.
[dhcp-ip-pool-1]qu
[dhcp]inter	
[dhcp]interface g0/0/0
[dhcp-GigabitEthernet0/0/0]ip ads	
[dhcp-GigabitEthernet0/0/0]ip ad	
[dhcp-GigabitEthernet0/0/0]ip address 172.16.1.1 24
Nov 13 2022 13:44:01-08:00 dhcp %%01IFNET/4/LINK_STATE(l)[0]:The line protocol I
P on the interface GigabitEthernet0/0/0 has entered the UP state. 
[dhcp-GigabitEthernet0/0/0]qu
[dhcp]ip po	
[dhcp]ip policy-based-route
[dhcp]ip pool 1
[dhcp-ip-pool-1]net	
[dhcp-ip-pool-1]netbios-type
[dhcp-ip-pool-1]network 172.16.1.0 ms	
[dhcp-ip-pool-1]network 172.16.1.0 ma	
[dhcp-ip-pool-1]network 172.16.1.0 mask 24
[dhcp-ip-pool-1]ga	
[dhcp-ip-pool-1]gateway-list 172.16.1.1
[dhcp-ip-pool-1]dns	
[dhcp-ip-pool-1]dns-list 8.8.8.8 114.114.114.114
[dhcp-ip-pool-1]st	
[dhcp-ip-pool-1]static-bind ip	
[dhcp-ip-pool-1]static-bind ip-address 172.16.1.11 mac	
[dhcp-ip-pool-1]static-bind ip-address 172.16.1.11 mac-address 5489-9817-0CD5

[dhcp-ip-pool-1]st	
[dhcp-ip-pool-1]static-bind ip	
[dhcp-ip-pool-1]static-bind ip-address 172.16.1.13 mac	
[dhcp-ip-pool-1]static-bind ip-address 172.16.1.13 mac-address 5489-9877-178B

 

 3.pc3 pc4 不能获取250到254的地址

[r6]dhcp en	
[r6]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[r6]ip po	
[r6]ip policy-based-route
[r6]ip pool 6
Info: It's successful to create an IP address pool.
[r6-ip-pool-6]net	
[r6-ip-pool-6]netbios-type
[r6-ip-pool-6]network 192.168.1.0 ma	
[r6-ip-pool-6]network 192.168.1.0 mask 24
[r6-ip-pool-6]gat	
[r6-ip-pool-6]gateway-list 
[r6-ip-pool-6]gateway-list 192.168.1.1
[r6-ip-pool-6]dns	
[r6-ip-pool-6]dns-list 8.8.8.8 114.114.114.114
[r6-ip-pool-6]qu
[r6]inter	
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]ip ad	
[r6-GigabitEthernet0/0/1]ip address 192.168.1.1 24
[r6-GigabitEthernet0/0/1]
Nov 13 2022 13:55:09-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r6-GigabitEthernet0/0/1]qu
[r6]ip po	
[r6]ip policy-based-route
[r6]ip pool6
       ^
Error: Unrecognized command found at '^' position.
[r6]ip pool 6
[r6-ip-pool-6]ex
                 ^
Error:Incomplete command found at '^' position.
[r6-ip-pool-6]ex	
[r6-ip-pool-6]excluded-ip-address 192.168.1.250 192.168.1.254
[r6-ip-pool-6]qu
[r6]inter	
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]dhcp se	
[r6-GigabitEthernet0/0/1]dhcp select gl	
[r6-GigabitEthernet0/0/1]dhcp select global 

 

 4.32.1.1.0为备份路径

 

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/0
       12.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.1.1.0/24  Direct  0    0           D   23.1.1.1        GigabitEthernet
0/0/1
       23.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     23.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       32.1.1.0/24  Direct  0    0           D   32.1.1.2        GigabitEthernet
0/0/2
       32.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     32.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
       34.1.1.0/24  Static  60   0          RD   23.1.1.2        GigabitEthernet
0/0/1
                    Static  60   0          RD   32.1.1.1        GigabitEthernet
0/0/2
       46.1.1.0/24  Static  60   0          RD   23.1.1.2        GigabitEthernet
0/0/1
                    Static  60   0          RD   32.1.1.1        GigabitEthernet
0/0/2
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1     


       12.1.1.0/24  Static  60   0          RD   23.1.1.1        GigabitEthernet
0/0/0
                    Static  60   0          RD   32.1.1.2        GigabitEthernet
0/0/1
       23.1.1.0/24  Direct  0    0           D   23.1.1.2        GigabitEthernet
0/0/0
       23.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     23.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       32.1.1.0/24  Direct  0    0           D   32.1.1.1        GigabitEthernet
0/0/1
       32.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     32.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

estination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/1
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
       34.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
       46.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1   

      12.1.1.0/24  Static  60   0          RD   34.1.1.1        GigabitEthernet
0/0/0
       23.1.1.0/24  Static  60   0          RD   34.1.1.1        GigabitEthernet
0/0/0
       32.1.1.0/24  Static  60   0          RD   34.1.1.1        GigabitEthernet
0/0/0
       34.1.1.0/24  Direct  0    0           D   34.1.1.2        GigabitEthernet
0/0/0
       34.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     34.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       46.1.1.0/24  Direct  0    0           D   46.1.1.1        GigabitEthernet
0/0/2
       46.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     46.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

       12.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       23.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       32.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       34.1.1.0/24  Static  60   0          RD   46.1.1.1        GigabitEthernet
0/0/0
       46.1.1.0/24  Direct  0    0           D   46.1.1.2        GigabitEthernet
0/0/0
       46.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     46.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

5.pc1访问pc3456

 

 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

最后的光光

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值