📄 ipnat.4
字号:
.\" $FreeBSD: src/contrib/ipfilter/man/ipnat.4,v 1.4.2.1 2001/02/17 20:36:26 darrenr Exp $.TH IPNAT 4.SH NAMEipnat \- Network Address Translation kernel interface.SH SYNOPSIS#include <netinet/ip_compat.h>.br#include <netinet/ip_fil.h>.br#include <netinet/ip_proxy.h>.br#include <netinet/ip_nat.h>.SH IOCTLS.PPTo add and delete rules to the NAT list, two 'basic' ioctls are providedfor use. The ioctl's are called as:.LP.nf ioctl(fd, SIOCADNAT, struct ipnat **) ioctl(fd, SIOCRMNAT, struct ipnat **) ioctl(fd, SIOCGNATS, struct natstat **) ioctl(fd, SIOCGNATL, struct natlookup **).fi.PPUnlike \fBipf(4)\fP, there is only a single list supported by the kernel NATinterface. An inactive list which can be swapped to is not currentlysupported.These ioctl's are implemented as being routing ioctls and thus the same rulesfor the various routing ioctls and the file descriptor are employed, mainlybeing that the fd must be that of the device associated with the module(i.e., /dev/ipl)..LP.PPThe structure used with the NAT interface is described below:.LP.nftypedef struct ipnat { struct ipnat *in_next; void *in_ifp; u_short in_flags; u_short in_pnext; u_short in_port[2]; struct in_addr in_in[2]; struct in_addr in_out[2]; struct in_addr in_nextip; int in_space; int in_redir; /* 0 if it's a mapping, 1 if it's a hard redir */ char in_ifname[IFNAMSIZ];} ipnat_t;#define in_pmin in_port[0] /* Also holds static redir port */#define in_pmax in_port[1]#define in_nip in_nextip.s_addr#define in_inip in_in[0].s_addr#define in_inmsk in_in[1].s_addr#define in_outip in_out[0].s_addr#define in_outmsk in_out[1].s_addr.fi.PPRecognised values for in_redir:.LP.nf#define NAT_MAP 0#define NAT_REDIRECT 1.fi.PP.LP\fBNAT statistics\fPStatistics on the number of packets mapped, going in and out are kept,the number of times a new entry is added and deleted (through expiration) tothe NAT table and the current usage level of the NAT table..PPPointers to the NAT table inside the kernel, as well as to the top of theinternal NAT lists constructed with the \fBSIOCADNAT\fP ioctls. The tableitself is a hash table of size NAT_SIZE (default size is 367)..PPTo retrieve the statistics, the \fBSIOCGNATS\fP ioctl must be used, withthe appropriate structure passed by reference, as follows:.nf ioctl(fd, SIOCGNATS, struct natstat *)typedef struct natstat { u_long ns_mapped[2]; u_long ns_added; u_long ns_expire; u_long ns_inuse; nat_t ***ns_table; ipnat_t *ns_list;} natstat_t;.fi.SH BUGSIt would be nice if there were more flexibility when adding and deletingfilter rules..SH FILES/dev/ipnat.SH SEE ALSOipf(4), ipnat(5), ipf(8), ipnat(8), ipfstat(8)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -