三层路由器,SSH远程登录访问路由器,通过telnet远程登录访问路由器(不安全),路由器的基本设置之多网络互联解决办法:单臂路由

三层路由器

  • 默认路由器端口关闭:no shutdown (开启)需进入端口
  • 默认路由开启:无需 ip routing
  • 路由器充当网关,可以连接不同网络
  • 接口种类丰富,数量少

SSH远程登录访问路由器

  • 记得设IP
TypeScript 复制代码
Would you like to enter the initial configuration dialog? [yes/no]: no


Press RETURN to get started!



Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R
R(config)#ip domain-name mx.com
R(config)#crypto key generate rsa 
How many bits in the modulus [512]: 2048
% Generating 2048 bit RSA keys, keys will be non-exportable...[OK]
R(config)#username admin secret 111
R(config)#ip ssh version 2
R(config)#interface f0/0
R(config-if)#ip address 192.168.10.254 255.255.255.0
R(config-if)#no shutdown

R(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

R(config-if)#exit
R(config)#line vty 0 15
R(config-line)#transport input ssh //指定SSH协议
R(config-line)#login local  //允许本地登录
R(config-line)#enable secret 222
  • 先ping通自己(192.168.10.1),再ping通网关(192.168.10.254)

  • 登录:ssh -l admin 192.168.254 (这里是用网关登录)admin是前面设定的用户名

  • 上面username admin secret 111username 后面就是用户名

通过telnet远程登录访问路由器(不安全)

TypeScript 复制代码
Would you like to enter the initial configuration dialog? [yes/no]: no


Press RETURN to get started!

Router>en
Router#conf t
Router(config)#interface f0/0                //路由器的端口号默认从0开始,网卡类型可能是G口
Router(config-if)#ip address 192.168.10.254 255.255.255.0    //配置路由器的端口IP
Router(config-if)#no shutdown            //开启端口
Router(config-if)#exit
Router(config)#line vty 0 4              //进入编号为0~4的vty线路配置模式
Router(config-line)#password 111             //设置密码
Router(config-line)#exit
Router(config)#service password-encryption      //启用全局密码加密功能
Router(config)#enable secret 456  // 设置特权模式的密码

路由器的基本设置之多网络互联

  • 路由器的接口非常少,当我想连接第三台确连不上该如何解决
TypeScript 复制代码
interface f0/0
ip address 192.168.10.254 255.255.255.0
no shutdown 
exit
interface f0/1
ip address 192.168.20.254 255.255.255.0
no shutdown 
  • 解决办法:单臂路由

  • 交换机

    TypeScript 复制代码
    Switch>en
    Switch#conf t
    Switch(config)#vlan 10         //创建 vlan 10
    Switch(config)#vlan 20          //创建 vlan 20
    Switch(config-vlan)#exit
    Switch(config)#int f0/2          // 进入 f0/2 端口
    Switch(config-if)#switchport access vlan 10    //将 f0/2 端口绑定到 vlan 10
    Switch(config-if)#exit
    Switch(config)#int f0/3           //进入 f0/3 端口
    Switch(config-if)#switchport access vlan 20       //将 f0/3 端口绑定到 vlan 20
    Switch(config-if)#exit
    Switch(config)#int f0/1           //进入 f0/1 端口      
    Switch(config-if)#switchport mode trunk           //将交换机 f0/1 端口配置连接模式为 trunk
  • 路由器

    TypeScript 复制代码
    Router>en
    Router#conf t
    Router(config)#interface g0/0        //进入路由器的 g0/0 端口
    Router(config-if)#no shutdown         //开启端口 
    Router(config-if)#exit
    Router(config)#interface g0/0.1           //进入路由器第 0 端口号的 0.1 子(逻辑)端口
    Router(config-subif)#encapsulation dotlq 10         //封装协议设置为 dotlq(中继封装)允许通过的 vlan 是 vlan10
    
    Router(config-subif)#ip address 192.168.10.254 255.255.255.0  //该子接口配置的IP地址
    
    Router(config-subif)#exit
    Router(config)#int g0/0.2       //进入路由器第 0 端口号的 0.2 子(逻辑)端口
    Router(config-subif)#encapsulation dotlq 20   //封装协议设置为 dotlq(中继封装)允许通过的 vlan 是 vlan20
    
    Router(config-subif)#ip address 192.168.20.254 255.255.255.0  //该子接口配置的IP地址
    Router(config-subif)#end
    Router#show ip route                 //查看路由表
相关推荐
杨云龙UP6 分钟前
Windows Server 2012 环境下 Oracle 11.2 使用 expdp 实现自动备份、异地复制与定期清理_20260504
服务器·数据库·windows·mysql·docker·oracle·容器
ACP广源盛139246256736 分钟前
一芯搞定多屏高清@ACP#GSV1221 DP 1.4 MST 转 HDMI 1.4 高集成转换芯片
网络·人工智能·嵌入式硬件·计算机外设·电脑
小风吹啊吹~17 分钟前
vscode的tunnel链接(Linux 服务器 + Windows 本地电脑版本)
服务器·vscode·microsoft·远程工作
Empty-Filled18 分钟前
AI Agent 测试入门:从回答问题到执行任务
网络·人工智能
Yupureki31 分钟前
《Linux网络编程》4.应用层HTTP协议
linux·服务器·c语言·网络·c++·http
剑锋所指,所向披靡!32 分钟前
计算机网络基础
计算机网络
m0_7381207235 分钟前
网路安全编程——熟悉并使用Scapy简单实现捕捉主流邮箱协议(SMTP、POP3和IMAP) 的身份凭证
网络·python·网络协议·tcp/ip·安全·网络安全
孙同学_40 分钟前
【Linux篇】网络层与数据链路层详解
linux·网络·智能路由器
youngerwang44 分钟前
【智能体互联网的基石:AI操作系统架构、Agent通信协议与演进路径综述】
网络·ai智能体·aios
小则又沐风a1 小时前
list模拟实现
java·服务器·list