1.1 添加设备
添加路由器、交换机、电脑,并用网线链接起来,添加方式就是用拖拉拽的方式进行添加
1.2 添加文档描述和 ip 规划
1.3 运行设置并进行配置
1.3.1设置 PC1 的地址信息
所以的接口都变绿了表示设备都在运行当中,右击电脑选择 Console
然后可以在界面进行配置
设置 ip、子网掩码、网关
PC1> ? #查看命令
? Print help
! COMMAND [ARG ...] Invoke an OS COMMAND with optional ARG(s)
arp Shortcut for: show arp. Show arp table
clear ARG Clear IPv4/IPv6, arp/neighbor cache, command history
dhcp [OPTION] Shortcut for: ip dhcp. Get IPv4 address via DHCP
disconnect Exit the telnet session (daemon mode)
echo TEXT Display TEXT in output. See also set echo ?
help Print help
history Shortcut for: show history. List the command history
ip ARG ... [OPTION] Configure the current VPC's IP settings. See ip ?
load [FILENAME] Load the configuration/script from the file FILENAME
ping HOST [OPTION ...] Ping HOST with ICMP (default) or TCP/UDP. See ping ?
quit Quit program
relay ARG ... Configure packet relay between UDP ports. See relay ?
rlogin [ip] port Telnet to port on host at ip (relative to host PC)
save [FILENAME] Save the configuration to the file FILENAME
set ARG ... Set VPC name and other options. Try set ?
show [ARG ...] Print the information of VPCs (default). See show ?
sleep [seconds] [TEXT] Print TEXT and pause running script for seconds
trace HOST [OPTION ...] Print the path packets take to network HOST
version Shortcut for: show version
To get command syntax help, please enter '?' as an argument of the command.
PC1> ip 192.168.10.2 255.255.255.0 192.168.10.10 # 设置网路地址
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.10
PC1> save # 保存设置
Saving startup configuration to startup.vpc
. done
PC1> show # 查看网络信息
NAME IP/MASK GATEWAY MAC LPORT RHOST:PORT
PC1 192.168.10.2/24 192.168.10.10 00:50:79:66:68:00 10018 127.0.0.1:10019
fe80::250:79ff:fe66:6800/64
1.3.2 配置路由器 R1 的地址
1.3.2.1 配置以太网口的地址
选择路由器 R1 右击选择 Console
R1#configure terminal # 进入配置
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface fastEthernet 0/0 # 配置网络0/0的接口
R1(config-if)#ip address 192.168.10.10 255.255.255.0 # 添加 ip 地址
*Mar 1 00:13:11.619: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:13:12.619: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#no shutdown # no shutdown 是启动路由器,shutdown 是停用
R1(config-if)# exit # 退出配置
R1#
*Mar 1 00:13:51.783: %SYS-5-CONFIG_I: Configured from console by console
R1# ping 192.168.10.2 # ping pc1的ip是不是通的
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
.!!!! # 感叹号表示是通的
Success rate is 80 percent (4/5), round-trip min/avg/max = 44/62/72 ms
R1#
1.3.2.2 配置广域网口的地址
广域网接口要设定DCE和DTE:
- DCE 是数据控制端设备,需要设置时钟频率,设置时钟频率控制带宽
- DTE 是数据端设置设备
如果路由器一端是 DCE 那它链接的另一个路由器就要设置成 DTE
查看当前路由器的广域网接口线缆类型,R1#show controllers serial 2/0
可以查看,下图可以看到我的线缆是 DCE 类型的
R1#show controllers serial 2/0
M4T: show controller:
PAS unit 0, subunit 0, f/w version 1-45, rev ID 0x2800001, version 1
idb = 0x643ECF70, ds = 0x643EE038, ssb=0x643EE3F4
Clock mux=0x0, ucmd_ctrl=0x0, port_status=0x7B
Serial config=0x8, line config=0x200
maxdgram=1608, bufpool=78Kb, 120 particles
DCD=up DSR=up DTR=up RTS=up CTS=up
line state: down
cable type : V.11 (X.21) DCE cable, received clockrate 2015232
base0 registers=0x3D000000, base1 registers=0x3D002000
mxt_ds=0x64D01220, rx ring entries=78, tx ring entries=128
rxring=0xB98E320, rxr shadow=0x643F4A50, rx_head=0
txring=0xB98E5E0, txr shadow=0x643F4E2C, tx_head=0, tx_tail=0, tx_count=0
throttled=0, enabled=0
halted=0, last halt reason=0
Microcode fatal errors=0
rx_no_eop_err=0, rx_no_stp_err=0, rx_no_eop_stp_err=0
rx_no_buf=0, rx_soft_overrun_err=0, dump_err= 0, bogus=0, mxt_flags=0x0
tx_underrun_err=0, tx_soft_underrun_err=0, tx_limited=1(2)
tx_fullring=0, tx_started=0, mxt_flush_count=1
rx_int_count=0, tx_int_count=2
R1#
R1#copy running-config startup-config # 保存路由器配置,重启路由器配置也不会消失
Destination filename [startup-config]?
Building configuration...
[OK]
R1#
进行时钟频率配置并给广域网接口配置地址
R1#config terminal # 进入配置
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface serial 2/0 # 选择要配置的接口
R1(config-if)#clock rate ? # 查看能配置那些时钟频率
With the exception of the following standard values not subject to rounding,
1200 2400 4800 9600 14400 19200 28800 38400
56000 64000 128000 2015232
accepted clockrates will be bestfitted (rounded) to the nearest value
supportable by the hardware.
<246-8064000> DCE clock rate (bits per second)
R1(config-if)#clock rate
% Incomplete command.
R1(config-if)#clock rate 64000 # 定义时钟频率每秒 64K
R1(config-if)#ip address 192.168.20.10 255.255.255.0 # 给2/0广域网接口配置地址
R1(config-if)#no shutdown # 启用接口
R1(config-if)#^z
R1#copy running-config startup-config # 保存路由器配置,重启路由器配置也不会消失
Destination filename [startup-config]?
Building configuration...
[OK]
R1#
没有配置时钟频率,路由器之间就不会进行通信R1#copy running-config startup-config
保存路由器配置,重启路由器配置也不会消失,将路由器完整的配置完再做此保存就好
1.3.3 配置路由器 R2 的地址
1.3.3.1 配置广域网口的地址
右击 R2 选择 Console 打开控制台界面
R2#
R2#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface serial 2/0
R2(config-if)#no shutdown
*Mar 1 00:13:43.311: %LINK-3-UPDOWN: Interface Serial2/0, changed state to up
*Mar 1 00:13:44.311: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R2(config-if)#ip address 192.168.20.20 255.255.255.0
R2(config-if)#^Z # ctrl + z 可以直接退出配置
R2#
*Mar 1 00:15:14.155: %SYS-5-CONFIG_I: Configured from console by console
R2#
R2 ping R1 看是不是通的,出现!!!!!
表示是通的
1.3.3.2 配置以太网口的地址
R2#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface fastEthernet 0/0
R2(config-if)#no shutdown
R2(config-if)#
*Mar 1 00:24:44.203: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:24:45.203: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#ip address 192.168.80.10 255.255.255.0
R2(config-if)#^Z
R2#ping 192.168.20.10
*Mar 1 00:42:35.399: %SYS-5-CONFIG_I: Configured from console by console
R2#copy running-config startup-config # 保存路由器配置,重启路由器配置也不会消失
Destination filename [startup-config]?
Building configuration...
[OK]
R2#
R2#show running-config # 查看路由器配置
1.3.4 设置 PC2 的地址信息
右击 R2 选择 Console 打开控制台界面
网关就是路由器的以太网接口的地址
PC2> ip 192.168.80.20 255.255.255.0 192.168.80.10
Checking for duplicate address...
PC1 : 192.168.80.20 255.255.255.0 gateway 192.168.80.10
PC2> save # 保存配置
Saving startup configuration to startup.vpc
. done
PC2> ping 192.168.80.10 # ping 一下网关是否是通的
84 bytes from 192.168.80.10 icmp_seq=1 ttl=255 time=15.661 ms
84 bytes from 192.168.80.10 icmp_seq=2 ttl=255 time=15.854 ms
84 bytes from 192.168.80.10 icmp_seq=3 ttl=255 time=15.174 ms
84 bytes from 192.168.80.10 icmp_seq=4 ttl=255 time=15.309 ms
84 bytes from 192.168.80.10 icmp_seq=5 ttl=255 time=16.051 ms
PC2>
1.4 保存
所有的配置弄好后保存整个项目
保存前先关闭
然后点击保存
1.4 进行快照保存
1.5 让 PC1 和 PC2 能正常通信
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#
<a name="WCUEN"></a>
## 1.5.2 设置 R2 的 下一跳
![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)
- `192.168.10.0`是网段
- `192.168.20.10`是 R1 的广域网接口地址
`R2#show ip route`可以查看下一跳位置`S 192.168.10.0/24 [1/0] via 192.168.20.10`
```powershell
R2#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.10
R2(config)#
R2(config)#^Z
*Mar 1 00:07:32.015: %SYS-5-CONFIG_I: Configured from console by console
R2#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
S 192.168.10.0/24 [1/0] via 192.168.20.10
C 192.168.80.0/24 is directly connected, FastEthernet0/0
C 192.168.20.0/24 is directly connected, Serial2/0
R2#
R2#copy running-config startup-config # 保存配置
Destination filename [startup-config]?
Building configuration...
[OK]
R2#
1.5.3 测试
在 PC1 上 ping PC2 的地址
可以看到网络是通的