ipconfig 8.1 KB

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