暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

网络基础篇章

佐伊猫玖 2020-09-17
526

.如何通过网络实现两台主机间通讯
  1)通过网卡把二进制转换为高低电压
  2)当对端接收后网卡把高低电压转换为二进制信息

2.网线 双绞线
  共8芯 实际使用4芯  其他4芯 额外供电
  橙白 橙 绿白 蓝 蓝白 绿 棕白 棕
  其他4芯使用  反向供电  一根网线 当数据线当电源线
3.网卡的速率
  1Gbps    bit per second  没秒中传送的bit数据
  办理宽带 100M的宽带
  网络的单位计算 bit   1bit=1/8
  硬盘的单位计算 MB  byte 字节 1byte=8bit
4.什么是交换机
  实现一个网络内多台主机之间的通讯
  交换机的分类:
二层交换机 傻瓜式 只转发
三层交换机 转发数据 路由功能
四层交换机 转发数据 路由功能 策略控制
  1)多台PC如何通信
    a. 交换机
b. 通过广播的方式
  2) 不同局域网如何通信
c. 通过路由器的路由表 识别不同的局域网
   路由表
     1     1.1
2      2.1
   如何生成路由表
   1) 通过直连生成
   2) 通过静态路由 手工指定
   3) 通过动态路由 rip opsf eigrp(SICO) bgp isis
手动配置
第一台pc 192.168.1.1 网关 1.254
第二台pc 192.168.2.1 网关 2.254
网关 路由器
Router> # 用户模式 啥都不能干
Router> enable # 输入enable 进入特权模式
Router#
Router#configure terminal # 简写 conf t  进入到配置模式
Router(config)# # 配置模式
Router(config)#hostname R1 # 修改路由器的主机名
R1(config)#exit # 退出到特权模式

 R1(config)#interface G0/0 # 进入到G0/0端口
 R1(config-if)#ip ad
 R1(config-if)#ip address ?
  A.B.C.D IP address
  dhcp     IP Address negotiated via DHCP
 R1(config-if)#ip address
 R1(config-if)#ip address 192.168.1.254 ?
  A.B.C.D IP subnet mask
 R1(config-if)#ip address 192.168.1.254 255.255.255.0
 
 R1(config-if)#no shutdown # 开启端口
 Router#show ip route # 显示路由表
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.1.0/24 is directly connected, GigabitEthernet0/0
 L       192.168.1.254/32 is directly connected, GigabitEthernet0/0
  192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.2.0/24 is directly connected, GigabitEthernet0/1
 L       192.168.2.254/32 is directly connected, GigabitEthernet0/1
 
 路由表
  1.0 /24
  2.0 /24
 
 查看信息一定要到特权模式 #
 查看ip地址信息
 Router#show ip interface brief
 Interface             IP-Address     OK? Method Status               Protocol
 GigabitEthernet0/0     unassigned     YES unset administratively down down
 GigabitEthernet0/1     unassigned     YES unset administratively down down
 Vlan1                 unassigned     YES unset administratively down down

设备厂商 路由器 交换机 光设备
华为
cisco
中兴
H3C
锐捷
瑞斯康达
TP-LINK
爱立信  电话程控机
飞鱼星  路由器集成防火墙  访问控制

家用  傻瓜式
小米
TP-LINK
D-LINK
腾达
水星
海康威视 摄像头

运维重要性
     云计算  大数据  api接口 开发使用
KVM XEN
云计算目前拼的就是运维能力
互联网文化----屌丝
使用最廉价的服务器搭建出最智能的产品
3个9 4个9 5个9 _->>> 可靠性

如何成为高手?
一个时间只能做一件事情  脑袋每天最高效的时间2小时
意识
执行


1.如何通过网络实现两台主机间通讯
  1)通过网卡把二进制转换为高低电压
  2)当对端接收后网卡把高低电压转换为二进制信息

2.网线 双绞线
  共8芯 实际使用4芯  其他4芯 额外供电
  橙白 橙 绿白 蓝 蓝白 绿 棕白 棕
  其他4芯使用  反向供电  一根网线 当数据线当电源线
3.网卡的速率
  1Gbps    bit per second  没秒中传送的bit数据
  办理宽带 100M的宽带
  网络的单位计算 bit   1bit=1/8
  硬盘的单位计算 MB  byte 字节 1byte=8bit
4.什么是交换机
  实现一个网络内多台主机之间的通讯
  交换机的分类:
二层交换机 傻瓜式 只转发
三层交换机 转发数据 路由功能
四层交换机 转发数据 路由功能 策略控制
  1)多台PC如何通信
    a. 交换机
b. 通过广播的方式
  2) 不同局域网如何通信
c. 通过路由器的路由表 识别不同的局域网
   路由表
     1     1.1
2      2.1
   如何生成路由表
   1) 通过直连生成
   2) 通过静态路由 手工指定
   3) 通过动态路由 rip opsf eigrp(SICO) bgp isis
