协议规范

实现原理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
struct ppp_info{
int unit; /**/
int dev_fd; /**/
int lcp_fd; /**/
int ppp_fd; /**/
int remote_id; /**/
char *user; /* Username for authentication */
char *passwd; /* Password for authentication */
char *ifname;
char attach_inter[16];
unsigned char distance;
unsigned char weight;
unsigned char gateway;
unsigned char dns;
unsigned char auth;
unsigned char auth_type;
unsigned char down_flag; //避免PPP主动down掉和手动清除冲突
unsigned int unique;
unsigned int dns_value;
unsigned int wins_value;
char usergrp[MAXNAMELEN];
struct prefix_ipv4 localaddr;
unsigned int peer_address; //tunnip
int lcp_detect_interval_time; //for change interval time of lcp echo request
int lcp_detect_lost_times; //for change times of no respons lcp echo request
struct thread * lcp_thread;
struct thread * ipcp_rthread;
void *conn;
void *priv_data;
int natid;
int mtu;
Ppp_if_type iftype;
int (*manage_auto_down) (char *ifname);
int (*ipcp_up_cb) (struct ppp_cb_info *cb_info);
int (*ipcp_down_cb) (struct ppp_cb_info *cb_info);
int (*lcp_auth) (char *name, char *group, char *password, unsigned char *challenge, int unit, int type);
int (*check_rqci)(__u32 addr);
};

1,前提条件

环境 系统类型 本地用户 SSH服务端口
A机位于公司的NAT网络 安装在VMware里的Debian 8 64bit虚拟机 userA 22
B机是一台有公网IP的VPS CentOS 6 64bit userVPS 1022
C机位于家庭的NAT网络 Windows系统

实现目的:使得位于家庭NAT网络内的C机,可以SSH访问位于公司NAT网络内的A机。

简介:
前些天才知道, Linux 2.6.32 开始引入了一个 make localmodconfig 用于简化 kernel 的配置。
刚刚找了一下这个方面的资料,分享一下。

Most people uses the kernel shipped by distros - and that’s good. But some people like to compile their own kernels from kernel.org, or maybe they like following the Linux development and want to try it. Configuring your own kernel, however, has become a very difficult and tedious task - there’re too many options, and some times userspace software will stop working if you don’t enable some key option. You can use a standard distro .config file, but it takes too much time to compile all the options it enables.

To make the process of configuration easier, a new build target has been added: make localmodconfig. It runs “lsmod” to find all the modules loaded on the current running system. It will read all the Makefiles to map which CONFIG enables a module. It will read the Kconfig files to find the dependencies and selects that may be needed to support a CONFIG. Finally, it reads the .config file and removes any module “=m” that is not needed to enable the currently loaded modules. With this tool, you can strip a distro .config of all the unuseful drivers that are not needed in our machine, and it will take much less time to build the kernel. There’s an additional “make localyesconfig” target, in case you don’t want to use modules and/or initrds.