ipconfig 8.0 KB

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