1.1 添加设备

添加路由器、交换机、电脑,并用网线链接起来,添加方式就是用拖拉拽的方式进行添加
image.png

1.2 添加文档描述和 ip 规划

image.png

1.3 运行设置并进行配置

1.3.1设置 PC1 的地址信息

image.png
所以的接口都变绿了表示设备都在运行当中,右击电脑选择 Console
image.png
然后可以在界面进行配置
image.png
设置 ip、子网掩码、网关
image.png

  1. PC1> ? #查看命令
  2. ? Print help
  3. ! COMMAND [ARG ...] Invoke an OS COMMAND with optional ARG(s)
  4. arp Shortcut for: show arp. Show arp table
  5. clear ARG Clear IPv4/IPv6, arp/neighbor cache, command history
  6. dhcp [OPTION] Shortcut for: ip dhcp. Get IPv4 address via DHCP
  7. disconnect Exit the telnet session (daemon mode)
  8. echo TEXT Display TEXT in output. See also set echo ?
  9. help Print help
  10. history Shortcut for: show history. List the command history
  11. ip ARG ... [OPTION] Configure the current VPC's IP settings. See ip ?
  12. load [FILENAME] Load the configuration/script from the file FILENAME
  13. ping HOST [OPTION ...] Ping HOST with ICMP (default) or TCP/UDP. See ping ?
  14. quit Quit program
  15. relay ARG ... Configure packet relay between UDP ports. See relay ?
  16. rlogin [ip] port Telnet to port on host at ip (relative to host PC)
  17. save [FILENAME] Save the configuration to the file FILENAME
  18. set ARG ... Set VPC name and other options. Try set ?
  19. show [ARG ...] Print the information of VPCs (default). See show ?
  20. sleep [seconds] [TEXT] Print TEXT and pause running script for seconds
  21. trace HOST [OPTION ...] Print the path packets take to network HOST
  22. version Shortcut for: show version
  23. To get command syntax help, please enter '?' as an argument of the command.
  24. PC1> ip 192.168.10.2 255.255.255.0 192.168.10.10 # 设置网路地址
  25. Checking for duplicate address...
  26. PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.10
  27. PC1> save # 保存设置
  28. Saving startup configuration to startup.vpc
  29. . done
  30. PC1> show # 查看网络信息
  31. NAME IP/MASK GATEWAY MAC LPORT RHOST:PORT
  32. PC1 192.168.10.2/24 192.168.10.10 00:50:79:66:68:00 10018 127.0.0.1:10019
  33. fe80::250:79ff:fe66:6800/64

1.3.2 配置路由器 R1 的地址

image.png

1.3.2.1 配置以太网口的地址

选择路由器 R1 右击选择 Console
image.png

  1. R1#configure terminal # 进入配置
  2. Enter configuration commands, one per line. End with CNTL/Z.
  3. R1(config)#interface fastEthernet 0/0 # 配置网络0/0的接口
  4. R1(config-if)#ip address 192.168.10.10 255.255.255.0 # 添加 ip 地址
  5. *Mar 1 00:13:11.619: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
  6. *Mar 1 00:13:12.619: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
  7. R1(config-if)#no shutdown # no shutdown 是启动路由器,shutdown 是停用
  8. R1(config-if)# exit # 退出配置
  9. R1#
  10. *Mar 1 00:13:51.783: %SYS-5-CONFIG_I: Configured from console by console
  11. R1# ping 192.168.10.2 # ping pc1的ip是不是通的
  12. Type escape sequence to abort.
  13. Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
  14. .!!!! # 感叹号表示是通的
  15. Success rate is 80 percent (4/5), round-trip min/avg/max = 44/62/72 ms
  16. R1#

在 PC1 上 ping 路由器的地址是不是通的
image.png

1.3.2.2 配置广域网口的地址

广域网接口要设定DCE和DTE:

  • DCE 是数据控制端设备,需要设置时钟频率,设置时钟频率控制带宽
  • DTE 是数据端设置设备

如果路由器一端是 DCE 那它链接的另一个路由器就要设置成 DTE

