diff --git "a/19\351\203\221\351\233\250\350\211\257/20250331 Cisco\344\272\244\346\215\242\346\234\272\345\256\211\345\205\250\347\256\241\347\220\206.md" "b/19\351\203\221\351\233\250\350\211\257/20250331 Cisco\344\272\244\346\215\242\346\234\272\345\256\211\345\205\250\347\256\241\347\220\206.md" new file mode 100644 index 0000000000000000000000000000000000000000..f72f6cc6f1510548e0f9c6c0a3b64bad71e0c806 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250331 Cisco\344\272\244\346\215\242\346\234\272\345\256\211\345\205\250\347\256\241\347\220\206.md" @@ -0,0 +1,62 @@ +# 笔记 + +1. 配置密码 + +```cmd +Switch> //用户模式 +Switch>enable //特权模式,一般用于查询 +Switch# configure terminal //(config t简写) 全局模式,一般用于修改配置 +Switch(config)# line console 0 //控制台线路模式,‘0’表示第一个控制台接口 +Switch(config-line)# password aaa123456 //设置控制台登录密码 +Switch(config-line)# login //强制连接控制台时输入密码,若不配置,不会生效 +Switch(config-line)# end +Switch# show running-config //显示配置文件,用来检查配置是否生效 +Switch # write //保存配置 + +Switch(config)#line ? + <0-16> First Line number + console Primary terminal line + vty Virtual terminal + + Switch(config)# service password-encryption // 对明文密码进行弱加密 +``` + +2. Telnet配置 + +```cmd +Switch> +Switch>enable +Switch# configure terminal +Switch(config)#vty 0 4 /拟终端线路配置模式(0-4表示5个并发远程连接最多可以连16台0-15) +Switch(config-line)#password 11111 //设置telenet登录密码 +Switch(config-line)#login //启用密码验证 +Switch(config-line)#transport input telnet //指定这些线路只接受Telnet连接 +Switch(config-line)#exit //退出当前配置模 +Switch(config)#interface vlan 1 //进入VLAN 1接口配置模式 +Switch(config-if)#ip address 192.168.10.11 5.255.255.0 //为交换机设置管理IP地址和子网掩码 +Switch(config-if)#no shutdown //激活该虚拟接口 + +Switch(config-line)#transport ? + input Define which protocols to use when connecting to the terminal server + output Define which protocols to use for outgoing connections +``` + +3. SSH高级配置 + +```cmd +Switch(config)# hostname SW1 //主机名(RSA密钥生成必需) +SW1(config)# ip domain-name mxdx.com //域名(RSA密钥生成必需) +SW1(config)# crypto key generate rsa //生成RSA密钥,可直接回车 +SW1(config)# username admin secret abc //创建本地用户admin,密码abc(SSH登录用) +SW1(config)# line vty 0 4 +SW1(config-line)# transport input ssh //只允许SSH all none telnet ssh +SW1(config-line)# login local //使用本地用户认证 +SW1(config-line)#exit //退出当前配置模 +SW1(config)#interface vlan 1 //进入VLAN 1接口配置模式 +SW1(config-if)#ip address 192.168.10.1 255.255.255.0 //为交换机设置管理IP地址和子网掩码 +SW1(config-if)#no shutdown //激活该虚拟接口(默认交换机物理接口常开,但VLAN接口需手动激活) +SW1(config-if)#exit +SW1(config)#exit +SW1# show ip ssh //确认SSH已启用 +``` + diff --git "a/19\351\203\221\351\233\250\350\211\257/20250401 VLAN\347\232\204\351\205\215\347\275\256.md" "b/19\351\203\221\351\233\250\350\211\257/20250401 VLAN\347\232\204\351\205\215\347\275\256.md" new file mode 100644 index 0000000000000000000000000000000000000000..e870c10db0a728e78224f53995937a3956d1056c --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250401 VLAN\347\232\204\351\205\215\347\275\256.md" @@ -0,0 +1,81 @@ +# 笔记 + +划分vlan,vlan10-30 + +```cmd +Switch>en +Switch#conf t +Switch(config)#vlan 10 +Switch(config-vlan)#end +Switch#conf t +Switch(config)#vlan 20 +Switch(config-vlan)#exit +Switch(config)#vlan 30 +Switch(config-vlan)#exit + +``` + +给vlan10,F0/2-3,给vlan20,F0/4-5 vlan30 FastEthernet0/6 + +```cmd +Switch(config)#int +Switch(config)#interface r +Switch(config)#interface range f +Switch(config)#interface range fastEthernet 0/2-3 +Switch(config-if-range)#sw +Switch(config-if-range)#switchport acc +Switch(config-if-range)#switchport access vlan 10 +Switch(config-if-range)#exit +Switch(config)#in +Switch(config)#interface r +Switch(config)#interface range f +% Incomplete command. +Switch(config)#in +Switch(config)#interface r +Switch(config)#interface range f +Switch(config)#interface range fastEthernet 0/4-5 +Switch(config-if-range)#sw +Switch(config-if-range)#switchport ac +Switch(config-if-range)#switchport access vlan 20 +Switch(config-if-range)#exi +Switch(config)#int +Switch(config)#interface r +Switch(config)#interface fastEthernet 0/1 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 30 +Switch(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/6, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to up + +Switch(config-if)#eixt +``` + +核心 是将交换机接交换机的端口,设为trunk + +```cmd +Switch(config-if)#exit +Switch(config)#inter +Switch(config)#interface fa +Switch(config)#interface fastEthernet 0/6 +Switch(config-if)#sw +Switch(config-if)#switchport mode trun +Switch(config-if)#switchport mode trunk + +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to up +``` + +```cmd +# 或者 查看所有接口的信息 +Switch#show interfaces status +#查看vlan的划分情况 +Switch#show vlan brief +``` + +# 练习 + +![image-20250401223007697](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250401_1743517813.png) \ No newline at end of file diff --git "a/19\351\203\221\351\233\250\350\211\257/20250403 \347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" "b/19\351\203\221\351\233\250\350\211\257/20250403 \347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" new file mode 100644 index 0000000000000000000000000000000000000000..130b6e638e603c3a5e7e0d72b1a2ebe1bb4ac93e --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250403 \347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" @@ -0,0 +1,27 @@ +# 笔记 + +生成树协议:监视二层交换式网络以找出所有可用的链路,并关闭冗余链路以确保不会出现环路。 首先利用生成树算法创建一个拓扑数据库,然后将网络的冗余备份链路从逻辑上断开,这样数据帧只能在生成树协议选定的最优链路上进行转发。 + +生成树:解决环路路线 + +最小生成树:从众多路线中,找出最短路线 + +冗余:备用,多余的 + +RSTP(快速生成树协议) + +```cmd +show spanning-tree summary # 查看配置 +show spanning-tree # 查看状态 +Switch(config-if)#switch mode trunk 设置为共享 +spanning-tree mode rapid-pvst #修改到快速模式 +``` + +生成树端口有4种状态 + +- 阻塞(Block):只监听/接收BPDU报文 +- 侦听(Listening):只能接收或发送BPDU报文 +- 学习(Learning):能接收或发送BPDU报文,并形成MAC地址表,但不能转发数据帧 +- 转发(Forwarding):能接收或发送BPDU报文,并形成MAC地址表,同时发送和接收数据帧 + +![image-20250406171736182](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250406_1743931062.png) \ No newline at end of file diff --git "a/19\351\203\221\351\233\250\350\211\257/20250407 \347\253\257\345\217\243\350\201\232\345\220\210.md" "b/19\351\203\221\351\233\250\350\211\257/20250407 \347\253\257\345\217\243\350\201\232\345\220\210.md" new file mode 100644 index 0000000000000000000000000000000000000000..8dfffe929626aac33799027923006eca877917ca --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250407 \347\253\257\345\217\243\350\201\232\345\220\210.md" @@ -0,0 +1,79 @@ + + +# 笔记 + +端口聚合:把多个物理端口捆绑合成一个逻辑端口 + +1. 生成树特性(提高链路带宽) +2. 将多个端口从逻辑上合并成一个打端口 +3. 可以做负载均衡 +4. 提供链路备份 +5. 防止网络环路 + + + +将端口配置为Trunk模式 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#int +Switch(config)#interface ra +Switch(config)#interface range f0/22-24 +Switch(config-if-range)#sw +Switch(config-if-range)#switchport mo +Switch(config-if-range)#switchport mode t +Switch(config-if-range)#switchport mode trunk +``` + +加入链路组1并开启 + +```cmd +Switch(config-if-range)#channel-g +Switch(config-if-range)#channel-group 1 mo +Switch(config-if-range)#channel-group 1 mode on +``` + +按目的IP地址来实现负载均衡 + +```CMD +Switch(config)#port-channel load-balance dst-ip +``` + +新拉一条线,加入链路1组 + +```cmd +Switch(config)#interface f0/21 +Switch(config-if)#sw +Switch(config-if)#switchport m +Switch(config-if)#switchport mode t +Switch(config-if)#switchport mode trunk + +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/21, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/21, changed state to up + +Switch(config-if)#channel-g +Switch(config-if)#channel-group 1 mo +Switch(config-if)#channel-group 1 mode on + + + +Switch(config)#interface port-channel 1 //进入聚合端口的端口配置模式 +``` + +查看 + +```cmd +Switch#show interfaces etherchannel //显示聚合端口信息 +Switch#show etherchannel summary //显示以太通道信息 +Switch#show etherchannel //显示以太通道 +``` + + + +# 练习 + +![image-20250407170439569](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250407_1744016685.png) \ No newline at end of file diff --git "a/19\351\203\221\351\233\250\350\211\257/20250408 \347\253\257\345\217\243\345\256\211\345\205\250.md" "b/19\351\203\221\351\233\250\350\211\257/20250408 \347\253\257\345\217\243\345\256\211\345\205\250.md" new file mode 100644 index 0000000000000000000000000000000000000000..5e0c1a078da3b34e07faf3eb98b33972933e6f75 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250408 \347\253\257\345\217\243\345\256\211\345\205\250.md" @@ -0,0 +1,133 @@ +# 笔记 + +### 限制接入的主机数 + +1. 选择要设置的端口 +2. 修改端口的模式:access(接口模式)/trunk(共享模式) +3. 开启端口安全 +4. 限制数量 +5. 设置处理方式:关闭端口 + +```cmd +Switch(config-if)#sw +Switch(config-if)#switchport po +Switch(config-if)#switchport port-security +Switch(config-if)#sw +Switch(config-if)#switchport po +Switch(config-if)#switchport port-security ? + aging Port-security aging commands + mac-address Secure mac address + maximum Max secure addresses + violation Security violation mode + +Switch(config-if)#switchport port-security +Switch(config-if)#switchport port-security max +Switch(config-if)#switchport port-security maximum 1 +Switch(config-if)#switchport port-securit violation shu +Switch(config-if)#switchport port-securit violation shutdown + + + +# 若违规被关闭的端口要再次开启,先主动关闭,再开启一次 +Switch(config-if)#shutdown //先主动关闭 +Switch(config-if)#no shutdown //再开启一次#### +``` + + + +### 绑定死MAC地址 + +#### 手动绑定 + +1. 选择要设置的端口 +2. 修改端口的模式:access/trunk +3. 开启端口安全 +4. 绑定MAC +5. 设置违规的处理方式 + +查MAC地址 + +``` +C:\>ipconfig /all + +FastEthernet0 Connection:(default port) + + Connection-specific DNS Suffix..: + Physical Address................: 0001.6443.E10B + Link-local IPv6 Address.........: FE80::201:64FF:FE43:E10B + IP Address......................: 0.0.0.0 + Subnet Mask.....................: 0.0.0.0 + Default Gateway.................: 0.0.0.0 + DNS Servers.....................: 0.0.0.0 + DHCP Servers....................: 0.0.0.0 + DHCPv6 Client DUID..............: 00-01-00-01-73-6C-BB-97-00-01-64-43-E1-0B + + +``` + + + +```cmd +Switch(config)#interface f0/20 +Switch(config-if)#switchport mode access +Switch(config-if)#switchport po +Switch(config-if)#switchport port-security +Switch(config-if)#switchport port-security mac +Switch(config-if)#switchport port-security mac-address ? + H.H.H 48 bit mac address + sticky Configure dynamic secure addresses as sticky +Switch(config-if)#switchport port-security mac-address +% Incomplete command. +Switch(config-if)#switchport port-security mac-address 0001.6443.E10B +Switch(config-if)#sw +Switch(config-if)#switchport po +Switch(config-if)#switchport port-security v +Switch(config-if)#switchport port-security violation shu +Switch(config-if)#switchport port-security violation shutdown +``` + +### 自动绑定 + +```cmd +Switch(config)#interface f0/20 +Switch(config-if)#switchport mo +Switch(config-if)#switchport mode ac +Switch(config-if)#switchport mode access +Switch(config-if)#switchport po +Switch(config-if)#switchport port-security +Switch(config-if)#switchport port-security ma +% Ambiguous command: "switchport port-security ma" +Switch(config-if)#switchport port-security mac +Switch(config-if)#switchport port-security mac-address str +Switch(config-if)#switchport port-security mac-address st +Switch(config-if)#switchport port-security mac-address sticky +Switch(config-if)#switchport port-security violation shutdown +``` + +### 绑定MAC并限制主机数 + +1. 选择端口 +2. 修改端口的模式 +3. 开启端口安全 +4. 绑定MAC,粘性 (一定要先ping一次,交换机才会记得这个主机 的MAC) +5. 限制数量1 +6. 设置违规的处理方式 + +```cmd +Switch(config)#interface f0/17 +Switch(config-if)#sw +Switch(config-if)#switchport mo +Switch(config-if)#switchport mode ac +Switch(config-if)#switchport mode access +Switch(config-if)#switchport port-security +Switch(config-if)#switchport port-security max +Switch(config-if)#switchport port-security maximum 1 +Switch(config-if)#switchport port-security mac +Switch(config-if)#switchport port-security mac-address st +Switch(config-if)#switchport port-security mac-address sticky +Switch(config-if)#switchport port-security v +Switch(config-if)#switchport port-security violation shu +Switch(config-if)#switchport port-security violation shutdown +``` + +![image-20250408195053118](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250408_1744113060.png) \ No newline at end of file diff --git "a/19\351\203\221\351\233\250\350\211\257/20250410 \344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\256\200\345\215\225\351\205\215\347\275\256.md" "b/19\351\203\221\351\233\250\350\211\257/20250410 \344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\256\200\345\215\225\351\205\215\347\275\256.md" new file mode 100644 index 0000000000000000000000000000000000000000..3f37b15334ae941412de8dd28f74aada8819c622 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250410 \344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\256\200\345\215\225\351\205\215\347\275\256.md" @@ -0,0 +1,102 @@ +# 笔记 + +S3560 既有交换机又有罗尤其,可以跨网络,三层交换机默认二层口,如果需要启用三层功能就需要在此端口输入 no swtichport 命令。二层没有此命令。 + +对汇聚层配置 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#ex +Switch(config)#vlan 20 +Switch(config-vlan)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 10 +Switch(config-if)#ex +Switch(config)#interface f0/4 +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 20 +Switch(config-if)#ex +Switch(config)#interface f0/24 +Switch(config-if)#sw +Switch(config-if)#switchport m +Switch(config-if)#switchport mode t +Switch(config-if)#switchport mode trunk +``` + +三层配置(S3560j) + +```cmd +Switch(config)#vlan 10 +Switch(config-vlan)#ex +Switch(config)#vlan 20 +Switch(config-vlan)#ex +Switch(config)#int +Switch(config)#interface f0/24 +Switch(config-if)#switchport trunk encapsulation dot1q +Switch(config-if)#switchport mode t +Switch(config-if)#switchport mode trunk +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 10 +Switch(config-if)#ex +Switch(config)#ip routing //开启路由功能,才能跨网络 +Switch(config)#int +Switch(config)#interface vlan 10 +Switch(config-if)# +%LINK-5-CHANGED: Interface Vlan10, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up + +Switch(config-if)#ip ad +Switch(config-if)#ip address 172.16.10.254 255.255.255.0 网关 子网掩码 +Switch(config-if)#no shutdown +Switch(config-if)#ex +Switch(config)#interface f0/4 +Switch(config-if)#ex +Switch(config)#interface vlan 20 +Switch(config-if)# +%LINK-5-CHANGED: Interface Vlan20, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up + +Switch(config-if)#ip address 172.16.20.254 255.255.255.0 +Switch(config-if)#no sh +Switch(config-if)#no shutdown +Switch(config-if)#end +Switch# +%SYS-5-CONFIG_I: Configured from console by console + +Switch#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 172.16.0.0/24 is subnetted, 2 subnets +C 172.16.10.0 is directly connected, Vlan10 +C 172.16.20.0 is directly connected, Vlan20 + +``` + + + +![image-20250410192946699](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250410_1744284587.png) + +测试 + +![image-20250410192923763](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250410_1744284567.png) + +![image-20250410192933141](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250410_1744284573.png) \ No newline at end of file diff --git "a/19\351\203\221\351\233\250\350\211\257/20250411 \350\267\257\347\224\261\345\231\250.md" "b/19\351\203\221\351\233\250\350\211\257/20250411 \350\267\257\347\224\261\345\231\250.md" new file mode 100644 index 0000000000000000000000000000000000000000..d65cf983767a8757c3cb7607e3d2c50316841b49 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250411 \350\267\257\347\224\261\345\231\250.md" @@ -0,0 +1,203 @@ +# 笔记 + +#### telnet + +![image-20250411191724475](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250411_1744370244.png) + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#ho +Router(config)#hostname RTO1 +RTO1(config)#int +RTO1(config)#interface f0/0 +RTO1(config-if)#no shu +RTO1(config-if)#no shutdown + +RTO1(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +RTO1(config-if)#ip aad +RTO1(config-if)#ip ad +RTO1(config-if)#ip address 192.168.10.2 +% Incomplete command. +RTO1(config-if)#ip address 192.168.10.2 255.255.255.0 +RTO1(config-if)#ex +RTO1(config)#line vty 0 15 +RTO1(config-line)#pas +RTO1(config-line)#password 111 +RTO1(config-line)#ex +% Ambiguous command: "ex" +RTO1(config-line)#exit +RTO1(config)#en +RTO1(config)#enable sec +RTO1(config)#enable secret 456 +``` + + + +测试 + +```cmd +C:\>ping 192.168.10.2 + +Pinging 192.168.10.2 with 32 bytes of data: + +Reply from 192.168.10.2: bytes=32 time=1ms TTL=255 +Reply from 192.168.10.2: bytes=32 time<1ms TTL=255 +Reply from 192.168.10.2: bytes=32 time<1ms TTL=255 +Reply from 192.168.10.2: bytes=32 time<1ms TTL=255 + +Ping statistics for 192.168.10.2: + Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: + Minimum = 0ms, Maximum = 1ms, Average = 0ms + +C:\>telnet 192.168.10.2 +Trying 192.168.10.2 ...Open + + +User Access Verification + +Password: +RTO1>en +% No password set. +RTO1>en +Password: +RTO1# +``` + + + +#### ssh + +![image-20250411191710106](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250411_1744370234.png) + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#ho +Router(config)#hostname Rosie +Rosie(config)#ip ad +Rosie(config)#ip do +Rosie(config)#ip domain-n +Rosie(config)#ip domain-name rosie.com +Rosie(config)#cr +Rosie(config)#crypto ke +Rosie(config)#crypto key gen +Rosie(config)#crypto key generate rsa +The name for the keys will be: Rosie.rosie.com +Choose the size of the key modulus in the range of 360 to 2048 for your + General Purpose Keys. Choosing a key modulus greater than 512 may take + a few minutes. + +How many bits in the modulus [512]: 2048 +% Generating 2048 bit RSA keys, keys will be non-exportable...[OK] + +Rosie(config)#use +*3月 1 0:2:11.847: %SSH-5-ENABLED: SSH 1.99 has been enabled +Rosie(config)#username rosie sec +Rosie(config)#username rosie secret 0211 +Rosie(config)#ip ssh ver +Rosie(config)#ip ssh version 2 +Rosie(config)#int +Rosie(config)#interface f0/0 +Rosie(config-if)#ip ad +Rosie(config-if)#ip address 192.168.40.2 255.255.255.0 +Rosie(config-if)#shutd +Rosie(config-if)#shutdown +Rosie(config-if)#ex +Rosie(config)#line vty 0 15 +Rosie(config-line)#tran +Rosie(config-line)#transport inpu +Rosie(config-line)#transport input ssh +Rosie(config-line)#login local +Rosie(config-if)#enable secret 222 +``` + + + +测试 + +```cmd +C:\>ping 192.168.40.2 + +Pinging 192.168.40.2 with 32 bytes of data: + +Reply from 192.168.40.2: bytes=32 time<1ms TTL=255 +Reply from 192.168.40.2: bytes=32 time=4ms TTL=255 +Reply from 192.168.40.2: bytes=32 time<1ms TTL=255 +Reply from 192.168.40.2: bytes=32 time<1ms TTL=255 + +Ping statistics for 192.168.40.2: + Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: + Minimum = 0ms, Maximum = 4ms, Average = 1ms + +C:\>ssh -l rosie 192.168.40.2 + +Password: +Rosie>en +% No password set. +Rosie>en +Password: +Rosie# +``` + +#### 多网互联 + +![image-20250411191750573](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250411_1744370270.png) + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#ip add +Router(config-if)#ip address 192.168.50.254 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#ip +Router(config-if)#ipad +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.60.254 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown +``` + + + + + +show ip route + +```cmd +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.50.0/24 is directly connected, FastEthernet0/0 +C 192.168.60.0/24 is directly connected, FastEthernet0/1 + +``` + diff --git "a/19\351\203\221\351\233\250\350\211\257/20250414 \345\215\225\350\207\202\350\267\257\347\224\261.md" "b/19\351\203\221\351\233\250\350\211\257/20250414 \345\215\225\350\207\202\350\267\257\347\224\261.md" new file mode 100644 index 0000000000000000000000000000000000000000..a5e34501368ce2169e0ec518b6cd51e48033bd46 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250414 \345\215\225\350\207\202\350\267\257\347\224\261.md" @@ -0,0 +1,135 @@ +# 笔记 + +单臂路由 + +![image-20250414204759617](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250414_1744634884.png) + +```cmd +Switch(config)#vlan 10 +Switch(config-vlan)#ex +Switch(config)#vlan 20 +Switch(config-vlan)#ex +Switch(config)#int +Switch(config)#interface f0/2 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 10 +Switch(config-if)#ex +Switch(config)#interface f0/3 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 20 +Switch(config-if)#e +Switch(config)#int +Switch(config)#interface f0/1 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport mo +Switch(config-if)#switchport mode tr +Switch(config-if)#switchport mode trunk +Switch(config-if)#ex +Switch(config)#end +``` + +```cmd +Switch#show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6 + Fa0/7, Fa0/8, Fa0/9, Fa0/10 + Fa0/11, Fa0/12, Fa0/13, Fa0/14 + Fa0/15, Fa0/16, Fa0/17, Fa0/18 + Fa0/19, Fa0/20, Fa0/21, Fa0/22 + Fa0/23, Fa0/24, Gig0/1, Gig0/2 +10 VLAN0010 active Fa0/2 +20 VLAN0020 active Fa0/3 +1002 fddi-default active +1003 token-ring-default active +1004 fddinet-default active +1005 trnet-default active +Switch# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +``` + +```cmd + +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#ho +Router(config)#hostname Rosie +Rosie(config)#int +Rosie(config)#interface f0/0 +Rosie(config-if)#no shu +Rosie(config-if)#no shutdown + +Rosie(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up +ex +Rosie(config)#int +Rosie(config)#interface f0/0.1 +Rosie(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up + +Rosie(config-subif)#en +Rosie(config-subif)#encapsulation do +Rosie(config-subif)#encapsulation dot1Q 10 +Rosie(config-subif)#ip ad +Rosie(config-subif)#ip address 192.168.10.254 255.255.255.0 +Rosie(config-subif)#ex +Rosie(config)#int +Rosie(config)#interface f0/0.2 +Rosie(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up +Rinterface f0/0.2interface f0/0.2 +Rosie(config-subif)#en +Rosie(config-subif)#encapsulation do +Rosie(config-subif)#encapsulation dot1Q 20 +Rosie(config-subif)#ip address 192.168.20.254 255.255.255.0 +Rosie(config-subif)#end +Rosie# +%SYS-5-CONFIG_I: Configured from console by console +s + +``` + +```cmd +Rosie#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.1 +C 192.168.20.0/24 is directly connected, FastEthernet0/0.2 +``` + +# 预习 + +两个路由器相连 + +``` +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.50.1 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.50.1 +``` + +``` +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.50.2 +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.50.2 +``` + diff --git "a/19\351\203\221\351\233\250\350\211\257/20250415 \351\235\231\346\200\201\350\267\257\347\224\261.md" "b/19\351\203\221\351\233\250\350\211\257/20250415 \351\235\231\346\200\201\350\267\257\347\224\261.md" new file mode 100644 index 0000000000000000000000000000000000000000..948366ba95f04df8d37186a9c534b248a8c6bad8 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250415 \351\235\231\346\200\201\350\267\257\347\224\261.md" @@ -0,0 +1,119 @@ + + +# 笔记 + +![image-20250415212606831](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250415_1744723579.png) + +二层交换机配置 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#ex +Switch(config)#vlan 20 +Switch(config-vlan)#ex +Switch(config)#int +Switch(config)#interface f0/1 +Switch(config-if)#sw +Switch(config-if)#switchport +% Incomplete command. +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 10 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 20 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#sw +Switch(config-if)#switchport m +Switch(config-if)#switchport mode t +Switch(config-if)#switchport mode trunk +``` + +路由器 + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up + +Router(config-subif)#en +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.10.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface f0/0.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up + +Router(config-subif)#encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.20.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console +s +% Ambiguous command: "s" +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.1 +C 192.168.20.0/24 is directly connected, FastEthernet0/0.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#ip add +Router(config-if)#ip address 192.168.50.1 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +Router(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.50.2 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.50.2 +``` + + + diff --git "a/19\351\203\221\351\233\250\350\211\257/20250416 \351\273\230\350\256\244\350\267\257\347\224\261.md" "b/19\351\203\221\351\233\250\350\211\257/20250416 \351\273\230\350\256\244\350\267\257\347\224\261.md" new file mode 100644 index 0000000000000000000000000000000000000000..471200b28def1f526f20f1fe33269b19ae5bd10b --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250416 \351\273\230\350\256\244\350\267\257\347\224\261.md" @@ -0,0 +1,8 @@ +# 笔记 + +默认路由 + +``` +ip route 0.0.0.0 0.0.0.0 <下一跳地址> +``` + diff --git "a/19\351\203\221\351\233\250\350\211\257/20250417 \350\267\257\347\224\261\345\231\250\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272.md" "b/19\351\203\221\351\233\250\350\211\257/20250417 \350\267\257\347\224\261\345\231\250\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272.md" new file mode 100644 index 0000000000000000000000000000000000000000..f45480c3aa68e298db621b7173a73c7870558afa --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250417 \350\267\257\347\224\261\345\231\250\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272.md" @@ -0,0 +1,728 @@ +![image-20250416201428716](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250416_1744805699.png) + +路由器0 + +```cmd +Router>enable +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip add +Router(config-if)#ip address 192.168.10.254 255.255.255.0 +Router(config-if)#ex +Router(config)#int f0/1 +Router(config-if)#ip add +Router(config-if)#ip address 192.168.40.1 255.255.255.0 +Router(config-if)#ex +Router(config)#int f0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.40.2 +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.40.2 +Router(config)# +``` + +路由器1 + +```CMD +Router>enable +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int f0/0 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.20.254 255.255.255.0 +Router(config-if)#ex +Router(config)#int f0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#int f0/1 +Router(config-if)#no shut +Router(config-if)#no shutdown +Router(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.40.2 255.255.255.0 +Router(config-if)#ex +Router(config)#int f1/0 +Router(config-if)#no shut +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up +ip +% Incomplete command. +Router(config-if)#ip add +Router(config-if)#ip address 192.168.50.1 255.255.255.0 +Router(config-if)#ex +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.40.1 +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.50.2 +Router(config)# +``` + +路由器2 + +```CMD +Router>enable +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int f0/0 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip add +Router(config-if)#ip address 192.168.30.254 255.255.255.0 +Router(config-if)#ex +Router(config)#int f0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip add +Router(config-if)#ip address 192.168.50.2 255.255.255.0 +Router(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.50.1 +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.50.1 +Router(config)# +``` + + + +![image-20250416204457627](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250416_1744807497.png) + +路由器3 + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#f0/0 + ^ +% Invalid input detected at '^' marker. + +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up + +Router(config-subif)#en +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.10.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface f0/0.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up + +Router(config-subif)#encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.20.254 255.255.255.0 +Router(config-subif)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip rute + ^ +% Invalid input detected at '^' marker. + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.1 +C 192.168.20.0/24 is directly connected, FastEthernet0/0.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.70.1 255.255.255.0 +Router(config-if)#no shu +Router(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.70.2 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.70.2 +Router(config)#ip route 192.168.50.0 255.255.255.0 192.168.70.2 +Router(config)#ip route 192.168.60.0 255.255.255.0 192.168.70.2 +Router(config)# +``` + + + +路由器4 + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up + +Router(config-subif)#en +% Ambiguous command: "en" +Router(config)#interface f0/0.1 +Router(config-subif)#en +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.30.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#interface f0/0.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up +encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.40.254 255.255.255.0 +Router(config-subif)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.30.0/24 is directly connected, FastEthernet0/0.1 +C 192.168.40.0/24 is directly connected, FastEthernet0/0.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.80.1 255.255.255.0 +Router(config-if)#no sh +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.80.2 +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.80.2 +Router(config)#ip route 192.168.50.0 255.255.255.0 192.168.80.2 +Router(config)#ip route 192.168.60.0 255.255.255.0 192.168.80.2 +Router(config)# +Router# +%SYS-5-CONFIG_I: Configured from console by console + +``` + + + + + +路由器6 + +``` +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up + +Router(config-subif)#en +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.50.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#interface f0/0.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up + +Router(config-subif)#encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.60.254 255.255.255.0 +Router(config-subif)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.50.0/24 is directly connected, FastEthernet0/0.1 +C 192.168.60.0/24 is directly connected, FastEthernet0/0.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.90.1 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip route 192.168.10.0 255.255.255.0 192.168.90.2 +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.90.2 +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.90.2 +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.90.2 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.90.2 +Router(config)# +``` + + + + + +路由器5(核心) + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.70.2 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.80.2 255.255.255.0 +Router(config-if)#no shu + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f1/0 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.90.2 255.255.255.0 +Router(config-if)#no shu + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up + +Router(config-if)#ex +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.70.1 +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.70.1 +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.80.1 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.80.1 +Router(config)#ip route 192.168.50.0 255.255.255.0 192.168.90.1 +Router(config)#ip route 192.168.60.0 255.255.255.0 192.168.90.1 +Router(config)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.70.1 +S 192.168.20.0/24 [1/0] via 192.168.70.1 +S 192.168.30.0/24 [1/0] via 192.168.80.1 +S 192.168.40.0/24 [1/0] via 192.168.80.1 +S 192.168.50.0/24 [1/0] via 192.168.90.1 +S 192.168.60.0/24 [1/0] via 192.168.90.1 +C 192.168.70.0/24 is directly connected, FastEthernet0/0 +C 192.168.80.0/24 is directly connected, FastEthernet0/1 +C 192.168.90.0/24 is directly connected, FastEthernet1/0 + +Router# +``` + + + + + +# 笔记 + +router0 + +``` +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up + +Router(config-subif)#en +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip af +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.10.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.50.1 255.255.255.0 +Router(config-if)#ex +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.50.2 +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.50.2 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.50.2 +Router(config)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.1 +S 192.168.20.0/24 [1/0] via 192.168.50.2 +S 192.168.30.0/24 [1/0] via 192.168.50.2 +S 192.168.40.0/24 [1/0] via 192.168.50.2 +C 192.168.50.0/24 is directly connected, FastEthernet0/1 + +Router# +``` + + + + + +router 1 + +``` +Router(config-subif)#en +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)# +Router(config-subif)#ip af +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.20.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#interface f0/0.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up +encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.30.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.60.1 255.255.255.0 +Router(config-if)#ex +Router(config)#ip route192.168.10.0 255.255.255.0 192.168.60.2 + ^ +% Invalid input detected at '^' marker. + +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.60.2 +Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.60.2 +Router(config)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.60.2 +C 192.168.20.0/24 is directly connected, FastEthernet0/0.1 +C 192.168.30.0/24 is directly connected, FastEthernet0/0.2 +S 192.168.40.0/24 [1/0] via 192.168.60.2 +C 192.168.60.0/24 is directly connected, FastEthernet0/1 + +Router# +``` + + + +router 2 + +``` +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#itn +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#sw +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.40.254 255.255.255.0 +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no sh +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.70.1 255.255.255.0 +Router(config-if)#ex +Router(config)#ip route 192.168.10.0 255.255.255.0 192.168.70.2 +Router(config)#ip route 192.168.20.0 255.255.255.0 192.168.70.2 +Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.70.2 +Router(config)# +``` + +三层交换机 + +``` +Switch>en +Switch# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#int +Switch(config)#ip routing +Switch(config)#int +Switch(config)#interface f0/1 +Switch(config-if)#no sw +Switch(config-if)#no switchport +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Switch(config-if)#ip ad +Switch(config-if)#ip address 192.168.50.2 255.255.255.0 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/2 +Switch(config-if)#no sw +Switch(config-if)#no switchport +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up + +Switch(config-if)#ip ad +Switch(config-if)#ip address 192.168.60.2 255.255.255.0 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#no sw +Switch(config-if)#no switchport +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up + +Switch(config-if)#ip ad +Switch(config-if)#ip address 192.168.70.2 255.255.255.0 +Switch(config-if)#ex +Switch(config)#ip route 192.168.10.0 255.255.255.0 192.168.50.1 +Switch(config)#ip route 192.168.20.0 255.255.255.0 192.168.60.1 +Switch(config)#ip route 192.168.30.0 255.255.255.0 192.168.60.1 +Switch(config)#ip route 192.168.40.0 255.255.255.0 192.168.70.1 +Switch(config)#end +Switch# +%SYS-5-CONFIG_I: Configured from console by console + +Switch#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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.50.1 +S 192.168.20.0/24 [1/0] via 192.168.60.1 +S 192.168.30.0/24 [1/0] via 192.168.60.1 +S 192.168.40.0/24 [1/0] via 192.168.70.1 +C 192.168.50.0/24 is directly connected, FastEthernet0/1 +C 192.168.60.0/24 is directly connected, FastEthernet0/2 +C 192.168.70.0/24 is directly connected, FastEthernet0/3 + +Switch# +``` + +![image-20250417210714045](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250417_1744895234.png) + +![image-20250417210737979](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250417_1744895258.png) + +![image-20250417210758197](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250417_1744895278.png) \ No newline at end of file diff --git "a/19\351\203\221\351\233\250\350\211\257/20250418 RIP\345\212\250\346\200\201\350\267\257\347\224\261.md" "b/19\351\203\221\351\233\250\350\211\257/20250418 RIP\345\212\250\346\200\201\350\267\257\347\224\261.md" new file mode 100644 index 0000000000000000000000000000000000000000..8857eb85a2edf60c00353a5e841ac9fc509116c5 --- /dev/null +++ "b/19\351\203\221\351\233\250\350\211\257/20250418 RIP\345\212\250\346\200\201\350\267\257\347\224\261.md" @@ -0,0 +1,635 @@ +# 笔记 + +#### 第一题 + +路由器1 + +```cmd +Router>en +Router# +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.10.254 255.255.255.0 +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.10.1 255.255.255.0 +Router(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up +end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.10.0 is directly connected, FastEthernet0/1 +C 192.168.10.0/24 is directly connected, FastEthernet0/0 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#net +Router(config-router)#network 10.10.10.0 +Router(config-router)#network 192.168.10.0 +Router(config-router)# +``` + +路由器2 + +```cmd +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)# +Router(config)#conf t +%Invalid hex value +Router(config)#int +Router(config)#interface 10.10.10.2 255.255.255.0 + ^ +% Invalid input detected at '^' marker. + +Router(config)#interfac +Router(config)#interface f0/0 +Router(config-if)#ip ad 10.10.10.2 255.255.255.0 +Router(config-if)#ip ad 10.10.10.2 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ex +Router(config)#int +Router(config)#interface f0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.20.1 255.255.255.0 +Router(config-if)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.10.0 is directly connected, FastEthernet0/0 +C 10.10.20.0 is directly connected, FastEthernet0/1 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rout +Router(config)#router rip +Router(config-router)#ve +Router(config-router)#version 2 +Router(config-router)#net +Router(config-router)#network 10.10.10.0 +Router(config-router)#network 10.10.20.0 +Router(config-router)# + + + + + + + + +Router con0 is now available +``` + +路由器3 + +```cmd +Router>en +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.20.0 is directly connected, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#network 10.10.20.0 +Router(config-router)#network 192.168.20.0 +Router(config-router)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 2 subnets +R 10.10.10.0 [120/1] via 10.10.20.1, 00:00:05, FastEthernet0/0 +C 10.10.20.0 is directly connected, FastEthernet0/0 +R 192.168.10.0/24 [120/2] via 10.10.20.1, 00:00:05, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1 + +Router# +``` + +##### 测试结果 + +![image-20250418173638065](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250418_1744968998.png) + + + +#### 第三题 + +![image-20250418173546761](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250418_1744968951.png) + +三层交换机 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#route rip +Switch(config-router)#ver +Switch(config-router)#version 2 +Switch(config-router)#net +Switch(config-router)#network 192.168.10.0 +Switch(config-router)#network 192.168.40.0 +Switch(config-router)#network 10.10.1.0 + +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#ip routing +Switch(config)#route rip +Switch(config-router)#version 2 +Switch(config-router)#network 10.10.1.0 +Switch(config-router)#network 192.168.40.0 +Switch(config-router)#network 192.168.10.0 +Switch(config-router)#ex^Z +Switch# +%SYS-5-CONFIG_I: Configured from console by console + +Switch#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.1.0 is directly connected, FastEthernet0/2 +R 10.10.2.0 [120/1] via 10.10.1.2, 00:00:20, FastEthernet0/2 +C 192.168.10.0/24 is directly connected, Vlan10 +R 192.168.20.0/24 [120/1] via 10.10.1.2, 00:00:20, FastEthernet0/2 +R 192.168.30.0/24 [120/2] via 10.10.1.2, 00:00:20, FastEthernet0/2 +C 192.168.40.0/24 is directly connected, Vlan20 +R 192.168.50.0/24 [120/1] via 10.10.1.2, 00:00:20, FastEthernet0/2 + +Switch# + + +``` + +中间那台路由器 + +```cmd +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#interface f0/1 +Router(config-if)#no shutdown + +Router(config-if)#en +% Ambiguous command: "en" +Router(config)#int +Router(config)#interface f0/0.1 +Router(config-subif)#ex +Router(config)#no interface f0/0.1 +Router(config)# interface f0/1.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/1.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.1, changed state to up +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip address 192.168.20.254 255.255.255.0 +Router(config-subif)#ex +Router(config)# interface f0/1.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/1.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.2, changed state to up +encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.50.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface f0/0 +Router(config-if)#no shu +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.1.2 255.255.255.0 +Router(config-if)#ex +Router(config)#int +Router(config)#interface f1/0 +Router(config-if)#no shu + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.2.1 255.255.255.0 +Router(config-if)#no shu +Router(config-if)#no shutdown +Router(config-if)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#ne +Router(config-router)#network 10.10.1.0 +Router(config-router)#network 192.168.20.0 +Router(config-router)#network 192.168.50.0 +Router(config-router)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 1 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up +end +Translating "end"...domain server (255.255.255.255) % Name lookup aborted +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 10.10.2.0 is directly connected, FastEthernet1/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +R 192.168.30.0/24 [120/1] via 10.10.2.2, 00:00:24, FastEthernet1/0 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)# +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#ne +Router(config-router)#network 10.10.2.0 +Router(config-router)#^Z +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: C - connected, S - static, I - IGRP, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/24 is subnetted, 2 subnets +C 10.10.1.0 is directly connected, FastEthernet0/0 +C 10.10.2.0 is directly connected, FastEthernet1/0 +R 192.168.10.0/24 [120/1] via 10.10.1.1, 00:00:21, FastEthernet0/0 +C 192.168.20.0/24 is directly connected, FastEthernet0/1.1 +R 192.168.30.0/24 [120/1] via 10.10.2.2, 00:00:05, FastEthernet1/0 +R 192.168.40.0/24 [120/1] via 10.10.1.1, 00:00:21, FastEthernet0/0 +C 192.168.50.0/24 is directly connected, FastEthernet0/1.2 + +Router# + +``` + +右边 + +```cmd +Router(config-if)#ex +Router(config)#int +Router(config)#interface g0/0.1 +Router(config-subif)#en +Router(config-subif)#encapsulation fo +Router(config-subif)#encapsulation do +Router(config-subif)#encapsulation dot1Q 10 +Router(config-subif)#ip ad +Router(config-subif)#ip address 192.168.30.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#int +Router(config)#interface g0/0 /错了 + +Router(config-if)#no shut +Router(config-if)#no shutdown + +Router(config-if)# +%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up + +%LINK-5-CHANGED: Interface GigabitEthernet0/0.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.1, changed state to up + +Router(config-if)#ip ad +Router(config-if)#ip address 10.10.2.2 255.255.255.0 +Router(config-if)#ex +Router(config)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console +s +% Ambiguous command: "s" +Router# +Router#show ip route +Codes: L - local, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#rou +Router(config)#router rip +Router(config-router)#v +Router(config-router)#version 2 +Router(config-router)#ne +Router(config-router)#network 10.10.2.0 +Router(config-router)#network 192.168.30.0 +Router(config-router)#end +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: L - local, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:03, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:03, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:03, GigabitEthernet0/0 + +Router#show ip route +Codes: L - local, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:18, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:18, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:18, GigabitEthernet0/0 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#^Z +Router# +%SYS-5-CONFIG_I: Configured from console by console +Router#show ip route +Codes: L - local, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.10.0/24 [120/2] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/0.1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/0.1 +R 192.168.40.0/24 [120/2] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:26, GigabitEthernet0/0 + +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#no in +Router(config)#no interface g0/0.1 /这里才对 +Router(config)# +%LINK-3-UPDOWN: Interface GigabitEthernet0/0.1, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.1, changed state to down + +Router(config)#int g0/1 +Router(config-if)#ip ad +Router(config-if)#ip address 192.168.30.254 255.255.255.0 +Router(config-if)#exit +Router(config)#^Z +Router# +%SYS-5-CONFIG_I: Configured from console by console + +Router#show ip route +Codes: L - local, 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, E - EGP + i - IS-IS, 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 + + 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +R 10.10.1.0/24 [120/1] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 +C 10.10.2.0/24 is directly connected, GigabitEthernet0/0 +L 10.10.2.2/32 is directly connected, GigabitEthernet0/0 +R 192.168.10.0/24 [120/2] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 +R 192.168.20.0/24 [120/1] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 + 192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.30.0/24 is directly connected, GigabitEthernet0/1 +L 192.168.30.254/32 is directly connected, GigabitEthernet0/1 +R 192.168.40.0/24 [120/2] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 +R 192.168.50.0/24 [120/1] via 10.10.2.1, 00:00:01, GigabitEthernet0/0 + +Router# + +``` + +二层交换机 + +```cmd +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#int +Switch(config)#interface f0/2 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 10 +% Access VLAN does not exist. Creating vlan 10 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/3 +Switch(config-if)#sw +Switch(config-if)#switchport ac +Switch(config-if)#switchport access vlan 20 +% Access VLAN does not exist. Creating vlan 20 +Switch(config-if)#ex +Switch(config)#int +Switch(config)#interface f0/1 +Switch(config-if)#sw +Switch(config-if)#switchport m +Switch(config-if)#switchport mode +% Incomplete command. +Switch(config-if)#switchport mode t +Switch(config-if)#switchport mode trunk +``` + +#### 测试 + +![image-20250418173613395](https://gitee.com/tangyushan123/image/raw/master/img/upgit_20250418_1744968973.png) \ No newline at end of file