henesyinit from p9fd787fda5 years agoHistory
926 lines · 21.1 KB · Text
RawDownload
.TH IP 3 .SH NAMEip \- network protocols over IP.SH SYNOPSIS.nf.B bind -a #I\fIspec\fP /net .B /net/ipifc.B /net/ipifc/clone.B /net/ipifc/stats.BI /net/ipifc/ n .BI /net/ipifc/ n /status.BI /net/ipifc/ n /ctl\&... .B /net/arp.B /net/log.B /net/ndb.B /net/iproute.B /net/ipselftab .B /net/esp.B /net/gre.B /net/icmp.B /net/il.B /net/ipmux.B /net/rudp.B /net/tcp.B /net/udp .B /net/tcp/clone.B /net/tcp/stats.BI /net/tcp/ n .BI /net/tcp/ n /data.BI /net/tcp/ n /ctl.BI /net/tcp/ n /local.BI /net/tcp/ n /remote.BI /net/tcp/ n /status.BI /net/tcp/ n /listen\&....fi.SH DESCRIPTIONThe IP device provides the interface to Internet protocol stacks..I Specis an integer from 0 to 15 identifying a stack.Each stack is physically independent of all others:the only information transfer between them is via programs thatmount multiple stacks.Normally a system uses only one stack.However multiple stacks can be used for debuggingnew IP networks or implementing firewalls or proxyservices..PPAll addresses used are 16-byte IPv6 addresses.  Thoughwe currently implement only IPv4, the IPv6 format is intended toprepare the way for an IPv6 implementation.  IPv4 addressesare a subset of the IPv6 addresses and both standard.SM ASCIIformatsare accepted.  In binary, all v4 addresses start with the12 bytes:.EX	00 00 00 00 00 00 00 00 00 00 ff ff.EE.SS "Configuring interfaces.PPEach stack may have multiple interfaces and each interfacemay have multiple addresses.The.B /net/ipifcdirectory contains a.B clonefile, a.B statsfile, and numbered subdirectories for each physical interface..PPOpening the.B clonefile reserves an interface.The file descriptor returned from the.IR open (2)will point to the control file,.BR ctl ,of the newly allocated interface.Reading.B ctlreturns a text string representing the number of the interface.Writing.B ctlalters aspects of the interface.The possible.I ctlmessages are:.TP.BI "bind ether " pathTreat the device mounted at.I pathas an Ethernet medium carrying IP and ARP packetsand associate it with this interface.The kernel will.IR dial (2).IR path !0x800and.IR path !0x806and use the two connections for IP andARP respectively..TP.B "bind pktTreat this interface as a packet interface.  Assumea user program will read and write the.I datafile to receive and transmit IP packets to the kernel.This is used by programs such as.IR ppp (8)to mediate IP packet transfer between the kernel anda PPP encoded device..TP.BI "bind netdev " pathTreat this interface as a packet interface.The kernel will open.I pathand read and write the resulting file descriptorto receive and transmit IP packets..TP.BI "bind loopback "Treat this interface as a local loopback.  Anythingwritten to it will be looped back..TP.B "unbindDisassociate the physical device from an IP interface..TP.BI add\  "local mask remote mtu " proxyAdd a local IP address to the interface.  The.IR mask ,.IR remote ,.IR mtu ,and.B proxyarguments are all optional.  The default mask isthe class mask for the local address.  The defaultremote address is.I localANDed with.IR mask .The default mtu is 1514 for Ethernet and 4096 for packetmedia..IR Proxy ,if specified, means that this machine should answerARP requests for the remote address..IR Ppp (8)does this to make remote machines appearto be connected to the local Ethernet..TP.BI remove\  "local mask"Remove a local IP address from an interface..TP.BI mtu\  nSet the maximum transfer unit for this device to.IR n .The mtu is the maximum size of the packet including anymedium-specific headers..TP.BI reassembleReassemble IP fragments before forwarding to this interface.TP.BI iprouting\  nAllow.RI ( n is missingor non-zero) or disallow.RI ( nis 0) forwarding packets between this interface andothers..TP.BI addmulti\  addrTreat the multicast.I addron this interface as a local address..TP.BI remmulti\  addrRemove the multicast address.I addrfrom this interface..PPReading the interface's.I statusfile returns information about the interface, one line for eachlocal address on that interface.  The first linehas 9 white-space-separated fields: device, mtu, local address,mask, remote or network address, packets in, packets out, input errors,output errors.  Each subsequent line contains all but the device and mtu.See.B readipifcin.IR ip (2)..SS "Routing.PPThe file.I iproutecontrols information about IP routing.When read, it returns one line per routing entry.Each line contains six white-space-separated fields:target address, target mask, address of next hop, flags,tag, and interface number.The entry used for routing an IP packet is the one withthe longest mask for which destination address ANDed withtarget mask equals the target address.The one character flags are:.TP.B 4IPv4 route.TP.B 6IPv6 route.TP.B ilocal interface.TP.B bbroadcast address.TP.B ulocal unicast address.TP.B mmulticast route.TP.B ppoint-to-point route.PPThe tag is an arbitrary, up to 4 character, string.  It is normally used toindicate what routing protocol originated the route..PPWriting to.B /net/iproutechanges the route table.  The messages are:.TP.B flushRemove all routes..TP.BI tag\  stringAssociate the tag,.IR string ,with all subsequent routes added via this file descriptor..TP.BI add\  "target mask nexthop"Add the route to the table.  If one already exists with thesame target and mask, replace it..TP.BI remove\  "target mask"Remove a route with a matching target and mask..SS "Address resolution.PPThe file.B /net/arpcontrols information about address resolution.The kernel automatically updates the ARP information for Ethernetinterfaces.When read, the file returns one line per address containing thetype of medium, the status of the entry (OK, WAIT), the IPaddress, and the medium address.Writing to.B /net/arpadministers the ARP information.  The control messages are:.TP.B flushRemove all entries..TP.BI add\  "type IP-addr Media-addr"Add an entry or replace an existing one for thesame IP address..PPARP entries do not time out.  The ARP table is acache with an LRU replacement policy.  The IP stacklistens for all ARP requests and, if the requester is inthe table, the entry is updated.Also, whenever a new address is configured onto anEthernet, an ARP request is sent to helpupdate the table on other systems..PPCurrently, the only medium type is.BR ether ..SS "Debugging and stack information.PPIf any process is holding.B /net/logopen, the IP stack queues debugging information to it.This is intended primarily for debugging the IP stack.The information provided is implementation-defined;see the source for details.  Generally, what is returned is error messagesabout bad packets..PPWriting to.B /net/logcontrols debugging.  The control messagesare:.TP.BI set\  arglist.I Arglistis a space-separated list of items for which to enable debugging.The possible items are:.BR ppp ,.BR ip ,.BR fs ,.BR tcp ,.BR il ,.BR icmp ,.BR udb ,.BR compress ,.BR ilmsg ,.BR gre ,.BR tcpmsg ,.BR udpmsg ,.BR ipmsg ,and.BR esp ..TP.BI clear\  arglist.I Arglistis a space-separated list of items for which to disable debugging..TP.BI only\  addrIf.I addris non-zero, restrict debugging to only thosepackets whose source or destination is thataddress..PPThe file.B /net/ndbcan be read or written byprograms.  It is normally used by.IR ipconfig (8)to leave configuration information for other programssuch as.B dnsand.B cs(see.IR ndb (8))..B /net/ndbmay contain up tp 1024 bytes..PPThe file.B /net/ipselftabis a read-only file containing all the IP addressesconsidered local.  Each line in the file containsthree white-space-separated fields: IP address, usage count,and flags.  The usage count is the number of interfaces to whichthe address applies.  The flags are the same as for routingentries..SS "Protocol directories.PPThe.I ipdevicesupports IP as well as several protocols that run over it:TCP, IL, UDP, GRE, ESP, ICMP, and RUDP.TCP and UDP provide the standard Internetprotocols for reliable stream and unreliable datagramcommunication.IL provides a reliable datagram service for communicationbetween Plan 9 machines.GRE is a general encapsulation protocol.ESP is the encapsulation protocol for IPSEC.ICMP is IP's catch-all control protocol used to sendlow level error messages and to implement.IR ping (8).RUDP is a locally developed reliable datagram protocol based onUDP..PPEach protocol is a subdirectory of the IP stack.The top level directory of each protocol contains a.B clonefile, a.B statsfile, and subdirectories numbered from zero to the number of connectionsopened for this protocol..PPOpening the.B clonefile reserves a connection.  The file descriptor returned from the.IR open (2)will point to the control file,.BR ctl ,of the newly allocated connection.Reading.B ctlreturns a textstring representing the number of theconnection.Connections may be used either to listen for incoming callsor to initiate calls to other machines..PPA connection is controlled by writing text strings to the associated.B ctlfile.After a connection has been established data may be read fromand written to.BR data .A connection can be actively established using the.B connectmessage (see also.IR dial (2)).A connection can be established passively by firstusing an.B announcemessage (see.IR dial (2))to bind to a local port and thenopening the.B listenfile (see.IR dial (2))to receive incoming calls..PPThe following control messages are supported:.TP.BI connect\  ipaddress ! port "!r " localEstablish a connection to the remote address.I ipaddressand remote port.IR port .If.I localis specified, it is used as the local port number.If.I localis not specified but.B !ris, the system will allocatea restricted port number (less than 1024) for the connection to allow communicationwith Unix  .B loginand.B execservices.Otherwise a free port number starting at 5000 is chosen.The connect fails if the combination of local and remote address/port pairsare already assigned to another port..TP.BI announce\  X.I Xis a decimal port number or.LR * .Set the local portnumber to.I Xand accept calls to.IR X .If.I Xis.LR * ,acceptcalls for any port that no process has explicitly announced.The local IP address cannot be set..B Announcefails if the connection is already announced or connected..TP.BI bind\  X.I Xis a decimal port number or.LR * .Set the local port number to.IR X .This exists to support emulationof BSD sockets by the APE libraries (see.IR pcc (1))and is not otherwise used..TP.BI backlog\  nSet the maximum number of unanswered (queued) incomingconnections to an announced port to.IR n .By default.I nis set to five.  If more than.I nconnections are pending,further requests for a service will be rejected..TP.BI ttl\  nSet the time to live IP field in outgoing packets to.IR n ..TP.BI tos\  nSet the service type IP field in outgoing packets to.IR n ..PPPort numbers must be in the range 1 to 32767..PPSeveral files report the status of aconnection.The.B remoteand.B localfiles contain the IP address and port number for the remote and local side of theconnection.  The.B status

Lines 1–500 of 926.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t