查看当前路由器的广域网接口线缆类型,R1#show controllers serial 2/0可以查看,下图可以看到我的线缆是 DCE 类型的
image.png

  1. R1#show controllers serial 2/0
  2. M4T: show controller:
  3. PAS unit 0, subunit 0, f/w version 1-45, rev ID 0x2800001, version 1
  4. idb = 0x643ECF70, ds = 0x643EE038, ssb=0x643EE3F4
  5. Clock mux=0x0, ucmd_ctrl=0x0, port_status=0x7B
  6. Serial config=0x8, line config=0x200
  7. maxdgram=1608, bufpool=78Kb, 120 particles
  8. DCD=up DSR=up DTR=up RTS=up CTS=up
  9. line state: down
  10. cable type : V.11 (X.21) DCE cable, received clockrate 2015232
  11. base0 registers=0x3D000000, base1 registers=0x3D002000
  12. mxt_ds=0x64D01220, rx ring entries=78, tx ring entries=128
  13. rxring=0xB98E320, rxr shadow=0x643F4A50, rx_head=0
  14. txring=0xB98E5E0, txr shadow=0x643F4E2C, tx_head=0, tx_tail=0, tx_count=0
  15. throttled=0, enabled=0
  16. halted=0, last halt reason=0
  17. Microcode fatal errors=0
  18. rx_no_eop_err=0, rx_no_stp_err=0, rx_no_eop_stp_err=0
  19. rx_no_buf=0, rx_soft_overrun_err=0, dump_err= 0, bogus=0, mxt_flags=0x0
  20. tx_underrun_err=0, tx_soft_underrun_err=0, tx_limited=1(2)
  21. tx_fullring=0, tx_started=0, mxt_flush_count=1
  22. rx_int_count=0, tx_int_count=2
  23. R1#
  24. R1#copy running-config startup-config # 保存路由器配置,重启路由器配置也不会消失
  25. Destination filename [startup-config]?
  26. Building configuration...
  27. [OK]
  28. R1#

进行时钟频率配置并给广域网接口配置地址

  1. R1#config terminal # 进入配置
  2. Enter configuration commands, one per line. End with CNTL/Z.
  3. R1(config)#interface serial 2/0 # 选择要配置的接口
  4. R1(config-if)#clock rate ? # 查看能配置那些时钟频率
  5. With the exception of the following standard values not subject to rounding,
  6. 1200 2400 4800 9600 14400 19200 28800 38400
  7. 56000 64000 128000 2015232
  8. accepted clockrates will be bestfitted (rounded) to the nearest value
  9. supportable by the hardware.
  10. <246-8064000> DCE clock rate (bits per second)
  11. R1(config-if)#clock rate
  12. % Incomplete command.
  13. R1(config-if)#clock rate 64000 # 定义时钟频率每秒 64K
  14. R1(config-if)#ip address 192.168.20.10 255.255.255.0 # 给2/0广域网接口配置地址
  15. R1(config-if)#no shutdown # 启用接口
  16. R1(config-if)#^z
  17. R1#copy running-config startup-config # 保存路由器配置,重启路由器配置也不会消失
  18. Destination filename [startup-config]?
  19. Building configuration...
  20. [OK]
  21. R1#

没有配置时钟频率,路由器之间就不会进行通信
R1#copy running-config startup-config 保存路由器配置,重启路由器配置也不会消失,将路由器完整的配置完再做此保存就好

1.3.3 配置路由器 R2 的地址

image.png

1.3.3.1 配置广域网口的地址

右击 R2 选择 Console 打开控制台界面

  1. R2#
  2. R2#config terminal
  3. Enter configuration commands, one per line. End with CNTL/Z.
  4. R2(config)#interface serial 2/0
  5. R2(config-if)#no shutdown
  6. *Mar 1 00:13:43.311: %LINK-3-UPDOWN: Interface Serial2/0, changed state to up
  7. *Mar 1 00:13:44.311: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
  8. R2(config-if)#ip address 192.168.20.20 255.255.255.0
  9. R2(config-if)#^Z # ctrl + z 可以直接退出配置
  10. R2#
  11. *Mar 1 00:15:14.155: %SYS-5-CONFIG_I: Configured from console by console
  12. R2#

R2 ping R1 看是不是通的,出现!!!!!表示是通的
image.png

1.3.3.2 配置以太网口的地址

  1. R2#config terminal
  2. Enter configuration commands, one per line. End with CNTL/Z.
  3. R2(config)#interface fastEthernet 0/0
  4. R2(config-if)#no shutdown
  5. R2(config-if)#
  6. *Mar 1 00:24:44.203: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
  7. *Mar 1 00:24:45.203: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
  8. R2(config-if)#ip address 192.168.80.10 255.255.255.0
  9. R2(config-if)#^Z
  10. R2#ping 192.168.20.10
  11. *Mar 1 00:42:35.399: %SYS-5-CONFIG_I: Configured from console by console
  12. R2#copy running-config startup-config # 保存路由器配置,重启路由器配置也不会消失
  13. Destination filename [startup-config]?
  14. Building configuration...
  15. [OK]
  16. R2#
  17. R2#show running-config # 查看路由器配置

