IP基础
互联网协议,IP协议栈(internet protocol)
- 无连接协议
- 结构化的编址,用于寻址和转发
- 尽力而为的逐跳转发
- 与媒介无关,但是可以适应多种数据链路
- IPv4和IPv6
IP(v4)地址格式和表示方法
- 网络号用于区分不同的IP网络
- 主机号用于标识该网络内的一个IP节点
- 掩码用于确认网络和主机,由连续的(2进制)1和0组成,其中1(对应的IP的部分)代表网络,0代表主机
- 192.168.1.100(点分十进制的32位),由掩码决定含义,切记没有掩码的IP都是耍流氓!
IPv4地址分类
特殊的IP地址
远程管理:
Telnet(23)
R1和SW1的管理VLAN1实现通信
R1作为一个被远程管理的设备
R1(config)#line vty 0 4
R1(config-line)#password qytang
R1(config-line)#login //开关
R1(config-line)#transport input telnet
测试:
SW1#telnet 10.1.11.1
Trying 10.1.11.1 ... Open
User Access Verification
Password:
R1>
验证:
R1#show users
Line User Host(s) Idle Location
* 0 con 0 idle 00:00:00
2 vty 0 idle 00:01:06 10.1.11.2
=================================
SSH(22)(secure shell)
思科设备
enable password cisco
hostname R1
ip domain name qytang
username ender password qytang
crypto key generate rsa
How many bits in the modulus [512]: 768
line vty 0 4
login local
transport input ssh
测试:
R2#ssh -l ender 202.100.1.1
Password:
查看和验证
R1#show users
Line User Host(s) Idle Location
0 con 0 idle 00:00:25
* 2 vty 0 ender idle 00:00:00 202.100.1.2
Interface User Mode Idle Peer Address
R1#show tcp brief
TCB Local Address Foreign Address (state)
E4AEEF00 202.100.1.1.22 202.100.1.2.52148 ESTAB
----------------------------
华为设备
aaa
local-user ender password cipher %$%$f+s:0d8G&Q8\"!WCcjAF~O6u%$%$
local-user ender privilege level 15
local-user ender service-type ssh
stelnet server enable
ssh user ender authentication-type password
user-interface vty 0 4
authentication-mode aaa
protocol inbound ssh
R2的测试:
[R2]ssh client first-time enable
[R2]stelnet 202.100.1.1
Please input the username:ender
Trying 202.100.1.1 ...
Press CTRL+K to abort
Connected to 202.100.1.1 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y
Oct 30 2019 21:25:08-08:00 R2 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[1]:The server had not been authenticated in the process of exchanging keys. When deciding whether to continue, the user chose Y.
[R2]
Save the server's public key? (y/n)[n]:y
The server's public key will be saved with the name 202.100.1.1. Please wait...
Oct 30 2019 21:25:13-08:00 R2 %%01SSH/4/SAVE_PUBLICKEY(l)[2]:When deciding whether to save the server's public key 202.100.1.1, the user chose Y.
[R2]
Enter password:
<HW-R1>system-view
Enter system view, return user view with Ctrl+Z.
[HW-R1]