12 2021 档案
摘要:发送端 #include <stdio.h> #include <stdlib.h> #include <unistd.h>// close() #include <string.h>// strcpy, memset(), and memcpy() #include <netdb.h> // st
阅读全文
摘要:#include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <time.h> #include <errno.h> #include <signal.h> #include <stdlib.h> #includ
阅读全文
摘要:#include <stdio.h> #include <sys/shm.h> #include <unistd.h> #include <string.h> int main() { key_t key; // 用于打开指定的共享内存 int shm_id; // 共享内存id char *p;
阅读全文
摘要:#include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> int main() { int fd[2]; char buf[1024]; memset(buf,'\0',sizeof(buf)); pi
阅读全文
摘要:getsockopt #include <stdio.h> #include <stdlib.h> #include <arpa/inet.h> union val { int i_val; long l_val; struct linger linger_val; struct timeval t
阅读全文
摘要:服务端 #include<stdio.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #include<strings.h> #include<sys/select.h> #include<sys/time
阅读全文
摘要:服务端 #include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/un.h> #define log(fmt,...) printf("%s:%d:"fmt"\n",__func__,__LINE_
阅读全文
摘要:服务端 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #define SERVER_PORT 8888 #define BUF
阅读全文
摘要:服务端 #include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <time.h> #include <errno.h> #include <signal.h> #include <stdlib.h> #in
阅读全文
摘要:timedatectl set-timezone Asia/Shanghai
阅读全文
摘要:discover报文分析 offer报文分析 request报文分析 ack报文分析
阅读全文
摘要:dhcp报文格式 各字段含义: options字段 Option id长度描述 1 4 子网掩码 3 n*4 网关地址 6 n*4 DNS服务器地址 7 n*4 日志服务器地址 26 2 接口MTU 33 n*8 静态路由 35 4 ARP缓存超时时间 42 n*4 NTP服务器地址 51 4 IP
阅读全文
摘要:dhcp基于UDP协议 服务器UDP端口:67 客户端UDP端口:68 正常的dhcp交互报文流程: 客户端 discover >服务器 客户端< offer 服务器 客户端 request >服务器 客户端< ack 服务器 1. 客户端:discover(客户端发起请求,广播自身的请求信息) 2
阅读全文
摘要:1 安装python3 #centos sudo yum install python3 #ubuntu sudo apt install python3 2 更新pip3 修改pip源 mkdir ~/.pip vim ~/.pip/pip.conf 添加以下内容 [global] timeout
阅读全文
摘要:1、IP 过滤 iptables -t filter -I FORWARD -p tcp -s 192.168.1.210 -m time --timestart 06:14 --timestop 07:12 --kerneltz --weekdays Mon.,Tues.,Wed. -j DROP
阅读全文
摘要:通用匹配 参数 解释 示例 p 指定协议 iptables -I INPUT -p tcp s 指定源地址 iptables -I INPUT -s 192.168.1.1 d 指定目的地址 iptables -I INPUT -d 192.168.1.1 i 指定进网口 iptables -I I
阅读全文
摘要:链操作 参数 解释 A 添加规则(也可以添加子链) D 删除规则(也可以删除子链) I 插入规则(也可以插入子链) N 新建子链 X 删除子链 F 清空子链 匹配成功操作 j 规则匹配成功之后的操作 规则匹配成功后的操作 ACCEPT 接收数据包 DROP 丢弃数据包(无回复) REJECT 拒绝数
阅读全文
摘要:一、查看帮助1.1 查看所有 iptables -h 1.2 查看版本 iptables -V 二、查看规则2.1 查看所有规则 iptables -L 2.2 查看filter表中的规则 iptables -t filter -L 三、链操作(默认操作filter表,需要操作其他表使用-t)3.1
阅读全文
摘要:一、四表五链 四表:(优先级由上至下) - raw - mangle - nat - filter(配置时默认的表) 五链: - INPUT - OUTPUT - FORWARD - PREROUTING - POSTROUTING 表中含有的链: 数据经过链的流程: 数据包经过每条链时都会匹配包含
阅读全文
摘要:1。生成公钥对 ssh-keygen -t rsa -C "注释" 查看并服务公钥内容 cat ~/.ssh/id_rsa.pub 将公钥加入到gitee
阅读全文
摘要:下载samba # centos sudo yum install -y samba # ubuntu sudo apt install -y samba 创建共享目录 mkdir /home/user/shared #user为用户名 chmod 777 /home/user/shared 修改s
阅读全文
摘要:开启防火墙 systemctl enable firewalld 关闭防火墙 systemctl disable firewalld
阅读全文
摘要:修改文件/etc/sysconfig/network-scripts/ifcfg-ens33 vim /etc/sysconfig/network-scripts/ifcfg-ens33 将文件内容修改为以下内容 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONL
阅读全文