欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

H3C的静态路由配置

程序员文章站 2022-03-10 16:10:16
...

配置R1的路由

<RT1>

#Oct 11 20:08:28:820 2017 RT1 SHELL/4/LOGIN:

Trap 1.3.6.1.4.1.25506.2.2.1.1.3.0.1<hh3cLogIn>: login from Console

%Oct 11 20:08:28:820 2017 RT1 SHELL/5/SHELL_LOGIN: Console logged in from con0.

<RT1>

<RT1>sys

<RT1>system-view

System View: return to User View with Ctrl+Z.

[RT1]int

[RT1]interface g

[RT1]interface GigabitEthernet 0/0/0

[RT1-GigabitEthernet0/0/0]ip add

[RT1-GigabitEthernet0/0/0]ip address 192.168.1.1 24

[RT1-GigabitEthernet0/0/0]int g0/0/1

[RT1-GigabitEthernet0/0/1]ip add

[RT1-GigabitEthernet0/0/1]ip address 192.168.2.1 24

[RT1-GigabitEthernet0/0/1]dis

[RT1-GigabitEthernet0/0/1]display ip int br

[RT1-GigabitEthernet0/0/1]display ip int brief

*down: administratively down

(s): spoofing

Interface Physical Protocol IP Address Description

GigabitEthernet0/0/0 up up 192.168.1.1 GigabitEt...

GigabitEthernet0/0/1 up up 192.168.2.1 GigabitEt...

GigabitEthernet0/0/2 down down unassigned GigabitEt...

GigabitEthernet0/0/3 down down unassigned GigabitEt...

Serial0/1/0 down down unassigned Serial0/1...

Serial0/1/1 down down unassigned Serial0/1...

Serial0/1/2 down down unassigned Serial0/1...

Serial0/1/3 down down unassigned Serial0/1...

[RT1-GigabitEthernet0/0/1]display ip routing-table

Routing Tables: Public

    Destinations : 6        Routes : 6

Destination/Mask Proto Pre Cost NextHop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.1.0/24 Direct 0 0 192.168.1.1 GE0/0/0

192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.2.0/24 Direct 0 0 192.168.2.1 GE0/0/1

192.168.2.1/32 Direct 0 0 127.0.0.1 InLoop0

[RT1-GigabitEthernet0/0/1]

[RT1-GigabitEthernet0/0/1]quit

[RT1]ip route

[RT1]ip route-

[RT1]ip route-static 192.168.3.0 24 192.168.2.2

[RT1]ip route

[RT1]ip route-s

[RT1]ip route-static 192.168.4.0 24 192.168.3.2

[RT1]dis

[RT1]display ip route

[RT1]display ip routes

[RT1]display ip route-

[RT1]display ip route-

[RT1]display ip route-s

[RT1]display ip route-t

[RT1]display ip rout

[RT1]display ip routing-table

Routing Tables: Public

    Destinations : 8        Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.1.0/24 Direct 0 0 192.168.1.1 GE0/0/0

192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.2.0/24 Direct 0 0 192.168.2.1 GE0/0/1

192.168.2.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.3.0/24 Static 60 0 192.168.2.2 GE0/0/1

192.168.4.0/24 Static 60 0 192.168.3.2 GE0/0/1

配置R2的路由

<RT2>

#Oct 11 20:18:52:357 2017 RT2 SHELL/4/LOGIN:

Trap 1.3.6.1.4.1.25506.2.2.1.1.3.0.1<hh3cLogIn>: login from Console

%Oct 11 20:18:52:357 2017 RT2 SHELL/5/SHELL_LOGIN: Console logged in from con0.

<RT2>sys

<RT2>system-view

System View: return to User View with Ctrl+Z.

[RT2]int

[RT2]interface g

[RT2]interface GigabitEthernet 0/0/0

[RT2-GigabitEthernet0/0/0]ip add

[RT2-GigabitEthernet0/0/0]ip address 192.168.2.2 24

[RT2-GigabitEthernet0/0/0]undo sh

Interface GigabitEthernet0/0/0 is not shut down

[RT2-GigabitEthernet0/0/0]int

[RT2-GigabitEthernet0/0/0]int g

[RT2-GigabitEthernet0/0/0]int g0/0/1

[RT2-GigabitEthernet0/0/1]ip add

[RT2-GigabitEthernet0/0/1]ip address 192.168.3.1 24

[RT2-GigabitEthernet0/0/1]undo sh

Interface GigabitEthernet0/0/1 is not shut down

[RT2-GigabitEthernet0/0/1]dis

[RT2-GigabitEthernet0/0/1]display ip int br

[RT2-GigabitEthernet0/0/1]display ip int brief

*down: administratively down

(s): spoofing

Interface Physical Protocol IP Address Description

GigabitEthernet0/0/0 up up 192.168.2.2 GigabitEt...

GigabitEthernet0/0/1 up up 192.168.3.1 GigabitEt...

GigabitEthernet0/0/2 down down unassigned GigabitEt...

GigabitEthernet0/0/3 down down unassigned GigabitEt...

