网络基础知识
上网用户基数:高并发
互联网时代:服务
- 问题:一台服务器解决不了
大数据
- 高并发>日志>分析行为>画像>推荐>服务
-
- 问卷调查:决策参考
负载均衡
- 四层(OSI):lvs:快:应付更大的流量
- 七层(OSI):nginx:慢于四层:看得懂客户端请求的资源
- 营销
网络TCP/IP基础知识
-
TCP/IP协议
-
OSI 7层参考模型(解耦)
-
-
应用层7 nginx 软件 http,smtp,ssh
-
表示层6
-
会话层5
-
传输层4 lvs 内核 【三次握手—(传输数据)—四次挥手】,tcp(面向连接,可靠),udp
-
-
-
SOCKET:IP:POST-IP:PORT
-
-
netstat -natp
-
[root@node01 sh]# netstat -natp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6549/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1229/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1069/master tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 12168/sshd tcp 0 288 192.168.159.97:22 192.168.159.1:49977 ESTABLISHED 12168/sshd tcp 0 0 :::22 :::* LISTEN 1229/sshd tcp 0 0 ::1:25 :::* LISTEN 1069/master tcp 0 0 ::1:6010 :::* LISTEN 12168/sshd
-
-
-
网络层3
-
-
ip,icmp
-
ROUTE
-
-
route -n
-
基于下一跳
-
#路由表 [root@node01 sh]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.159.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0 0.0.0.0 192.168.159.2 0.0.0.0 UG 0 0 0 eth0
-
-
NETMASK=255.255.255.0 //掩码与IP地址按位与获取网段
- 链路层2
-
- 以太网:Ethernet:MAC
- ARP:全F,两点通信,交换机学习
- arp -a
- 物理层1
[root@node01 sh]# arp -a
bogon (192.168.159.1) at 00:50:56:c0:00:08 [ether] on eth0
[root@node01 sh]# ping www.baidu.com
PING www.baidu.com (61.135.169.121) 56(84) bytes of data.
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=1 ttl=128 time=23.8 ms
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=2 ttl=128 time=23.6 ms
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=3 ttl=128 time=23.8 ms
^C
--- www.baidu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2214ms
rtt min/avg/max/mdev = 23.607/23.760/23.853/0.166 ms
[root@node01 sh]# arp -a
bogon (192.168.159.1) at 00:50:56:c0:00:08 [ether] on eth0
bogon (192.168.159.2) at 00:50:56:e1:2e:88 [ether] on eth0
整个互联网是建立在下一跳的模式下
- IP式逻辑上的两个端点
- MAC是物理上连接的两个节点
端点间TCP传输过程中
- 确认机制
- 状态机制
- 不可分割
解析数据包需要成本
- 交换机:二层,只关心MAC地址
-
- 学习机制
- 路由器:三层,只关心IP和路由表
- LVS服务器:四层,只关心PORT,状态
- nginx:七层,关心socket对应关系