手动配置
第一台pc 192.168.1.1 网关 1.254
第二台pc 192.168.2.1 网关 2.254
网关 路由器
Router> # 用户模式 啥都不能干
Router> enable # 输入enable 进入特权模式
Router#
Router#configure terminal # 简写 conf t  进入到配置模式
Router(config)# # 配置模式
Router(config)#hostname R1 # 修改路由器的主机名
R1(config)#exit # 退出到特权模式

 R1(config)#interface G0/0 # 进入到G0/0端口
 R1(config-if)#ip ad
 R1(config-if)#ip address ?
  A.B.C.D IP address
  dhcp     IP Address negotiated via DHCP
 R1(config-if)#ip address
 R1(config-if)#ip address 192.168.1.254 ?
  A.B.C.D IP subnet mask
 R1(config-if)#ip address 192.168.1.254 255.255.255.0
 
 R1(config-if)#no shutdown # 开启端口
 Router#show ip route # 显示路由表
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.1.0/24 is directly connected, GigabitEthernet0/0
 L       192.168.1.254/32 is directly connected, GigabitEthernet0/0
  192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.2.0/24 is directly connected, GigabitEthernet0/1
 L       192.168.2.254/32 is directly connected, GigabitEthernet0/1
 
 路由表
  1.0 /24
  2.0 /24
 
 查看信息一定要到特权模式 #
 查看ip地址信息
 Router#show ip interface brief
 Interface             IP-Address     OK? Method Status               Protocol
 GigabitEthernet0/0     unassigned     YES unset administratively down down
 GigabitEthernet0/1     unassigned     YES unset administratively down down
 Vlan1                 unassigned     YES unset administratively down down

设备厂商 路由器 交换机 光设备
华为
cisco
中兴
H3C
锐捷
瑞斯康达
TP-LINK
爱立信  电话程控机
飞鱼星  路由器集成防火墙  访问控制

家用  傻瓜式
小米
TP-LINK
D-LINK
腾达
水星
海康威视 摄像头

广播: 我要找xxx

R1
1.0 2.0 # R1 路由表
G0/0 192.168.1.254 ---> 内网1.0网段连接
G0/1 192.168.2.2 ---> R2 G0/01 连接
ip route 192.168.4.0 255.255.255.0 192.168.2.3 # 静态路由 去往4.0网段的走2.3
R2
2.0 3.0 # R2 路由表
G0/0 192.168.2.3 ---> R1 G0/1 连接
G0/1 192.168.3.1     ---> R3 G0/0 连接
ip route 192.168.4.0 255.255.255.0 192.168.3.2 # 静态路由 去往3.0网段的走3.2
ip route 192.168.1.0 255.255.255.0 192.168.2.2 # 静态路由 去往1.0网段的走2.2
R3
3.0 4.0 # R3 路由表
G0/0 192.168.3.2 ---> R2 G0/1 连接
G0/1 192.168.4.254 ---> 内网4.0 网段连接
ip route 192.168.1.0 255.255.255.0 192.168.3.1 # 静态路由 去往1.0网段的走3.1

 show ip interface brief # 查看接口地址
 show running-config # 查看全局配置
 show ip route # 查看路由表信息
 
 R1#show ip route
  192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.1.0/24 is directly connected, GigabitEthernet0/0
 L       192.168.1.254/32 is directly connected, GigabitEthernet0/0
  192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.2.0/24 is directly connected, GigabitEthernet0/1
 L       192.168.2.2/32 is directly connected, GigabitEthernet0/1
 S   192.168.4.0/24 [1/0] via 192.168.2.3 # S 代表静态路由 static
 R2#show ip route
 S   192.168.1.0/24 [1/0] via 192.168.2.2
  192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.2.0/24 is directly connected, GigabitEthernet0/0
 L       192.168.2.3/32 is directly connected, GigabitEthernet0/0
  192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.3.0/24 is directly connected, GigabitEthernet0/1
 L       192.168.3.1/32 is directly connected, GigabitEthernet0/1
 S   192.168.4.0/24 [1/0] via 192.168.3.2
 R3#show ip route
  192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.3.0/24 is directly connected, GigabitEthernet0/0
 L       192.168.3.2/32 is directly connected, GigabitEthernet0/0
  192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
 C       192.168.4.0/24 is directly connected, GigabitEthernet0/1
 L       192.168.4.254/32 is directly connected, GigabitEthernet0/1
 S   192.168.1.0/24 [1/0] via 192.168.3.1

动态路由:
R1 挖掘机  塔吊车
    路由表 1.0  2.0 3.0 4.0
route rip # 配置动态协议 rip
network 192.168.1.0
network 192.168.2.0
R2 厨师    烧火
路由表 2.0 3.0 1.0 4.0
route rip
network 192.168.2.0
network 192.168.3.0
R3 电工    接线
路由表 3.0 4.0 2.0 1.0
route rip
network 192.168.3.0
network 192.168.4.0
协议: rip ospf eigrp bgp isis

 R1
 no ip route 192.168.4.0 255.255.255.0 192.168.2.3
 R2
 no ip route 192.168.4.0 255.255.255.0 192.168.3.2
 no ip route 192.168.1.0 255.255.255.0 192.168.2.2
 R3
 no ip route 192.168.1.0 255.255.255.0 192.168.3.1
 centos 指定静态路由 去往百度的 下一跳走10.0.1.254
 eth0 112.13.14.15 网关 112.13.14.15
 eth1 10.0.1.100   网关 10.0.1.254
 ip route add 14.215.177.39 via 10.0.1.254
 在table表里面添加一个表
 cat etc/iproute2/rt_tables 添加了一个200 优先级 test名字
 [root@alexlnb ~]#cat etc/iproute2/rt_tables
 #
 # reserved values
 #
 255local
 254main
 253default
 0unspec
 200tests
 
 centos 指定一条默认路由给 test表
 ip route add 0/0 via 10.0.1.1 table test
 源地址从10.0.2.2过来的数据包 默认的走test表
 ip rule add from 10.0.2.2 table test
 
 生产场景 PPTP 拨号
 1.vpn正常拨号
 2.ssh无法连接113.88.12.240 # 公司公网IP地址
  添加一个表 200优先级 ssh
  ip route add 0/0 via 39.107.76.254 table ssh
  ip rule add from 113.88.12.240 table ssh



文章转载自佐伊猫玖,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论