1
0

ipconfig 8.3 KB

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