静态综合实验

一、预想好需要配置的IP地址

    192.168.1.0/24

            192.168.1.0/27——骨干

            192.168.1.0/30

            192.168.1.4/30

            192.168.1.8/30

            192.168.1.12/30

            192.168.1.16/30

            192.168.1.20/30

            192.168.1.24/30

            192.168.1.28/30

    192.168.1.32/27——R1

            192.168.1.32/28

            192.168.1.48/28

    192.168.1.64/27——R2

            192.168.1.64/28

            192.168.1.80/28

    192.168.1.96/27——R3

    192.168.1.128/27——R4

            192.168.1.128/28

            192.168.1.144/28

    192.168.1.160/27——R5

二、配置IP地址

#改设备名称
system-view
[Huawei]sysname R1
#配IP地址
[R1]user-interface console 0 #永不超时
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]q

[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[R1-GigabitEthernet0/0/1]q

[R1]interface loopback 0
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]interface loopback 1
[R1-LoopBack1]ip address 192.168.1.49 28
[R1-LoopBack1]q

[R1]display ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/30 up up
GigabitEthernet0/0/1 192.168.1.5/30 up up
LoopBack0 192.168.1.33/28 up up(s)
LoopBack1 192.168.1.49/28 up up(s)
NULL0 unassigned up up(s)
[R2]display ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.2/30 up up
GigabitEthernet0/0/1 192.168.1.9/30 up up
LoopBack0 192.168.1.65/28 up up(s)
LoopBack1 192.168.1.81/28 up up(s)
NULL0 unassigned up up(s)
[R3]display ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.6/30 up up
GigabitEthernet0/0/1 192.168.1.13/30 up up
GigabitEthernet0/0/2 192.168.1.97/27 up up
NULL0 unassigned up up(s)
[R4]display ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.10/30 up up
GigabitEthernet0/0/1 192.168.1.17/30 up up
GigabitEthernet0/0/2 192.168.1.14/30 up up
GigabitEthernet4/0/0 192.168.1.21/30 up up
LoopBack0 192.168.1.129/28 up up(s)
LoopBack1 192.168.1.145/28 up up(s)
NULL0 unassigned up up(s)
[R5]display ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.18/30 up up
GigabitEthernet0/0/1 12.0.0.1/24 up up
GigabitEthernet0/0/2 192.168.1.22/30 up up
LoopBack0 192.168.1.161/28 up up(s)
NULL0 unassigned up up(s)
[R6]display ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.2/24 up up
LoopBack0 1.1.1.1/24 up up(s)
NULL0 unassigned up up(s)
三、完成任务四:PC1、PC2通过DHCP自动获取IP地址
[R3]dhcp enable
[R3]ip pool aaa
[R3-ip-pool-aaa]network 192.168.1.96 mask 27
[R3-ip-pool-aaa]gateway-list 192.168.1.97
[R3-ip-pool-aaa]dns-list 8.8.8.8
[R3-ip-pool-aaa]q
[R3]int g 0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
[R3-GigabitEthernet0/0/2]q
PC>ipconfig

Link local IPv6 address…: fe80::5689:98ff:fe14:5cc9
IPv6 address…: :: / 128
IPv6 gateway…: ::
IPv4 address…: 192.168.1.126
Subnet mask…: 255.255.255.224
Gateway…: 192.168.1.97
Physical address…: 54-89-98-14-5C-C9
DNS server…: 8.8.8.8
PC>ipconfig

Link local IPv6 address…: fe80::5689:98ff:fe3e:5ef7
IPv6 address…: :: / 128
IPv6 gateway…: ::
IPv4 address…: 192.168.1.125
Subnet mask…: 255.255.255.224
Gateway…: 192.168.1.97
Physical address…: 54-89-98-3E-5E-F7
DNS server…: 8.8.8.8
四、完成任务五:选路最佳,路由表尽量小
[R1]ip route-static 0.0.0.0 0 192.168.1.2
[R1]ip route-static 0.0.0.0 0 192.168.1.6

