ipconfig 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. .TH IPCONFIG 8
  2. .SH NAME
  3. ipconfig, rip, linklocal, ipv6on \- Internet configuration and routing
  4. .SH SYNOPSIS
  5. .in +0.25i
  6. .ti -0.25i
  7. .B ip/ipconfig
  8. .RB [ -6DGNOPdnpruX ]
  9. .RB [ -b
  10. .IR baud ]
  11. .RB [ -c
  12. .IR ctl ]
  13. .RB [ -g
  14. .IR gateway ]
  15. .RB [ -h
  16. .IR host ]
  17. .RB [ -m
  18. .IR mtu ]
  19. .RB [ -o
  20. .IR dhcp-opt ]
  21. .RB [ -x
  22. .IR netmtpt ]
  23. [
  24. .I type
  25. [
  26. .I device
  27. ]\|]
  28. .RI [ verb ]
  29. .br
  30. [
  31. .I local
  32. [
  33. .I mask
  34. [
  35. .I remote
  36. [
  37. .I file-server
  38. [
  39. .I auth
  40. ]\|]\|]\|]\|]
  41. .PP
  42. .B ip/rip
  43. .RB [ -bdr ]
  44. .RB [ -x
  45. .IR netmtpt ]
  46. .PP
  47. .B ip/linklocal
  48. .I mac
  49. \&...
  50. .PP
  51. .B ipv6on
  52. [
  53. .I netmtpt
  54. .I ndbfile
  55. [
  56. .I gwv4
  57. ]\|]
  58. .SH DESCRIPTION
  59. .I Ipconfig
  60. binds a device interface (default
  61. .BR /net/ether0 )
  62. to a mounted IP stack (default
  63. .BR /net )
  64. and configures the interface with a local address and optionally
  65. a mask, a remote address, a file server and an authentication server address.
  66. The addresses can be specified in the command line or obtained via DHCP.
  67. If DHCP is requested, it will also obtain the addresses of DNS
  68. servers, NTP servers, gateways, a Plan 9 file server,
  69. and a Plan 9 authentication server.
  70. If this is the first non-loopback
  71. interface on the IP stack, the information will be written to
  72. .B /net/ndb
  73. in the form of an
  74. .IR ndb (8)
  75. entry.
  76. .PP
  77. .I Type
  78. may be
  79. .BR ether ,
  80. .BR gbe ,
  81. .BR ppp ,
  82. or
  83. .BR loopback .
  84. The
  85. .B gbe
  86. type is equivalent to
  87. .B ether
  88. except that it allows jumbo packets (up to ~9KB).
  89. For
  90. .B ppp
  91. the device can be any byte stream device.
  92. .PP
  93. The verb (default
  94. .IR add )
  95. determines the action performed. The usual verbs are:
  96. .TF remove
  97. .TP
  98. .B add
  99. if the device is not bound to the IP stack, bind it.
  100. Add the given local address, mask, and remote address to the interface.
  101. An interface may have multiple addresses.
  102. .TP
  103. .B remove
  104. remove the address from the device interface.
  105. .TP
  106. .B unbind
  107. unbind the device interface and all its addresses from the
  108. IP stack.
  109. .PD
  110. .PP
  111. The IPv6-specific verbs, which take different arguments, are:
  112. .TP
  113. .BI "add6 " "prefix pfx-len onlink auto validlt preflt"
  114. sets the named IPv6 parameters; see
  115. .IR ip (3)
  116. for more detail.
  117. .TP
  118. .BI "ra6 " "[ keyword value ] ..."
  119. sets IPv6 router advertisement parameter
  120. .IR keyword 's
  121. .IR value .
  122. See
  123. .IR ip (3)
  124. for more detail.
  125. Setting
  126. .I recvra
  127. non-zero also forks a process to
  128. receive and process router advertisements.
  129. Setting
  130. .I sendra
  131. non-zero also
  132. enables IP routing on the interface,
  133. forks a process to send router advertisements,
  134. and if no
  135. .I recvra
  136. process is running, forks one.
  137. .PD
  138. .PP
  139. The options are:
  140. .TF M
  141. .PD
  142. .TP
  143. .B 6
  144. if adding an address (the default action),
  145. add the IPv6 link-local address.
  146. .TP
  147. .B b
  148. the baud rate to use on a serial line
  149. when configuring
  150. .BR PPP .
  151. .TP
  152. .B c
  153. write the control string
  154. .I ctl
  155. to the ethernet device control file before starting to configure it.
  156. May be repeated to specify multiple control writes.
  157. .TP
  158. .B d
  159. use DHCP to determine any unspecified configuration parameters.
  160. .TP
  161. .B D
  162. turn on debugging.
  163. .TP
  164. .B g
  165. the default gateway.
  166. .TP
  167. .B G
  168. use only generic DHCP options. Without this option,
  169. .I ipconfig
  170. adds to requests a Vendor Class option with value
  171. .BI plan9_$ cputype
  172. and also requests vendor specific options 128 and 129 which we
  173. interpret as the Plan 9 file server and auth server.
  174. Replies to these options contain a list of IP addresses for possible
  175. file servers and auth servers.
  176. .TP
  177. .B h
  178. the hostname to add to DHCP requests. Some DHCP
  179. servers, such as the one used by Comcast, will not respond
  180. unless a correct hostname is in the request.
  181. .TP
  182. .B m
  183. the maximum IP packet size to use on this interface.
  184. .TP
  185. .B n
  186. determine parameters but don't configure the interface.
  187. .TP
  188. .B N
  189. look in
  190. .B /lib/ndb
  191. for the IP parameters. This only works if the
  192. interface is an ethernet. It uses the ethernet address to find
  193. a matching entry.
  194. .TP
  195. .B O
  196. addresses specified on the command line override those obtained via DHCP.
  197. A command line address of 0 implies no override.
  198. .TP
  199. .B p
  200. write configuration information to
  201. .BR /net/ndb ,
  202. even if other network interfaces are already configured
  203. .TP
  204. .B P
  205. do not write configuration information to
  206. .BR /net/ndb ,
  207. even if this is the first network interface to be configured
  208. .TP
  209. .B r
  210. by default,
  211. .I ipconfig
  212. exits after trying DHCP for 15 seconds with no answer.
  213. This option directs
  214. .I ipconfig
  215. instead to fork a background process that keeps trying forever.
  216. .TP
  217. .B u
  218. disable IPv6 duplicate discovery detection,
  219. which removes any existing ARP table entry for one of our IPv6 addresses
  220. before adding new ones.
  221. .TP
  222. .B x
  223. use the IP stack mounted at
  224. .I netmtpt
  225. instead of at
  226. .BR /net .
  227. .TP
  228. .B X
  229. don't fork a process to keep the DHCP lease alive.
  230. .TP
  231. .B o
  232. adds
  233. .I dhcpoption
  234. to the list of paramters requested of the DHCP server. The
  235. result will appear in
  236. .B /net/ndb
  237. should this be the first interface. The known options are:
  238. .RS
  239. .LP
  240. .ft L
  241. arptimeout, baddr, bflen, bootfile, clientid, cookie, discovermask,
  242. discoverrouter, dns, dom, dumpfile, etherencap, extpath, finger,
  243. homeagent, impress, ipaddr, ipforward, ipgw, ipmask, irc, lease, log,
  244. lpr, maxdatagram, maxmsg, message, mtu, name, netbiosdds, netbiosns,
  245. netbiosscope, netbiostype, ni, nisdomain, nisplus, nisplusdomain,
  246. nntp, nonlocal, ntp, overload, params, pathplateau, pathtimeout,
  247. policyfilter, pop3, rebindingtime, renewaltime, rl, rootpath, rs,
  248. serverid, smtp, st, staticroutes, stdar, subnetslocal, supplymask,
  249. swap, sys, tcpka, tcpkag, tcpttl, tftp, time, timeoff, trailerencap,
  250. ttl, type, vendorclass, www, xdispmanager, xfont
  251. .RE
  252. .IP
  253. The options
  254. .BR ipmask ,
  255. .BR ipgw ,
  256. .BR dns ,
  257. .BR sys ,
  258. and
  259. .B ntp
  260. are always requested.
  261. .TF M
  262. .PD
  263. .PP
  264. If DHCP is requested, a process is forked
  265. off to renew the lease before it
  266. runs out. If the lease does run out, this
  267. process will remove any configured addresses
  268. from the interface.
  269. .PP
  270. .I Rip
  271. runs the routing protocol RIP.
  272. It listens for RIP packets on connected networks and
  273. updates the kernel routing tables.
  274. The options are:
  275. .TF M
  276. .PD
  277. .TP
  278. .B b
  279. broadcasts routing information onto the networks.
  280. .TP
  281. .B n
  282. gathers routing information but doesn't write to the
  283. route table. This is useful with
  284. .B \-d
  285. to debug a network.
  286. .TP
  287. .B x
  288. use the IP stack mounted at
  289. .I netmtpt
  290. instead of at
  291. .BR /net .
  292. .TP
  293. .B d
  294. turn on (voluminous) debugging.
  295. .PP
  296. .I Linklocal
  297. prints the IPv6 link-local address corresponding to the given
  298. .I mac
  299. address.
  300. .PP
  301. .I Ipv6on
  302. uses the network database at
  303. .I ndbfile
  304. to configure the network mounted on
  305. .I netmtpt
  306. with a link-local address (derived from its MAC address)
  307. and attempts to add a default IPv6 route to the local
  308. IPv4 gateway's IPv6 address.
  309. If
  310. .I gwv4
  311. is supplied, it will be used as the gateway IPv4 address.
  312. .SH EXAMPLES
  313. Configure Ethernet 0 as the primary IP interface.
  314. Get all addresses via DHCP. Start up a connection server
  315. and DNS resolver for this IP stack.
  316. .IP
  317. .EX
  318. % bind -b '#l0' /net
  319. % bind -a '#I0' /net
  320. % ip/ipconfig
  321. % ndb/cs
  322. % ndb/dns -r
  323. .EE
  324. .PP
  325. Add a second address to the stack.
  326. .IP
  327. .EX
  328. % ip/ipconfig ether /net/ether0 add 12.1.1.2 255.255.255.0
  329. .EE
  330. .PP
  331. At Bell Labs, our primary IP stack is always to the company's internal
  332. firewall-protected network. The following creates an external
  333. IP stack to directly access the outside Internet. Note that the
  334. connection server uses a different set of
  335. .I ndb
  336. files. This prevents us from confusing inside and outside name/address
  337. bindings.
  338. .IP
  339. .EX
  340. % bind -b '#l1' /net.alt
  341. % bind -b '#I1' /net.alt
  342. % ip/ipconfig -x /net.alt -g 204.178.31.1 ether /net.alt/ether1\\
  343. 204.178.31.6 255.255.255.0
  344. % ndb/cs -x /net.alt -f /lib/ndb/external
  345. % ndb/dns -sx /net.alt -f /lib/ndb/external
  346. % aux/listen -d /rc/bin/service.alt /net.alt/tcp
  347. .EE
  348. .PP
  349. Get all addresses via DHCP.
  350. Configure the IPv6 link-local address automatically
  351. and listen for router announcements.
  352. .IP
  353. .EX
  354. ip/ipconfig -6
  355. ip/ipconfig ra6 recvra 1
  356. .EE
  357. .SH FILES
  358. .B /sys/log/v6routeradv
  359. .SH SOURCE
  360. .B /sys/src/cmd/ip/ipconfig
  361. .br
  362. .B /sys/src/cmd/ip/rip.c
  363. .br
  364. .B /sys/src/cmd/ip/linklocal.c
  365. .br
  366. .B /rc/bin/ipv6on
  367. .SH "SEE ALSO"
  368. .IR ether (3),
  369. .IR ip (3),
  370. .IR loopback (3),
  371. .IR ndb (6),
  372. .IR dhcpd (8),
  373. .IR ppp (8)