Serial0/1/0 down down unassigned Serial0/1...

Serial0/1/1 down down unassigned Serial0/1...

Serial0/1/2 down down unassigned Serial0/1...

Serial0/1/3 down down unassigned Serial0/1...

[RT2-GigabitEthernet0/0/1]dis

[RT2-GigabitEthernet0/0/1]display ip route

[RT2-GigabitEthernet0/0/1]display ip rout

[RT2-GigabitEthernet0/0/1]display ip routing-table

Routing Tables: Public

    Destinations : 6        Routes : 6

Destination/Mask Proto Pre Cost NextHop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.2.0/24 Direct 0 0 192.168.2.2 GE0/0/0

192.168.2.2/32 Direct 0 0 127.0.0.1 InLoop0

192.168.3.0/24 Direct 0 0 192.168.3.1 GE0/0/1

192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0

[RT2-GigabitEthernet0/0/1]

[RT2-GigabitEthernet0/0/1]quit

[RT2]ip rout

[RT2]ip route-s

[RT2]ip route-static 192.168.1.0 24 192.168.2.1

[RT2]ip route

[RT2]ip route-s

[RT2]ip route-static 192.168.4.0 24 192.168.3.2

[RT2]dis

[RT2]display ip

[RT2]display ip r

[RT2]display ip routing-table

Routing Tables: Public

    Destinations : 8        Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.1.0/24 Static 60 0 192.168.2.1 GE0/0/0

192.168.2.0/24 Direct 0 0 192.168.2.2 GE0/0/0

192.168.2.2/32 Direct 0 0 127.0.0.1 InLoop0

192.168.3.0/24 Direct 0 0 192.168.3.1 GE0/0/1

192.168.3.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.4.0/24 Static 60 0 192.168.3.2 GE0/0/1

配置R3的路由

<RT3>

<RT3>sys

<RT3>system-view

System View: return to User View with Ctrl+Z.

[RT3]int

[RT3]interface g

[RT3]interface GigabitEthernet 0/0/0

[RT3-GigabitEthernet0/0/0]ip add

[RT3-GigabitEthernet0/0/0]ip address 192.168.3.2 24

[RT3-GigabitEthernet0/0/0]int

[RT3-GigabitEthernet0/0/0]int g0/0/1

[RT3-GigabitEthernet0/0/1]ip add

[RT3-GigabitEthernet0/0/1]ip address 192.168.4.1 24

[RT3-GigabitEthernet0/0/1]undo sh

Interface GigabitEthernet0/0/1 is not shut down

[RT3-GigabitEthernet0/0/1]dis

[RT3-GigabitEthernet0/0/1]display ip route

[RT3-GigabitEthernet0/0/1]display ip int br

[RT3-GigabitEthernet0/0/1]display ip int brief

*down: administratively down

(s): spoofing

Interface Physical Protocol IP Address Description

GigabitEthernet0/0/0 up up 192.168.3.2 GigabitEt...

GigabitEthernet0/0/1 up up 192.168.4.1 GigabitEt...

GigabitEthernet0/0/2 down down unassigned GigabitEt...

GigabitEthernet0/0/3 down down unassigned GigabitEt...

Serial0/1/0 down down unassigned Serial0/1...

Serial0/1/1 down down unassigned Serial0/1...

Serial0/1/2 down down unassigned Serial0/1...

Serial0/1/3 down down unassigned Serial0/1...

[RT3-GigabitEthernet0/0/1]dis

[RT3-GigabitEthernet0/0/1]display ip route

[RT3-GigabitEthernet0/0/1]display ip rout

[RT3-GigabitEthernet0/0/1]display ip routing-table

Routing Tables: Public

    Destinations : 6        Routes : 6

Destination/Mask Proto Pre Cost NextHop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.3.0/24 Direct 0 0 192.168.3.2 GE0/0/0

192.168.3.2/32 Direct 0 0 127.0.0.1 InLoop0

192.168.4.0/24 Direct 0 0 192.168.4.1 GE0/0/1

192.168.4.1/32 Direct 0 0 127.0.0.1 InLoop0

[RT3-GigabitEthernet0/0/1]quit

[RT3]ip route

[RT3]ip route-s

[RT3]ip route-static 192.168.2.0 24 192.168.3.1

[RT3]ip route

[RT3]ip route-s

[RT3]ip route-static 192.168.1.0 24 192.168.2.1

[RT3]dis

[RT3]display ip rout

[RT3]display ip routing-table

Routing Tables: Public

    Destinations : 8        Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.1.0/24 Static 60 0 192.168.2.1 GE0/0/0

192.168.2.0/24 Static 60 0 192.168.3.1 GE0/0/0

192.168.3.0/24 Direct 0 0 192.168.3.2 GE0/0/0

192.168.3.2/32 Direct 0 0 127.0.0.1 InLoop0

192.168.4.0/24 Direct 0 0 192.168.4.1 GE0/0/1

192.168.4.1/32 Direct 0 0 127.0.0.1 InLoop0

测试两台PC机的连通