[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.8 30 192.168.1.2
[R1]ip route-static 192.168.1.12 30 192.168.1.6
[R1]ip route-static 192.168.1.96 27 192.168.1.6

[R1]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib

Public routing table : Static
Destinations : 5 Routes : 6 Configured Routes : 6

Static routing table status :
Destinations : 5 Routes : 6

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  60   0          RD   192.168.1.2     GigabitEthernet

0/0/0
Static 60 0 RD 192.168.1.6 GigabitEthernet
0/0/1
192.168.1.8/30 Static 60 0 RD 192.168.1.2 GigabitEthernet
0/0/0
192.168.1.12/30 Static 60 0 RD 192.168.1.6 GigabitEthernet
0/0/1
192.168.1.64/27 Static 60 0 RD 192.168.1.2 GigabitEthernet
0/0/0
192.168.1.96/27 Static 60 0 RD 192.168.1.6 GigabitEthernet
0/0/1

Static routing table status :
Destinations : 0 Routes : 0
[R2]ip route-static 0.0.0.0 0 192.168.1.10

[R2]ip route-static 192.168.1.96 27 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.1
[R2]ip route-static 192.168.1.4 30 192.168.1.1
[R2]ip route-static 192.168.1.32 27 192.168.1.1

[R2]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib

Public routing table : Static
Destinations : 4 Routes : 5 Configured Routes : 5

Static routing table status :
Destinations : 4 Routes : 5

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  60   0          RD   192.168.1.10    GigabitEthernet

0/0/1
192.168.1.4/30 Static 60 0 RD 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.32/27 Static 60 0 RD 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.96/27 Static 60 0 RD 192.168.1.10 GigabitEthernet
0/0/1
Static 60 0 RD 192.168.1.1 GigabitEthernet
0/0/0

Static routing table status :
Destinations : 0 Routes : 0
[R3]ip route-static 0.0.0.0 0 192.168.1.14

[R3]ip route-static 192.168.1.64 27 192.168.1.14
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[R3]ip route-static 192.168.1.32 27 192.168.1.5

[R3]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib

Public routing table : Static
Destinations : 4 Routes : 5 Configured Routes : 5

Static routing table status :
Destinations : 4 Routes : 5

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  60   0          RD   192.168.1.14    GigabitEthernet

0/0/1
192.168.1.0/30 Static 60 0 RD 192.168.1.5 GigabitEthernet
0/0/0
192.168.1.32/27 Static 60 0 RD 192.168.1.5 GigabitEthernet
0/0/0
192.168.1.64/27 Static 60 0 RD 192.168.1.14 GigabitEthernet
0/0/1
Static 60 0 RD 192.168.1.5 GigabitEthernet
0/0/0

Static routing table status :
Destinations : 0 Routes : 0
[R4]ip route-static 0.0.0.0 0 192.168.1.18
[R4]ip route-static 0.0.0.0 0 192.168.1.22 preference 70 #完成任务八

[R4]ip route-static 192.168.1.64 27 192.168.1.9
[R4]ip route-static 192.168.1.96 27 192.168.1.13
[R4]ip route-static 192.168.1.0 30 192.168.1.9
[R4]ip route-static 192.168.1.4 30 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.9
[R4]ip route-static 192.168.1.32 27 192.168.1.13

[R4]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib

Public routing table : Static
Destinations : 6 Routes : 8 Configured Routes : 8

Static routing table status :
Destinations : 6 Routes : 7

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  60   0          RD   192.168.1.18    GigabitEthernet

0/0/1
192.168.1.0/30 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
192.168.1.4/30 Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/2
192.168.1.32/27 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/2
192.168.1.64/27 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
192.168.1.96/27 Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/2

Static routing table status :
Destinations : 1 Routes : 1

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  70   0          R    192.168.1.22    GigabitEthernet

4/0/0
[R5]ip route-static 0.0.0.0 0 12.0.0.2

[R5]ip route-static 192.168.1.0 24 192.168.1.17
[R5]ip route-static 192.168.1.0 24 192.168.1.21 preference 70 #完成任务八

[R5]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib

Public routing table : Static
Destinations : 2 Routes : 3 Configured Routes : 3

Static routing table status :
Destinations : 2 Routes : 2

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  60   0          RD   12.0.0.2        GigabitEthernet

0/0/1
192.168.1.0/24 Static 60 0 RD 192.168.1.17 GigabitEthernet
0/0/0

Static routing table status :
Destinations : 1 Routes : 1

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.1.0/24  Static  70   0          R    192.168.1.21    GigabitEthernet

0/0/2
五、检验
[R1]ping 192.168.1.145
PING 192.168.1.145: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.1.145: bytes=56 Sequence=2 ttl=254 time=70 ms
Reply from 192.168.1.145: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.1.145: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.1.145: bytes=56 Sequence=5 ttl=254 time=30 ms

— 192.168.1.145 ping statistics —
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/37/70 ms
[R5]ping 192.168.1.65
PING 192.168.1.65: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=254 time=40 ms

— 192.168.1.65 ping statistics —
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/35/50 ms
六、解决环路
[R4]ip route-static 192.168.1.0 24 NULL 0

[R4]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib

Public routing table : Static
Destinations : 7 Routes : 9 Configured Routes : 9

Static routing table status :
Destinations : 7 Routes : 8

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  60   0          RD   192.168.1.18    GigabitEthernet

0/0/1
192.168.1.0/24 Static 60 0 D 0.0.0.0 NULL0
192.168.1.0/30 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
192.168.1.4/30 Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/2
192.168.1.32/27 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/2
192.168.1.64/27 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
192.168.1.96/27 Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/2

Static routing table status :
Destinations : 1 Routes : 1

Destination/Mask Proto Pre Cost Flags NextHop Interface

    0.0.0.0/0   Static  70   0          R    192.168.1.22    GigabitEthernet

4/0/0
[R1]ip route-static 192.168.1.32 27 NULL 0

[R2]ip route-static 192.168.1.64 27 NULL 0

[R4]ip route-static 192.168.1.128 27 NULL 0 #这条可以不用写,效果一样
此时检验网络都不通了,R4上有问题→写一条明细
[R4]ip route-static 192.168.1.160 27 192.168.1.22 preference 70
此时网络通了

七、完成任务六:均可以访问R6环回
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5-acl-basic-2000]q
[R5]int g 0/0/1
[R5-GigabitEthernet0/0/1]nat outbound 2000
[R5-GigabitEthernet0/0/1]q

[R5]ping 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=100 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms

— 1.1.1.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/38/100 ms
八、完成任务七:R6远程登陆R5的共有IP地址时,实际登录到R1上
[R1]aaa
[R1-aaa]local-user aaa privilege level 15 password cipher 123456
[R1-aaa]local-user aaa service-type telnet
[R1-aaa]q

[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]q
[R5]int g 0/0/1
[R5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 ins
ide 192.168.1.1
Warning:The port 23 is well-known port. If you continue it may cause function fa
ilure.
Are you sure to continue?[Y/N]:y
telnet 12.0.0.1
Press CTRL_] to quit telnet mode
Trying 12.0.0.1 …
Connected to 12.0.0.1 …

Login authentication

Username:aaa
Password:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值