ipconfig 8.0 KB

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