1.3.4 设置 PC2 的地址信息

image.png
右击 R2 选择 Console 打开控制台界面
网关就是路由器的以太网接口的地址

  1. PC2> ip 192.168.80.20 255.255.255.0 192.168.80.10
  2. Checking for duplicate address...
  3. PC1 : 192.168.80.20 255.255.255.0 gateway 192.168.80.10
  4. PC2> save # 保存配置
  5. Saving startup configuration to startup.vpc
  6. . done
  7. PC2> ping 192.168.80.10 # ping 一下网关是否是通的
  8. 84 bytes from 192.168.80.10 icmp_seq=1 ttl=255 time=15.661 ms
  9. 84 bytes from 192.168.80.10 icmp_seq=2 ttl=255 time=15.854 ms
  10. 84 bytes from 192.168.80.10 icmp_seq=3 ttl=255 time=15.174 ms
  11. 84 bytes from 192.168.80.10 icmp_seq=4 ttl=255 time=15.309 ms
  12. 84 bytes from 192.168.80.10 icmp_seq=5 ttl=255 time=16.051 ms
  13. PC2>

1.4 保存
所有的配置弄好后保存整个项目
保存前先关闭
image.png
然后点击保存
image.png

1.4 进行快照保存

image.png
image.png

1.5 让 PC1 和 PC2 能正常通信

image.png

1.5.1 设置 R1 的 下一跳

R1(config)#ip route 192.168.80.0 255.255.255.0 192.168.20.20 是告诉 R1 下一跳的位置

  • 192.168.80.0是网段
  • 192.168.20.20是 R2 的广域网接口地址 ```powershell

R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.10.0/24 is directly connected, FastEthernet0/0 C 192.168.20.0/24 is directly connected, Serial2/0 R1#config terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#ip route 192.168.80.0 255.255.255.0 192.168.20.20 R1(config)#^z R1#copy running-config startup-config # 保存配置 Destination filename [startup-config]? Building configuration… [OK] R1#

  1. <a name="WCUEN"></a>
  2. ## 1.5.2 设置 R2 的 下一跳
  3. ![image.png](https://cdn.nlark.com/yuque/0/2022/png/1750374/1654928322949-8bd3ea62-2466-48b2-b2e4-e93351db7c4a.png#clientId=ucff573cb-04ba-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=149&id=uadc4f1c0&margin=%5Bobject%20Object%5D&name=image.png&originHeight=223&originWidth=924&originalType=binary&ratio=1&rotation=0&showTitle=false&size=26906&status=done&style=none&taskId=u591c9943-3b71-4ea8-8c2a-c0186b16da5&title=&width=616)
  4. - `192.168.10.0`是网段
  5. - `192.168.20.10`是 R1 的广域网接口地址
  6. `R2#show ip route`可以查看下一跳位置`S 192.168.10.0/24 [1/0] via 192.168.20.10`
  7. ```powershell
  8. R2#config terminal
  9. Enter configuration commands, one per line. End with CNTL/Z.
  10. R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.10
  11. R2(config)#
  12. R2(config)#^Z
  13. *Mar 1 00:07:32.015: %SYS-5-CONFIG_I: Configured from console by console
  14. R2#show ip route
  15. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
  16. D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  17. N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  18. E1 - OSPF external type 1, E2 - OSPF external type 2
  19. i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
  20. ia - IS-IS inter area, * - candidate default, U - per-user static route
  21. o - ODR, P - periodic downloaded static route
  22. Gateway of last resort is not set
  23. S 192.168.10.0/24 [1/0] via 192.168.20.10
  24. C 192.168.80.0/24 is directly connected, FastEthernet0/0
  25. C 192.168.20.0/24 is directly connected, Serial2/0
  26. R2#
  27. R2#copy running-config startup-config # 保存配置
  28. Destination filename [startup-config]?
  29. Building configuration...
  30. [OK]
  31. R2#

1.5.3 测试

在 PC1 上 ping PC2 的地址
image.png
可以看到网络是通的
image.png