用以下拓扑图为例,将PC1远程进入SW1与SW2,R1设备并进行配置
1.先配置所有设备的IP
注意SW1与SW2IP为同一个vlan1中,也就是默认vlan。配置vlan1的IP即可
PC1
SW1
Switch(config)#interface vlan1 //进入vlan1端口
Switch(config-if)#ip address 192.168.1.10 255.255.255.0 //配置IP
Switch(config-if)#no shutdown //激活端口
R1 g0/0
Router(config)#interface g0/0 //进入g0/0端口
Router(config-if)#ip address 192.168.1.254 255.255.255.0
Router(config-if)#no shutdown
R1 g0/1
Router(config-if)#interface g0/1
Router(config-if)#ip address 192.168.2.254 255.255.255.0
Router(config-if)#no shutdown
SW2
Switch(config)#interface vlan1
Switch(config-if)#ip address 192.168.2.20 255.255.255.0
Switch(config-if)#no shutdown
Switch(config)#ip default-gateway 192.168.2.254 //设置默认网关为192.168.2.254,注意在全局模式下输入这条命令
2.配置远程登录密码,配置进入特权模式密码。
特权模式:设备名称后边为#标志
SW1
Switch(config)#enable password 123456 //设置特权模式密码,所有的特权模式进入密码都为123456
Switch(config)#line vty 0 4 //进入远程接口
Switch(config-line)#password yuancheng //设置远程密码,所有远程密码都设为yuancheng
Switch(config-line)#exit //返回全局模式
Switch(config)#service password-encryption //将所有明文密码加密
Switch(config)#show running-config //查看正在运行的信息
........
enable password 7 08701E1D5D4C53 //设置的进入特权密码已经加密
........
line vty 0 4
password 7 0838594F071A0D121C0C //远程密码也已经加密
login
由于在设置特权模式密码与远程密码时,全部都是用的明文密码进行的传输,查看配置指令直接能看到所配置的密码,为了更加的安全,所有引用一条将明文密码加密的指令。
R1
Router(config)#enable password 123456
Router(config)#line vty 0 4
Router(config-line)#password yuancheng
Router(config)#service password-encryption
SW2
Switch(config)#enable password 123456
Switch(config)#line vty 0 4
Switch(config-line)#password yuancheng
Switch(config-line)#exit
Switch(config)#service password-encryption
注意:所有配置完成后,一定要先激活端口,否则后续拍错时候很麻烦!激活后可以在特权模式下输入write保存。有些时候面试时或者考证时write认可度不高,在特权模式下输入copy running-config startup-config,进行保存。
3.用PC1远程登录三台设备
发布者:admin,转转请注明出处:http://www.yc00.com/web/1742337104a4424868.html
评论列表(0条)