aboutsummaryrefslogtreecommitdiff
path: root/el_GR.ISO8859-7/books/handbook/network-servers/chapter.xml
blob: 88db7d10dacf9803a20ef6a2f80e2d26a96b2f3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
<?xml version="1.0" encoding="iso-8859-7"?>
<!--

  Ôï Åã÷åéñßäéï ôïõ FreeBSD: ÅîõðçñåôçôÝò Äéêôýïõ

  The FreeBSD Greek Documentation Project

  $FreeBSD$

  %SOURCE%	en_US.ISO8859-1/books/handbook/network-servers/chapter.xml
  %SRCID%	1.1

-->

<chapter id="network-servers">
  <chapterinfo>
    <authorgroup>
      <author>
        <firstname>Murray</firstname>
	<surname>Stokely</surname>
	<contrib>Áíáäéïñãáíþèçêå áðü ôïí </contrib>
      </author>
    </authorgroup>
    <!-- 23 July 2004 -->
  </chapterinfo>

  <title>ÅîõðçñåôçôÝò Äéêôýïõ</title>

  <sect1 id="network-servers-synopsis">
    <title>Óýíïøç</title>

    <para>Ôï êåöÜëáéï áõôü êáëýðôåé ïñéóìÝíåò áðü ôéò ðéï óõ÷íÜ
      ÷ñçóéìïðïéïýìåíåò äéêôõáêÝò õðçñåóßåò ôùí óõóôçìÜôùí &unix;. Èá
      ðáñïõóéÜóïõìå ôçí åãêáôÜóôáóç, ñýèìéóç, Ýëåã÷ï êáé óõíôÞñçóç ðïëëþí
      äéáöïñåôéêþí ôýðùí äéêôõáêþí õðçñåóéþí. Óå üëï ôï êåöÜëáéï, ãéá ôç
      äéêÞ óáò äéåõêüëõíóç, õðÜñ÷ïõí ðáñáäåßãìáôá äéáöüñùí áñ÷åßùí ñõèìßóåùí.</para>

    <para>Áöïý äéáâÜóåôå áõôü ôï êåöÜëáéï, èá îÝñåôå:</para>

    <itemizedlist>
      <listitem>
	<para>Ðùò íá äéá÷åéñßæåóôå ôçí õðçñåóßá <application>inetd</application>.</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ñõèìßóåôå Ýíá äéêôõáêü óýóôçìá áñ÷åßùí.</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ñõèìßóåôå Ýíá åîõðçñåôçôÞ äéêôõáêþí ðëçñïöïñéþí ãéá ôï
          äéáìïéñáóìü ëïãáñéáóìþí ÷ñçóôþí.</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ÷ñçóéìïðïéÞóåôå ôï DHCP ãéá ôçí áõôüìáôç ñýèìéóç ôùí
          ðáñáìÝôñùí ôïõ äéêôýïõ.</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ñõèìßóåôå Ýíá åîõðçñåôçôÞ ïíïìáóßáò ðåñéï÷þí (DNS).</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ñõèìßóåôå ôïí åîõðçñåôçôÞ
	  éóôïóåëßäùí <application>Apache</application>.</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ñõèìßóåôå Ýíá åîõðçñåôçôÞ ìåôáöïñÜò áñ÷åßùí (FTP).</para>
      </listitem>

      <listitem>
	<para>Ðùò íá ñõèìßóåôå Ýíá åîõðçñåôçôÞ áñ÷åßùí êáé åêôõðùôþí ãéá
          ðåëÜôåò &windows; ìå ÷ñÞóç ôçò åöáñìïãÞò <application>Samba</application>.</para>
      </listitem>

      <listitem>
	<para>Ðùò íá óõã÷ñïíßóåôå ôçí çìåñïìçíßá êáé ôçí þñá, êáé íá ñõèìßóåôå
          Ýíá åîõðçñåôçôÞ þñáò ìå ôç âïÞèåéá ôïõ NTP ðñùôïêüëëïõ.</para>
      </listitem>
    </itemizedlist>

    <para>Ðñéí äéáâÜóåôå áõôü êåöÜëáéï, èá ðñÝðåé:</para>

    <itemizedlist>
      <listitem>
	<para>Íá êáôáíïåßôå ôéò âáóéêÝò Ýííïéåò ôùí áñ÷åßùí script
	  <filename>/etc/rc</filename>.</para>
      </listitem>

      <listitem>
	<para>Íá åßóôå åîïéêåéùìÝíïé ìå ôç âáóéêÞ ïñïëïãßá ôùí äéêôýùí.</para>
      </listitem>

      <listitem>
      <para>Íá ãíùñßæåôå ðùò íá åãêáôáóôÞóåôå ðñüóèåôï ëïãéóìéêü ôñßôïõ
        êáôáóêåõáóôÞ (<xref linkend="ports"/>).</para>
      </listitem>
    </itemizedlist>
  </sect1>

  <sect1 id="network-inetd">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Chern</firstname>
          <surname>Lee</surname>
          <contrib>Contributed by </contrib>
        </author>
      </authorgroup>
      <authorgroup>
	<author>
	  <contrib>Updated for &os; 6.1-RELEASE by </contrib>
	  <othername>The &os; Documentation Project</othername>
	</author>
      </authorgroup>
    </sect1info>

    <title>The <application>inetd</application> <quote>Super-Server</quote></title>

    <sect2 id="network-inetd-overview">
      <title>Overview</title>

      <para>&man.inetd.8; is sometimes referred to as the <quote>Internet
	Super-Server</quote> because it manages connections for
	several services.  When a
	connection is received by <application>inetd</application>, it
	determines which program the connection is destined for, spawns
	the particular process and delegates the socket to it (the program
	is invoked with the service socket as its standard input, output
	and error descriptors).  Running
	<application>inetd</application> for servers that are not heavily used can reduce the
	overall system load, when compared to running each daemon
	individually in stand-alone mode.</para>

      <para>Primarily, <application>inetd</application> is used to
	spawn other daemons, but several trivial protocols are handled
	directly, such as <application>chargen</application>,
	<application>auth</application>, and
	<application>daytime</application>.</para>

      <para>This section will cover the basics in configuring
	<application>inetd</application> through its command-line
	options and its configuration file,
	<filename>/etc/inetd.conf</filename>.</para>
    </sect2>

    <sect2 id="network-inetd-settings">
      <title>Settings</title>

      <para><application>inetd</application> is initialized through
	the &man.rc.8; system.  The
	<literal>inetd_enable</literal> option is set to
	<literal>NO</literal> by default, but may be turned on
	by <application>sysinstall</application> during installation,
	depending on the configuration chosen by the user.
	Placing:
	<programlisting>inetd_enable="YES"</programlisting> or
	<programlisting>inetd_enable="NO"</programlisting> into
	<filename>/etc/rc.conf</filename> will enable or disable
	<application>inetd</application> starting at boot time.
	The command:
	<programlisting>/etc/rc.d/inetd rcvar</programlisting>
	can be run to display the current effective setting.</para>

      <para>Additionally, different command-line options can be passed
	to <application>inetd</application> via the
	<literal>inetd_flags</literal> option.</para>
    </sect2>

    <sect2 id="network-inetd-cmdline">
      <title>Command-Line Options</title>

      <para>Like most server daemons, <application>inetd</application>
	has a number of options that it can be passed in order to
	modify its behaviour.  The full list of options reads:</para>

      <para><command>inetd</command> <option>[-d] [-l] [-w] [-W] [-c maximum] [-C rate] [-a address | hostname]
           [-p filename] [-R rate] [-s maximum] [configuration file]</option></para>

      <para>Options can be passed to <application>inetd</application> using the
	<literal>inetd_flags</literal> option in
	<filename>/etc/rc.conf</filename>.  By default,
	<literal>inetd_flags</literal> is set to
	<literal>-wW -C 60</literal>, which turns on TCP wrapping for
	<application>inetd</application>'s services, and prevents any
	single IP address from requesting any service more than 60 times
	in any given minute.</para>

      <para>Novice users may be pleased to note that
	these parameters usually do not need to be modified,
	although we mention the rate-limiting options below as
	they be useful should you find that you are receiving an
	excessive amount of connections.  A full list of options
	can be found in the &man.inetd.8; manual.</para>

      <variablelist>
	<varlistentry>
	  <term>-c maximum</term>

	  <listitem>
	    <para>Specify the default maximum number of simultaneous
	      invocations of each service; the default is unlimited.
	      May be overridden on a per-service basis with the
	      <option>max-child</option> parameter.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>-C rate</term>

	  <listitem>
	    <para>Specify the default maximum number of times a
	      service can be invoked from a single IP address in one
	      minute; the default is unlimited.  May be overridden on a
	      per-service basis with the
	      <option>max-connections-per-ip-per-minute</option>
	      parameter.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>-R rate</term>

	  <listitem>
	    <para>Specify the maximum number of times a service can be
	      invoked in one minute; the default is 256.  A rate of 0
	      allows an unlimited number of invocations.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>-s maximum</term>

	  <listitem>
	    <para>Specify the maximum number of times a service can be
	      invoked from a single IP address at any one time; the
	      default is unlimited.  May be overridden on a per-service
	      basis with the <option>max-child-per-ip</option>
	      parameter.</para>
	  </listitem>
	</varlistentry>
      </variablelist>
    </sect2>

    <sect2 id="network-inetd-conf">
      <!-- XXX This section isn't very clear, and could do with some lovin' -->
      <title><filename>inetd.conf</filename></title>

      <para>Configuration of <application>inetd</application> is
	done via the file <filename>/etc/inetd.conf</filename>.</para>

      <para>When a modification is made to
	<filename>/etc/inetd.conf</filename>,
	<application>inetd</application> can be forced to re-read its
	configuration file by running the command:</para>

      <example id="network-inetd-reread">
	<title>Reloading the <application>inetd</application>
	  configuration file</title>

	<screen>&prompt.root; <userinput>/etc/rc.d/inetd reload</userinput></screen>
      </example>

      <para>Each line of the configuration file specifies an
	individual daemon.  Comments in the file are preceded by a
	<quote>#</quote>.  The format of each entry in
	<filename>/etc/inetd.conf</filename> is as follows:</para>

      <programlisting>service-name
socket-type
protocol
{wait|nowait}[/max-child[/max-connections-per-ip-per-minute[/max-child-per-ip]]]
user[:group][/login-class]
server-program
server-program-arguments</programlisting>

      <para>An example entry for the &man.ftpd.8; daemon
	using IPv4 might read:</para>

      <programlisting>ftp     stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -l</programlisting>

      <variablelist>
	<varlistentry>
	  <term>service-name</term>

	  <listitem>
	    <para>This is the service name of the particular daemon.
	      It must correspond to a service listed in
	      <filename>/etc/services</filename>.  This determines
	      which port <application>inetd</application> must listen
	      to.  If a new service is being created, it must be
	      placed in <filename>/etc/services</filename>
	      first.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>socket-type</term>

	  <listitem>
	    <para>Either <literal>stream</literal>,
	      <literal>dgram</literal>, <literal>raw</literal>, or
	      <literal>seqpacket</literal>.  <literal>stream</literal>
	      must be used for connection-based, TCP daemons, while
	      <literal>dgram</literal> is used for daemons utilizing
	      the <acronym>UDP</acronym> transport protocol.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>protocol</term>

	  <listitem>
	    <para>One of the following:</para>

	    <informaltable frame="none" pgwide="1">
	      <tgroup cols="2">
		<thead>
		  <row>
		    <entry>Protocol</entry>
		    <entry>Explanation</entry>
		  </row>
		</thead>
		<tbody>
		  <row>
		    <entry>tcp, tcp4</entry>
		    <entry>TCP IPv4</entry>
		  </row>
		  <row>
		    <entry>udp, udp4</entry>
		    <entry>UDP IPv4</entry>
		  </row>
		  <row>
		    <entry>tcp6</entry>
		    <entry>TCP IPv6</entry>
		  </row>
		  <row>
		    <entry>udp6</entry>
		    <entry>UDP IPv6</entry>
		  </row>
		  <row>
		    <entry>tcp46</entry>
		    <entry>Both TCP IPv4 and v6</entry>
		  </row>
		  <row>
		    <entry>udp46</entry>
		    <entry>Both UDP IPv4 and v6</entry>
		  </row>
		</tbody>
	      </tgroup>
	    </informaltable>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>{wait|nowait}[/max-child[/max-connections-per-ip-per-minute[/max-child-per-ip]]]</term>

	  <listitem>
	    <para><option>wait|nowait</option> indicates whether the
	      daemon invoked from <application>inetd</application> is
	      able to handle its own socket or not.
	      <option>dgram</option> socket types must use the
	      <option>wait</option> option, while stream socket
	      daemons, which are usually multi-threaded, should use
	      <option>nowait</option>.  <option>wait</option> usually
	      hands off multiple sockets to a single daemon, while
	      <option>nowait</option> spawns a child daemon for each
	      new socket.</para>

	    <para>The maximum number of child daemons
	      <application>inetd</application> may spawn can be set
	      using the <option>max-child</option> option.  If a limit
	      of ten instances of a particular daemon is needed, a
	      <literal>/10</literal> would be placed after
	      <option>nowait</option>.  Specifying <literal>/0</literal>
	      allows an unlimited number of children</para>

	    <para>In addition to <option>max-child</option>, two other
	      options which limit the maximum connections from a single
	      place to a particular daemon can be enabled.
	      <option>max-connections-per-ip-per-minute</option> limits
	      the number of connections from any particular IP address
	      per minutes, e.g. a value of ten would limit any particular
	      IP address connecting to a particular service to ten
	      attempts per minute.  <option>max-child-per-ip</option>
	      limits the number of children that can be started on
	      behalf on any single IP address at any moment. These
	      options are useful to prevent intentional or unintentional
 	      excessive resource consumption and Denial of Service (DoS)
	      attacks to a machine.</para>

	    <para>In this field, either of <option>wait</option> or
	      <option>nowait</option> is mandatory.
	      <option>max-child</option>,
	      <option>max-connections-per-ip-per-minute</option> and
	      <option>max-child-per-ip</option> are
	      optional.</para>

	    <para>A stream-type multi-threaded daemon without any
	      <option>max-child</option>,
	      <option>max-connections-per-ip-per-minute</option> or
	      <option>max-child-per-ip</option> limits
	      would simply be: <literal>nowait</literal>.</para>

	    <para>The same daemon with a maximum limit of ten daemons
	      would read: <literal>nowait/10</literal>.</para>

	    <para>The same setup with a limit of twenty
	      connections per IP address per minute and a maximum
	      total limit of ten child daemons would read:
	      <literal>nowait/10/20</literal>.</para>

	    <para>These options are utilized by the default
	      settings of the &man.fingerd.8; daemon,
	      as seen here:</para>

	    <programlisting>finger stream  tcp     nowait/3/10 nobody /usr/libexec/fingerd fingerd -s</programlisting>

	    <para>Finally, an example of this field with a maximum of
	      100 children in total, with a maximum of 5 for any one
	      IP address would read:
	      <literal>nowait/100/0/5</literal>.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>user</term>

	  <listitem>
	    <para>This is the username that the particular daemon
	      should run as.  Most commonly, daemons run as the
	      <username>root</username> user.  For security purposes, it is
	      common to find some servers running as the
	      <username>daemon</username> user, or the least privileged
	      <username>nobody</username> user.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>server-program</term>

	  <listitem>
	    <para>The full path of the daemon to be executed when a
	      connection is received.  If the daemon is a service
	      provided by <application>inetd</application> internally,
	      then <option>internal</option> should be
	      used.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term>server-program-arguments</term>

	  <listitem>
	    <para>This works in conjunction with
	      <option>server-program</option> by specifying the
	      arguments, starting with <literal>argv[0]</literal>,
	      passed to the daemon on invocation.  If
	      <command>mydaemon -d</command> is the command line,
	      <literal>mydaemon -d</literal> would be the value of
	      <option>server-program-arguments</option>.  Again, if
	      the daemon is an internal service, use
	      <option>internal</option> here.</para>
	  </listitem>
	</varlistentry>
      </variablelist>
    </sect2>

    <sect2 id="network-inetd-security">
      <title>Security</title>

      <para>Depending on the choices made at install time, many
	of <application>inetd</application>'s services may be enabled
	by default.  If there is no apparent need for a particular
	daemon, consider disabling it.  Place a <quote>#</quote> in front of the
	daemon in question in <filename>/etc/inetd.conf</filename>,
	and then <link linkend="network-inetd-reread">reload the
	inetd configuration</link>.  Some daemons, such as
	<application>fingerd</application>, may not be desired at all
	because they provide
	information that may be useful to an attacker.</para>

      <para>Some daemons are not security-conscious and have long, or
	non-existent, timeouts for connection attempts.  This allows an
	attacker to slowly send connections to a particular daemon,
	thus saturating available resources.  It may be a good idea to
	place <option>max-connections-per-ip-per-minute</option>,
	<option>max-child</option> or <option>max-child-per-ip</option> limitations on certain
	daemons if you find that you have too many connections.</para>

      <para>By default, TCP wrapping is turned on.  Consult the
	&man.hosts.access.5; manual page for more information on placing
	TCP restrictions on various <application>inetd</application>
	invoked daemons.</para>
    </sect2>

    <sect2 id="network-inetd-misc">
      <title>Miscellaneous</title>

      <para><application>daytime</application>,
	<application>time</application>,
	<application>echo</application>,
	<application>discard</application>,
	<application>chargen</application>, and
	<application>auth</application> are all internally provided
	services of <application>inetd</application>.</para>

      <para>The <application>auth</application> service provides
	identity
	network services, and is
	configurable to a certain degree, whilst the others are simply on or off.</para>

      <para>Consult the &man.inetd.8; manual page for more in-depth
	information.</para>
    </sect2>
  </sect1>

  <sect1 id="network-nfs">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Tom</firstname>
          <surname>Rhodes</surname>
          <contrib>Reorganized and enhanced by </contrib>
        </author>
      </authorgroup>
      <authorgroup>
        <author>
          <firstname>Bill</firstname>
      	  <surname>Swingle</surname>
	  <contrib>Written by </contrib>
        </author>
      </authorgroup>
    </sect1info>
    <title>Network File System (NFS)</title>

    <indexterm><primary>NFS</primary></indexterm>
    <para>Among the many different file systems that FreeBSD supports
      is the Network File System, also known as <acronym role="Network
      File System">NFS</acronym>.  <acronym role="Network File
      System">NFS</acronym> allows a system to share directories and
      files with others over a network.  By using <acronym
      role="Network File System">NFS</acronym>, users and programs can
      access files on remote systems almost as if they were local
      files.</para>

    <para>Some of the most notable benefits that
      <acronym>NFS</acronym> can provide are:</para>

    <itemizedlist>
      <listitem>
	<para>Local workstations use less disk space because commonly
	  used data can be stored on a single machine and still remain
	  accessible to others over the network.</para>
      </listitem>

      <listitem>
	<para>There is no need for users to have separate home
	  directories on every network machine.  Home directories
	  could be set up on the <acronym>NFS</acronym> server and
	  made available throughout the network.</para>
      </listitem>

      <listitem>
	<para>Storage devices such as floppy disks, CDROM drives, and
	  &iomegazip; drives can be used by other machines on the network.
	  This may reduce the number of removable media drives
	  throughout the network.</para>
      </listitem>
    </itemizedlist>

    <sect2>
      <title>How <acronym>NFS</acronym> Works</title>

      <para><acronym>NFS</acronym> consists of at least two main
        parts: a server and one or more clients.  The client remotely
        accesses the data that is stored on the server machine.  In
        order for this to function properly a few processes have to be
        configured and running.</para>

      <para>The server has to be running the following daemons:</para>
      <indexterm>
        <primary>NFS</primary>
        <secondary>server</secondary>
      </indexterm>
      <indexterm>
        <primary>file server</primary>
        <secondary>UNIX clients</secondary>
      </indexterm>

      <indexterm>
	<primary><application>rpcbind</application></primary>
      </indexterm>
      <indexterm>
        <primary><application>mountd</application></primary>
      </indexterm>
      <indexterm>
        <primary><application>nfsd</application></primary>
      </indexterm>

      <informaltable frame="none" pgwide="1">
	<tgroup cols="2">
	  <colspec colwidth="1*"/>
	  <colspec colwidth="3*"/>

	  <thead>
	    <row>
	      <entry>Daemon</entry>
	      <entry>Description</entry>
	    </row>
	  </thead>
	  <tbody>
	    <row>
	      <entry><application>nfsd</application></entry>
	      <entry>The <acronym>NFS</acronym> daemon which services
	      requests from the <acronym>NFS</acronym>
	      clients.</entry>
	    </row>
	    <row>
	      <entry><application>mountd</application></entry>
	      <entry>The <acronym>NFS</acronym> mount daemon which carries out
		the requests that &man.nfsd.8; passes on to it.</entry>
	    </row>
	    <row>
	      <entry><application>rpcbind</application></entry>
	      <entry> This daemon allows
	      <acronym>NFS</acronym> clients to discover which port
	      the <acronym>NFS</acronym> server is using.</entry>
	    </row>
	  </tbody>
	</tgroup>
      </informaltable>

      <para>The client can also run a daemon, known as
        <application>nfsiod</application>.  The
        <application>nfsiod</application> daemon services the requests
        from the <acronym>NFS</acronym> server.  This is optional, and
        improves performance, but is not required for normal and
        correct operation.  See the &man.nfsiod.8; manual page for
        more information.
      </para>
    </sect2>

    <sect2 id="network-configuring-nfs">
      <title>Configuring <acronym>NFS</acronym></title>
      <indexterm>
        <primary>NFS</primary>
        <secondary>configuration</secondary>
      </indexterm>

      <para><acronym>NFS</acronym> configuration is a relatively
        straightforward process.  The processes that need to be
        running can all start at boot time with a few modifications to
        your <filename>/etc/rc.conf</filename> file.</para>

      <para>On the <acronym>NFS</acronym> server, make sure that the
        following options are configured in the
        <filename>/etc/rc.conf</filename> file:</para>

      <programlisting>rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_flags="-r"</programlisting>

      <para><application>mountd</application> runs automatically
        whenever the <acronym>NFS</acronym> server is enabled.</para>

      <para>On the client, make sure this option is present in
        <filename>/etc/rc.conf</filename>:</para>

      <programlisting>nfs_client_enable="YES"</programlisting>

      <para>The <filename>/etc/exports</filename> file specifies which
        file systems <acronym>NFS</acronym> should export (sometimes
        referred to as <quote>share</quote>).  Each line in
        <filename>/etc/exports</filename> specifies a file system to be
        exported and which machines have access to that file system.
        Along with what machines have access to that file system,
        access options may also be specified.  There are many such
        options that can be used in this file but only a few will be
        mentioned here.  You can easily discover other options by
        reading over the &man.exports.5; manual page.</para>

      <para>Here are a few example <filename>/etc/exports</filename>
	entries:</para>

      <indexterm>
        <primary>NFS</primary>
        <secondary>export examples</secondary>
      </indexterm>

      <para>The following examples give an idea of how to export
        file systems, although the settings may be different depending
        on your environment and network configuration.  For instance,
        to export the <filename>/cdrom</filename> directory to three
        example machines that have the same domain name as the server
        (hence the lack of a domain name for each) or have entries in
        your <filename>/etc/hosts</filename> file.  The
        <option>-ro</option> flag makes the exported file system
        read-only.  With this flag, the remote system will not be able
        to write any changes to the exported file system.</para>

      <programlisting>/cdrom -ro host1 host2 host3</programlisting>

      <para>The following line exports <filename>/home</filename> to
	three hosts by IP address.  This is a useful setup if you have
	a private network without a <acronym>DNS</acronym> server
	configured.  Optionally the <filename>/etc/hosts</filename>
	file could be configured for internal hostnames; please review
	&man.hosts.5; for more information.  The
	<option>-alldirs</option> flag allows the subdirectories to be
	mount points.  In other words, it will not mount the
	subdirectories but permit the client to mount only the
	directories that are required or needed.</para>

      <programlisting>/home  -alldirs  10.0.0.2 10.0.0.3 10.0.0.4</programlisting>

      <para>The following line exports <filename>/a</filename> so that
	two clients from different domains may access the file system.
	The <option>-maproot=root</option> flag allows the
	<username>root</username> user on the remote system to write
	data on the exported file system as <username>root</username>.
	If the <literal>-maproot=root</literal> flag is not specified,
	then even if a user has <username>root</username> access on
	the remote system, he will not be able to modify files on
	the exported file system.</para>

      <programlisting>/a  -maproot=root  host.example.com box.example.org</programlisting>

      <para>In order for a client to access an exported file system,
	the client must have permission to do so.  Make sure the
	client is listed in your <filename>/etc/exports</filename>
	file.</para>

      <para>In <filename>/etc/exports</filename>, each line represents
	the export information for one file system to one host.  A
	remote host can only be specified once per file system, and may
	only have one default entry.  For example, assume that
	<filename>/usr</filename> is a single file system.  The
	following <filename>/etc/exports</filename> would be
	invalid:</para>

      <programlisting># Invalid when /usr is one file system
/usr/src   client
/usr/ports client</programlisting>

      <para>One file system, <filename>/usr</filename>, has two lines
	specifying exports to the same host, <hostid>client</hostid>.
        The correct format for this situation is:</para>

      <programlisting>/usr/src /usr/ports  client</programlisting>

      <para>The properties of one file system exported to a given host
	must all occur on one line.  Lines without a client specified
	are treated as a single host.  This limits how you can export
	file systems, but for most people this is not an issue.</para>

      <para>The following is an example of a valid export list, where
	<filename>/usr</filename> and <filename>/exports</filename>
	are local file systems:</para>

      <programlisting># Export src and ports to client01 and client02, but only
# client01 has root privileges on it
/usr/src /usr/ports -maproot=root    client01
/usr/src /usr/ports               client02
# The client machines have root and can mount anywhere
# on /exports. Anyone in the world can mount /exports/obj read-only
/exports -alldirs -maproot=root      client01 client02
/exports/obj -ro</programlisting>

      <para>The <application>mountd</application> daemon must be forced to
	recheck the <filename>/etc/exports</filename> file whenever it has
	been modified, so the changes can take effect.  This can be
	accomplished either by sending a HUP signal to the running daemon:</para>

      <screen>&prompt.root; <userinput>kill -HUP `cat /var/run/mountd.pid`</userinput></screen>

      <para>or by invoking the <command>mountd</command> &man.rc.8; script
        with the appropriate parameter:</para>

      <screen>&prompt.root; <userinput>/etc/rc.d/mountd onereload</userinput></screen>

      <para>Please refer to <xref linkend="configtuning-rcd"/> for more
	information about using rc scripts.</para>

      <para>Alternatively, a reboot will make FreeBSD set everything
        up properly.  A reboot is not necessary though.
        Executing the following commands as <username>root</username>
        should start everything up.</para>

      <para>On the <acronym>NFS</acronym> server:</para>

      <screen>&prompt.root; <userinput>rpcbind</userinput>
&prompt.root; <userinput>nfsd -u -t -n 4</userinput>
&prompt.root; <userinput>mountd -r</userinput></screen>

      <para>On the <acronym>NFS</acronym> client:</para>

      <screen>&prompt.root; <userinput>nfsiod -n 4</userinput></screen>

      <para>Now everything should be ready to actually mount a remote file
	system.  In these examples the
	server's name will be <hostid>server</hostid> and the client's
	name will be <hostid>client</hostid>.  If you only want to
	temporarily mount a remote file system or would rather test the
	configuration, just execute a command like this as <username>root</username> on the
        client:</para>
      <indexterm>
        <primary>NFS</primary>
        <secondary>mounting</secondary>
      </indexterm>
      <screen>&prompt.root; <userinput>mount server:/home /mnt</userinput></screen>

      <para>This will mount the <filename>/home</filename> directory
	on the server at <filename>/mnt</filename> on the client.  If
	everything is set up correctly you should be able to enter
	<filename>/mnt</filename> on the client and see all the files
        that are on the server.</para>

      <para>If you want to automatically mount a remote file system
	each time the computer boots, add the file system to the
	<filename>/etc/fstab</filename> file.  Here is an example:</para>

      <programlisting>server:/home	/mnt	nfs	rw	0	0</programlisting>

      <para>The &man.fstab.5; manual page lists all the available
        options.</para>
    </sect2>

    <sect2>
      <title>Locking</title>

      <para>Some applications (e.g. <application>mutt</application>)
	require file locking to operate correctly.  In the case of
	<acronym>NFS</acronym>, <application>rpc.lockd</application>
	can be used for file locking.  To enable it, add the following
	to the <filename>/etc/rc.conf</filename> file on both client
	and server (it is assumed that the <acronym>NFS</acronym>
	client and server are configured already):</para>

      <programlisting>rpc_lockd_enable="YES"
rpc_statd_enable="YES"</programlisting>

      <para>Start the application by using:</para>

      <screen>&prompt.root; <userinput>/etc/rc.d/nfslocking start</userinput></screen>

      <para>If real locking between the <acronym>NFS</acronym> clients
	and <acronym>NFS</acronym> server is not required, it is
	possible to let the <acronym>NFS</acronym> client do locking
	locally by passing <option>-L</option> to &man.mount.nfs.8;.
	Refer to the &man.mount.nfs.8; manual page for further details.
      </para>
    </sect2>

    <sect2>
      <title>Practical Uses</title>

      <para><acronym>NFS</acronym> has many practical uses.  Some of
        the more common ones are listed below:</para>

      <indexterm>
        <primary>NFS</primary>
        <secondary>uses</secondary>
      </indexterm>
      <itemizedlist>
        <listitem>
	  <para>Set several machines to share a CDROM or other media
	    among them.  This is cheaper and often a more convenient
	    method to install software on multiple machines.</para>
	</listitem>

	<listitem>
	  <para>On large networks, it might be more convenient to
	    configure a central <acronym>NFS</acronym> server in which
	    to store all the user home directories.  These home
	    directories can then be exported to the network so that
	    users would always have the same home directory,
	    regardless of which workstation they log in to.</para>
	</listitem>

	<listitem>
	  <para>Several machines could have a common
            <filename>/usr/ports/distfiles</filename> directory.  That
            way, when you need to install a port on several machines,
            you can quickly access the source without downloading it
            on each machine.</para>
	</listitem>
      </itemizedlist>
    </sect2>

    <sect2 id="network-amd">
      <sect2info>
	<authorgroup>
	  <author>
	    <firstname>Wylie</firstname>
	    <surname>Stilwell</surname>
	    <contrib>Contributed by </contrib>
	  </author>
	</authorgroup>
	<authorgroup>
	  <author>
	    <firstname>Chern</firstname>
	    <surname>Lee</surname>
	    <contrib>Rewritten by </contrib>
	  </author>
	</authorgroup>
      </sect2info>
      <title>Automatic Mounts with <application>amd</application></title>

      <indexterm><primary>amd</primary></indexterm>
      <indexterm><primary>automatic mounter daemon</primary></indexterm>

      <para>&man.amd.8; (the automatic mounter daemon)
	automatically mounts a
	remote file system whenever a file or directory within that
	file system is accessed.  Filesystems that are inactive for a
	period of time will also be automatically unmounted by
	<application>amd</application>.  Using
	<application>amd</application> provides a simple alternative
	to permanent mounts, as permanent mounts are usually listed in
        <filename>/etc/fstab</filename>.</para>

      <para><application>amd</application> operates by attaching
	itself as an NFS server to the <filename>/host</filename> and
	<filename>/net</filename> directories.  When a file is accessed
	within one of these directories, <application>amd</application>
	looks up the corresponding remote mount and automatically mounts
	it.  <filename>/net</filename> is used to mount an exported
	file system from an IP address, while <filename>/host</filename>
	is used to mount an export from a remote hostname.</para>

      <para>An access to a file within
	<filename>/host/foobar/usr</filename> would tell
	<application>amd</application> to attempt to mount the
	<filename>/usr</filename> export on the host
	<hostid>foobar</hostid>.</para>

      <example>
	<title>Mounting an Export with <application>amd</application></title>

	<para>You can view the available mounts of a remote host with
	  the <command>showmount</command> command.  For example, to
	  view the mounts of a host named <hostid>foobar</hostid>, you
	  can use:</para>

	<screen>&prompt.user; <userinput>showmount -e foobar</userinput>
Exports list on foobar:
/usr                               10.10.10.0
/a                                 10.10.10.0
&prompt.user; <userinput>cd /host/foobar/usr</userinput></screen>
      </example>

      <para>As seen in the example, the <command>showmount</command> shows
	<filename>/usr</filename> as an export.  When changing directories to
	<filename>/host/foobar/usr</filename>, <application>amd</application>
	attempts to resolve the hostname <hostid>foobar</hostid> and
	automatically mount the desired export.</para>

      <para><application>amd</application> can be started by the
	startup scripts by placing the following lines in
	<filename>/etc/rc.conf</filename>:</para>

      <programlisting>amd_enable="YES"</programlisting>

      <para>Additionally, custom flags can be passed to
      <application>amd</application> from the
      <varname>amd_flags</varname> option.  By default,
      <varname>amd_flags</varname> is set to:</para>

      <programlisting>amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"</programlisting>

      <para>The <filename>/etc/amd.map</filename> file defines the
	default options that exports are mounted with.  The
	<filename>/etc/amd.conf</filename> file defines some of the more
	advanced features of <application>amd</application>.</para>

      <para>Consult the &man.amd.8; and &man.amd.conf.5; manual pages for more
	information.</para>
    </sect2>

    <sect2 id="network-nfs-integration">
      <sect2info>
        <authorgroup>
          <author>
            <firstname>John</firstname>
            <surname>Lind</surname>
            <contrib>Contributed by </contrib>
          </author>
        </authorgroup>
      </sect2info>
      <title>Problems Integrating with Other Systems</title>

      <para>Certain Ethernet adapters for ISA PC systems have limitations
	which can lead to serious network problems, particularly with NFS.
	This difficulty is not specific to FreeBSD, but FreeBSD systems
	are affected by it.</para>

      <para>The problem nearly always occurs when (FreeBSD) PC systems are
	networked with high-performance workstations, such as those made
	by Silicon Graphics, Inc., and Sun Microsystems, Inc.  The NFS
	mount will work fine, and some operations may succeed, but
	suddenly the server will seem to become unresponsive to the
	client, even though requests to and from other systems continue to
	be processed.  This happens to the client system, whether the
	client is the FreeBSD system or the workstation.  On many systems,
	there is no way to shut down the client gracefully once this
	problem has manifested itself.  The only solution is often to
	reset the client, because the NFS situation cannot be
	resolved.</para>

      <para>Though the <quote>correct</quote> solution is to get a
	higher performance and capacity Ethernet adapter for the
	FreeBSD system, there is a simple workaround that will allow
	satisfactory operation.  If the FreeBSD system is the
	<emphasis>server</emphasis>, include the option
	<option>-w=1024</option> on the mount from the client.  If the
	FreeBSD system is the <emphasis>client</emphasis>, then mount
	the NFS file system with the option <option>-r=1024</option>.
	These options may be specified using the fourth field of the
	<filename>fstab</filename> entry on the client for automatic
	mounts, or by using the <option>-o</option> parameter of the
	&man.mount.8; command for manual mounts.</para>

      <para>It should be noted that there is a different problem,
	sometimes mistaken for this one, when the NFS servers and
	clients are on different networks.  If that is the case, make
	<emphasis>certain</emphasis> that your routers are routing the
	necessary <acronym>UDP</acronym> information, or you will not get anywhere, no
	matter what else you are doing.</para>

      <para>In the following examples, <hostid>fastws</hostid> is the host
	(interface) name of a high-performance workstation, and
	<hostid>freebox</hostid> is the host (interface) name of a FreeBSD
	system with a lower-performance Ethernet adapter.  Also,
	<filename>/sharedfs</filename> will be the exported NFS
	file system (see &man.exports.5;), and
	<filename>/project</filename> will be the mount point on the
	client for the exported file system.  In all cases, note that
	additional options, such as <option>hard</option> or
	<option>soft</option> and <option>bg</option> may be desirable in
	your application.</para>

      <para>Examples for the FreeBSD system (<hostid>freebox</hostid>)
	as the client in <filename>/etc/fstab</filename> on
	<hostid>freebox</hostid>:</para>

      <programlisting>fastws:/sharedfs /project nfs rw,-r=1024 0 0</programlisting>

      <para>As a manual mount command on <hostid>freebox</hostid>:</para>

      <screen>&prompt.root; <userinput>mount -t nfs -o -r=1024 fastws:/sharedfs /project</userinput></screen>

      <para>Examples for the FreeBSD system as the server in
	<filename>/etc/fstab</filename> on
	<hostid>fastws</hostid>:</para>

      <programlisting>freebox:/sharedfs /project nfs rw,-w=1024 0 0</programlisting>

      <para>As a manual mount command on <hostid>fastws</hostid>:</para>

      <screen>&prompt.root; <userinput>mount -t nfs -o -w=1024 freebox:/sharedfs /project</userinput></screen>

      <para>Nearly any 16-bit Ethernet adapter will allow operation
	without the above restrictions on the read or write size.</para>

      <para>For anyone who cares, here is what happens when the
	failure occurs, which also explains why it is unrecoverable.
	NFS typically works with a <quote>block</quote> size of
	8&nbsp;K (though it may do fragments of smaller sizes).  Since
	the maximum Ethernet packet is around 1500&nbsp;bytes, the NFS
	<quote>block</quote> gets split into multiple Ethernet
	packets, even though it is still a single unit to the
	upper-level code, and must be received, assembled, and
	<emphasis>acknowledged</emphasis> as a unit.  The
	high-performance workstations can pump out the packets which
	comprise the NFS unit one right after the other, just as close
	together as the standard allows.  On the smaller, lower
	capacity cards, the later packets overrun the earlier packets
	of the same unit before they can be transferred to the host
	and the unit as a whole cannot be reconstructed or
	acknowledged.  As a result, the workstation will time out and
	try again, but it will try again with the entire 8&nbsp;K
	unit, and the process will be repeated, ad infinitum.</para>

      <para>By keeping the unit size below the Ethernet packet size
	limitation, we ensure that any complete Ethernet packet
	received can be acknowledged individually, avoiding the
	deadlock situation.</para>

      <para>Overruns may still occur when a high-performance
	workstations is slamming data out to a PC system, but with the
	better cards, such overruns are not guaranteed on NFS
	<quote>units</quote>.  When an overrun occurs, the units
	affected will be retransmitted, and there will be a fair
	chance that they will be received, assembled, and
	acknowledged.</para>
    </sect2>
  </sect1>

  <sect1 id="network-nis">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Bill</firstname>
      	  <surname>Swingle</surname>
	  <contrib>Written by </contrib>
         </author>
      </authorgroup>
      <authorgroup>
	<author>
	  <firstname>Eric</firstname>
	  <surname>Ogren</surname>
	  <contrib>Enhanced by </contrib>
	</author>
	<author>
	  <firstname>Udo</firstname>
	  <surname>Erdelhoff</surname>
	</author>
      </authorgroup>
    </sect1info>
    <title>Network Information System (NIS/YP)</title>

    <sect2>
      <title>What Is It?</title>
      <indexterm><primary>NIS</primary></indexterm>
      <indexterm><primary>Solaris</primary></indexterm>
      <indexterm><primary>HP-UX</primary></indexterm>
      <indexterm><primary>AIX</primary></indexterm>
      <indexterm><primary>Linux</primary></indexterm>
      <indexterm><primary>NetBSD</primary></indexterm>
      <indexterm><primary>OpenBSD</primary></indexterm>

      <para><acronym role="Network Information System">NIS</acronym>,
        which stands for Network Information Services, was developed
        by Sun Microsystems to centralize administration of &unix;
        (originally &sunos;) systems.  It has now essentially become
        an industry standard; all major &unix; like systems
        (&solaris;, HP-UX, &aix;, Linux, NetBSD, OpenBSD, FreeBSD,
        etc) support <acronym role="Network Information
        System">NIS</acronym>.</para>

      <indexterm><primary>yellow pages</primary><see>NIS</see></indexterm>

      <para><acronym role="Network Information System">NIS</acronym>
	was formerly known as Yellow Pages, but because of trademark
	issues, Sun changed the name.  The old term (and yp) is still
	often seen and used.</para>

      <indexterm>
        <primary>NIS</primary>
        <secondary>domains</secondary>
      </indexterm>

      <para>It is a RPC-based client/server system that allows a group
	of machines within an NIS domain to share a common set of
	configuration files.  This permits a system administrator to
	set up NIS client systems with only minimal configuration data
	and add, remove or modify configuration data from a single
	location.</para>

      <indexterm><primary>Windows NT</primary></indexterm>

      <para>It is similar to the &windowsnt; domain system; although
        the internal implementation of the two are not at all similar,
        the basic functionality can be compared.</para>
    </sect2>

    <sect2>
      <title>Terms/Processes You Should Know</title>

      <para>There are several terms and several important user
        processes that you will come across when attempting to
        implement NIS on FreeBSD, whether you are trying to create an
        NIS server or act as an NIS client:</para>

      <indexterm>
	<primary><application>rpcbind</application></primary>
      </indexterm>
      <indexterm>
	<primary><application>portmap</application></primary>
      </indexterm>

      <informaltable frame="none" pgwide="1">
	<tgroup cols="2">
	<colspec colwidth="1*"/>
	<colspec colwidth="3*"/>

	  <thead>
	    <row>
	      <entry>Term</entry>
	      <entry>Description</entry>
	    </row>
	  </thead>
	  <tbody>
	    <row>
	      <entry>NIS domainname</entry>

	      <entry>An NIS master server and all of its clients
		(including its slave servers) have a NIS domainname.
		Similar to an &windowsnt; domain name, the NIS
		domainname does not have anything to do with
		<acronym>DNS</acronym>.</entry>
	    </row>
	    <row>
	      <entry><application>rpcbind</application></entry>

	      <entry>Must be running in order to enable
		<acronym>RPC</acronym> (Remote Procedure Call, a
		network protocol used by NIS).  If
		<application>rpcbind</application> is not running, it
		will be impossible to run an NIS server, or to act as
		an NIS client.</entry>
	    </row>
	    <row>
	      <entry><application>ypbind</application></entry>

	      <entry><quote>Binds</quote> an NIS client to its NIS
		server.  It will take the NIS domainname from the
		system, and using <acronym>RPC</acronym>, connect to
		the server.  <application>ypbind</application> is the
		core of client-server communication in an NIS
		environment; if <application>ypbind</application> dies
		on a client machine, it will not be able to access the
		NIS server.</entry>
	    </row>
	    <row>
	      <entry><application>ypserv</application></entry>
	      <entry>Should only be running on NIS servers; this is
		the NIS server process itself.  If &man.ypserv.8;
		dies, then the server will no longer be able to
		respond to NIS requests (hopefully, there is a slave
		server to take over for it).  There are some
		implementations of NIS (but not the FreeBSD one), that
		do not try to reconnect to another server if the
		server it used before dies.  Often, the only thing
		that helps in this case is to restart the server
		process (or even the whole server) or the
		<application>ypbind</application> process on the
		client.
	      </entry>
	    </row>
	    <row>
	      <entry><application>rpc.yppasswdd</application></entry>
	      <entry>Another process that should only be running on
		NIS master servers; this is a daemon that will allow NIS
		clients to change their NIS passwords.  If this daemon
		is not running, users will have to login to the NIS
		master server and change their passwords there.</entry>
	    </row>
	  </tbody>
	</tgroup>
      </informaltable>
      <!-- XXX Missing: rpc.ypxfrd (not important, though) May only run
      on the master -->

    </sect2>

    <sect2>
      <title>How Does It Work?</title>

      <para>There are three types of hosts in an NIS environment:
	master servers, slave servers, and clients.  Servers act as a
	central repository for host configuration information.  Master
	servers hold the authoritative copy of this information, while
	slave servers mirror this information for redundancy.  Clients
	rely on the servers to provide this information to
	them.</para>

      <para>Information in many files can be shared in this manner.
	The <filename>master.passwd</filename>,
	<filename>group</filename>, and <filename>hosts</filename>
	files are commonly shared via NIS.  Whenever a process on a
	client needs information that would normally be found in these
	files locally, it makes a query to the NIS server that it is
	bound to instead.</para>

      <sect3>
        <title>Machine Types</title>

        <itemizedlist>
          <listitem>
            <para>A <emphasis>NIS master server</emphasis><indexterm><primary>NIS</primary><secondary>master server</secondary></indexterm>.  This
              server, analogous to a &windowsnt; primary domain
              controller, maintains the files used by all of the NIS
              clients.  The <filename>passwd</filename>,
              <filename>group</filename>, and other various files used
              by the NIS clients live on the master server.</para>

            <note><para>It is possible for one machine to be an NIS
              master server for more than one NIS domain.  However,
              this will not be covered in this introduction, which
              assumes a relatively small-scale NIS
              environment.</para></note>
          </listitem>

          <listitem>
            <para><emphasis>NIS slave servers</emphasis><indexterm><primary>NIS</primary><secondary>slave server</secondary></indexterm>.  Similar to
              the &windowsnt; backup domain controllers, NIS slave
              servers maintain copies of the NIS master's data files.
              NIS slave servers provide the redundancy, which is
              needed in important environments.  They also help to
              balance the load of the master server: NIS Clients
              always attach to the NIS server whose response they get
              first, and this includes slave-server-replies.</para>
          </listitem>

          <listitem>
            <para><emphasis>NIS clients</emphasis><indexterm><primary>NIS</primary><secondary>client</secondary></indexterm>.  NIS clients, like
              most &windowsnt; workstations, authenticate against the
              NIS server (or the &windowsnt; domain controller in the
              &windowsnt; workstations case) to log on.</para>
          </listitem>
        </itemizedlist>
      </sect3>
    </sect2>

    <sect2>
      <title>Using NIS/YP</title>

      <para>This section will deal with setting up a sample NIS
        environment.</para>

      <sect3>
        <title>Planning</title>

        <para>Let us assume that you are the administrator of a small
          university lab.  This lab, which consists of 15 FreeBSD
          machines, currently has no centralized point of
          administration; each machine has its own
          <filename>/etc/passwd</filename> and
          <filename>/etc/master.passwd</filename>.  These files are
          kept in sync with each other only through manual
          intervention; currently, when you add a user to the lab, you
          must run <command>adduser</command> on all 15 machines.
          Clearly, this has to change, so you have decided to convert
          the lab to use NIS, using two of the machines as
          servers.</para>

        <para>Therefore, the configuration of the lab now looks something
          like:</para>

        <informaltable frame="none" pgwide="1">
          <tgroup cols="3">
            <thead>
              <row>
                <entry>Machine name</entry>
                <entry>IP address</entry>
                <entry>Machine role</entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><hostid>ellington</hostid></entry>
                <entry><hostid role="ipaddr">10.0.0.2</hostid></entry>
                <entry>NIS master</entry>
              </row>
              <row>
                <entry><hostid>coltrane</hostid></entry>
                <entry><hostid role="ipaddr">10.0.0.3</hostid></entry>
                <entry>NIS slave</entry>
              </row>
              <row>
                <entry><hostid>basie</hostid></entry>
                <entry><hostid role="ipaddr">10.0.0.4</hostid></entry>
                <entry>Faculty workstation</entry>
              </row>
              <row>
                <entry><hostid>bird</hostid></entry>
                <entry><hostid role="ipaddr">10.0.0.5</hostid></entry>
                <entry>Client machine</entry>
              </row>
              <row>
                <entry><hostid>cli[1-11]</hostid></entry>
                <entry><hostid role="ipaddr">10.0.0.[6-17]</hostid></entry>
                <entry>Other client machines</entry>
              </row>
            </tbody>
          </tgroup>
        </informaltable>

        <para>If you are setting up a NIS scheme for the first time, it
	  is a good idea to think through how you want to go about it.  No
	  matter what the size of your network, there are a few decisions
	  that need to be made.</para>

        <sect4>
          <title>Choosing a NIS Domain Name</title>

	  <indexterm>
	    <primary>NIS</primary>
	    <secondary>domainname</secondary>
	  </indexterm>
          <para>This might not be the <quote>domainname</quote> that
	    you are used to.  It is more accurately called the
	    <quote>NIS domainname</quote>.  When a client broadcasts
	    its requests for info, it includes the name of the NIS
	    domain that it is part of.  This is how multiple servers
	    on one network can tell which server should answer which
	    request.  Think of the NIS domainname as the name for a
	    group of hosts that are related in some way.</para>

	  <para>Some organizations choose to use their Internet
	    domainname for their NIS domainname.  This is not
	    recommended as it can cause confusion when trying to debug
	    network problems.  The NIS domainname should be unique
	    within your network and it is helpful if it describes the
	    group of machines it represents.  For example, the Art
	    department at Acme Inc. might be in the
	    <quote>acme-art</quote> NIS domain.  For this example,
	    assume you have chosen the name
	    <literal>test-domain</literal>.</para>

	  <indexterm><primary>SunOS</primary></indexterm>
          <para>However, some operating systems (notably &sunos;) use
          their NIS domain name as their Internet domain name.  If one
          or more machines on your network have this restriction, you
          <emphasis>must</emphasis> use the Internet domain name as
          your NIS domain name.</para>
        </sect4>

        <sect4>
          <title>Physical Server Requirements</title>

	  <para>There are several things to keep in mind when choosing
	    a machine to use as a NIS server.  One of the unfortunate
	    things about NIS is the level of dependency the clients
	    have on the server.  If a client cannot contact the server
	    for its NIS domain, very often the machine becomes
	    unusable.  The lack of user and group information causes
	    most systems to temporarily freeze up.  With this in mind
	    you should make sure to choose a machine that will not be
	    prone to being rebooted regularly, or one that might be
	    used for development.  The NIS server should ideally be a
	    stand alone machine whose sole purpose in life is to be an
	    NIS server.  If you have a network that is not very
	    heavily used, it is acceptable to put the NIS server on a
	    machine running other services, just keep in mind that if
	    the NIS server becomes unavailable, it will affect
	    <emphasis>all</emphasis> of your NIS clients
	    adversely.</para>
        </sect4>
      </sect3>

      <sect3>
        <title>NIS Servers</title>

	<para> The canonical copies of all NIS information are stored
	  on a single machine called the NIS master server.  The
	  databases used to store the information are called NIS maps.
	  In FreeBSD, these maps are stored in
	  <filename>/var/yp/[domainname]</filename> where
	  <filename>[domainname]</filename> is the name of the NIS
	  domain being served.  A single NIS server can support
	  several domains at once, therefore it is possible to have
	  several such directories, one for each supported domain.
	  Each domain will have its own independent set of
	  maps.</para>

	<para>NIS master and slave servers handle all NIS requests
	  with the <command>ypserv</command> daemon.
	  <command>ypserv</command> is responsible for receiving
	  incoming requests from NIS clients, translating the
	  requested domain and map name to a path to the corresponding
	  database file and transmitting data from the database back
	  to the client.</para>

        <sect4>
	  <title>Setting Up a NIS Master Server</title>
	  <indexterm>
	    <primary>NIS</primary>
	    <secondary>server configuration</secondary>
	  </indexterm>
	  <para>Setting up a master NIS server can be relatively
	    straight forward, depending on your needs.  FreeBSD comes
	    with support for NIS out-of-the-box.  All you need is to
	    add the following lines to
	    <filename>/etc/rc.conf</filename>, and FreeBSD will do the
	    rest for you.</para>

          <procedure>
            <step>
              <para><programlisting>nisdomainname="test-domain"</programlisting>
                This line will set the NIS domainname to
                <literal>test-domain</literal>
                upon network setup (e.g. after reboot).</para>
            </step>
            <step>
              <para><programlisting>nis_server_enable="YES"</programlisting>
                This will tell FreeBSD to start up the NIS server processes
                when the networking is next brought up.</para>
            </step>
            <step>
              <para><programlisting>nis_yppasswdd_enable="YES"</programlisting>
                This will enable the <command>rpc.yppasswdd</command>
                daemon which, as mentioned above, will allow users to
                change their NIS password from a client machine.</para>
            </step>
          </procedure>

          <note>
            <para>Depending on your NIS setup, you may need to add
              further entries.  See the <link
              linkend="network-nis-server-is-client">section about NIS
              servers that are also NIS clients</link>, below, for
              details.</para>
          </note>

          <para>Now, all you have to do is to run the command
            <command>/etc/netstart</command> as superuser.  It will
            set up everything for you, using the values you defined in
            <filename>/etc/rc.conf</filename>.</para>
        </sect4>

        <sect4>
          <title>Initializing the NIS Maps</title>
          <indexterm>
            <primary>NIS</primary>
            <secondary>maps</secondary>
          </indexterm>
          <para>The <emphasis>NIS maps</emphasis> are database files,
            that are kept in the <filename>/var/yp</filename>
            directory.  They are generated from configuration files in
            the <filename>/etc</filename> directory of the NIS master,
            with one exception: the
            <filename>/etc/master.passwd</filename> file.  This is for
            a good reason, you do not want to propagate passwords to
            your <username>root</username> and other administrative
            accounts to all the servers in the NIS domain.  Therefore,
            before we initialize the NIS maps, you should:</para>

          <screen>&prompt.root; <userinput>cp /etc/master.passwd /var/yp/master.passwd</userinput>
&prompt.root; <userinput>cd /var/yp</userinput>
&prompt.root; <userinput>vi master.passwd</userinput></screen>

          <para>You should remove all entries regarding system
            accounts (<username>bin</username>,
            <username>tty</username>, <username>kmem</username>,
            <username>games</username>, etc), as well as any accounts
            that you do not want to be propagated to the NIS clients
            (for example <username>root</username> and any other UID 0
            (superuser) accounts).</para>

          <note><para>Make sure the
            <filename>/var/yp/master.passwd</filename> is neither group
            nor world readable (mode 600)!  Use the
            <command>chmod</command> command, if appropriate.</para></note>

	  <indexterm><primary>Tru64 UNIX</primary></indexterm>

          <para>When you have finished, it is time to initialize the
            NIS maps!  FreeBSD includes a script named
            <command>ypinit</command> to do this for you (see its
            manual page for more information).  Note that this script
            is available on most &unix; Operating Systems, but not on
            all.  On Digital UNIX/Compaq Tru64 UNIX it is called
            <command>ypsetup</command>.  Because we are generating
            maps for an NIS master, we are going to pass the
            <option>-m</option> option to <command>ypinit</command>.
            To generate the NIS maps, assuming you already performed
            the steps above, run:</para>

          <screen>ellington&prompt.root; <userinput>ypinit -m test-domain</userinput>
Server Type: MASTER Domain: test-domain
Creating an YP server will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] <userinput>n</userinput>
Ok, please remember to go back and redo manually whatever fails.
If you don't, something might not work.
At this point, we have to construct a list of this domains YP servers.
rod.darktech.org is already known as master server.
Please continue to add any slave servers, one per line. When you are
done with the list, type a &lt;control D&gt;.
master server   :  ellington
next host to add:  <userinput>coltrane</userinput>
next host to add:  <userinput>^D</userinput>
The current list of NIS servers looks like this:
ellington
coltrane
Is this correct?  [y/n: y] <userinput>y</userinput>

[..output from map generation..]

NIS Map update completed.
ellington has been setup as an YP master server without any errors.</screen>

          <para><command>ypinit</command> should have created
            <filename>/var/yp/Makefile</filename> from
            <filename>/var/yp/Makefile.dist</filename>.
            When created, this file assumes that you are operating
            in a single server NIS environment with only FreeBSD
            machines.  Since <literal>test-domain</literal> has
            a slave server as well, you must edit
            <filename>/var/yp/Makefile</filename>:</para>

          <screen>ellington&prompt.root; <userinput>vi /var/yp/Makefile</userinput></screen>

	  <para>You should comment out the line that says</para>

	  <programlisting>NOPUSH = "True"</programlisting>

	  <para>(if it is not commented out already).</para>
        </sect4>

        <sect4>
	  <title>Setting up a NIS Slave Server</title>
	  <indexterm>
	    <primary>NIS</primary>
	    <secondary>slave server</secondary>
	  </indexterm>
	  <para>Setting up an NIS slave server is even more simple than
	    setting up the master.  Log on to the slave server and edit the
            file <filename>/etc/rc.conf</filename> as you did before.
            The only difference is that we now must use the
            <option>-s</option> option when running <command>ypinit</command>.
            The <option>-s</option> option requires the name of the NIS
            master be passed to it as well, so our command line looks
            like:</para>

  <screen>coltrane&prompt.root; <userinput>ypinit -s ellington test-domain</userinput>

Server Type: SLAVE Domain: test-domain Master: ellington

Creating an YP server will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.

Do you want this procedure to quit on non-fatal errors? [y/n: n]  <userinput>n</userinput>

Ok, please remember to go back and redo manually whatever fails.
If you don't, something might not work.
There will be no further questions. The remainder of the procedure
should take a few minutes, to copy the databases from ellington.
Transferring netgroup...
ypxfr: Exiting: Map successfully transferred
Transferring netgroup.byuser...
ypxfr: Exiting: Map successfully transferred
Transferring netgroup.byhost...
ypxfr: Exiting: Map successfully transferred
Transferring master.passwd.byuid...
ypxfr: Exiting: Map successfully transferred
Transferring passwd.byuid...
ypxfr: Exiting: Map successfully transferred
Transferring passwd.byname...
ypxfr: Exiting: Map successfully transferred
Transferring group.bygid...
ypxfr: Exiting: Map successfully transferred
Transferring group.byname...
ypxfr: Exiting: Map successfully transferred
Transferring services.byname...
ypxfr: Exiting: Map successfully transferred
Transferring rpc.bynumber...
ypxfr: Exiting: Map successfully transferred
Transferring rpc.byname...
ypxfr: Exiting: Map successfully transferred
Transferring protocols.byname...
ypxfr: Exiting: Map successfully transferred
Transferring master.passwd.byname...
ypxfr: Exiting: Map successfully transferred
Transferring networks.byname...
ypxfr: Exiting: Map successfully transferred
Transferring networks.byaddr...
ypxfr: Exiting: Map successfully transferred
Transferring netid.byname...
ypxfr: Exiting: Map successfully transferred
Transferring hosts.byaddr...
ypxfr: Exiting: Map successfully transferred
Transferring protocols.bynumber...
ypxfr: Exiting: Map successfully transferred
Transferring ypservers...
ypxfr: Exiting: Map successfully transferred
Transferring hosts.byname...
ypxfr: Exiting: Map successfully transferred

coltrane has been setup as an YP slave server without any errors.
Don't forget to update map ypservers on ellington.</screen>

	  <para>You should now have a directory called
	    <filename>/var/yp/test-domain</filename>.  Copies of the NIS
	    master server's maps should be in this directory.  You will
	    need to make sure that these stay updated.  The following
	    <filename>/etc/crontab</filename> entries on your slave
	    servers should do the job:</para>

	  <programlisting>20      *       *       *       *       root   /usr/libexec/ypxfr passwd.byname
21      *       *       *       *       root   /usr/libexec/ypxfr passwd.byuid</programlisting>

	  <para>These two lines force the slave to sync its maps with
	    the maps on the master server.  Although these entries are
	    not mandatory, since the master server attempts to ensure
	    any changes to its NIS maps are communicated to its slaves
	    and because password information is vital to systems
	    depending on the server, it is a good idea to force the
	    updates.  This is more important on busy networks where map
	    updates might not always complete.</para>

          <para>Now, run the command <command>/etc/netstart</command> on the
            slave server as well, which again starts the NIS server.</para>
	</sect4>
      </sect3>

      <sect3>
        <title>NIS Clients</title>

	<para> An NIS client establishes what is called a binding to a
	  particular NIS server using the
	  <command>ypbind</command> daemon.
	  <command>ypbind</command> checks the system's default
	  domain (as set by the <command>domainname</command> command),
	  and begins broadcasting RPC requests on the local network.
	  These requests specify the name of the domain for which
	  <command>ypbind</command> is attempting to establish a binding.
	  If a server that has been configured to serve the requested
	  domain receives one of the broadcasts, it will respond to
	  <command>ypbind</command>,  which will record the server's
	  address.  If there are several servers available (a master and
	  several slaves, for example), <command>ypbind</command> will
	  use the address of the first one to respond.  From that point
	  on, the client system will direct all of its NIS requests to
	  that server.  <command>ypbind</command> will
	  occasionally <quote>ping</quote> the server to make sure it is
	  still up and running.  If it fails to receive a reply to one of
	  its pings within a reasonable amount of time,
	  <command>ypbind</command> will mark the domain as unbound and
	  begin broadcasting again in the hopes of locating another
	  server.</para>

	<sect4>
	  <title>Setting Up a NIS Client</title>
	  <indexterm>
	    <primary>NIS</primary>
	    <secondary>client configuration</secondary>
	  </indexterm>
	  <para>Setting up a FreeBSD machine to be a NIS client is fairly
	    straightforward.</para>

	  <procedure>
	    <step>
	      <para>Edit the file <filename>/etc/rc.conf</filename> and
                add the following lines in order to set the NIS domainname
                and start <command>ypbind</command> upon network
                startup:</para>

	      <programlisting>nisdomainname="test-domain"
nis_client_enable="YES"</programlisting>
	    </step>

	    <step>
	      <para>To import all possible password entries from the NIS
		server, remove all user accounts from your
		<filename>/etc/master.passwd</filename> file and use
		<command>vipw</command> to add the following line to
                the end of the file:</para>

	      <programlisting>+:::::::::</programlisting>

	      <note>
		<para>This line will afford anyone with a valid account in
		  the NIS server's password maps an account.  There are
		  many ways to configure your NIS client by changing this
		  line.  See the <link linkend="network-netgroups">netgroups
		  section</link> below for more information.
                  For more detailed reading see O'Reilly's book on
		  <literal>Managing NFS and NIS</literal>.</para>
	      </note>

              <note>
                <para>You should keep at least one local account (i.e.
                  not imported via NIS) in your
                  <filename>/etc/master.passwd</filename> and this
                  account should also be a member of the group
                  <groupname>wheel</groupname>.  If there is something
                  wrong with NIS, this account can be used to log in
                  remotely, become <username>root</username>, and fix things.</para>
              </note>
            </step>

	    <step>
	      <para>To import all possible group entries from the NIS
		server, add this line to your
		<filename>/etc/group</filename> file:</para>

	      <programlisting>+:*::</programlisting>
	    </step>
	  </procedure>

	  <para>After completing these steps, you should be able to run
	    <command>ypcat passwd</command> and see the NIS server's
	    passwd map.</para>
	</sect4>
      </sect3>
    </sect2>

    <sect2>
      <title>NIS Security</title>

      <para>In general, any remote user can issue an RPC to
	&man.ypserv.8; and retrieve the contents of your NIS maps,
	provided the remote user knows your domainname.  To prevent
	such unauthorized transactions, &man.ypserv.8; supports a
	feature called <quote>securenets</quote> which can be used to
	restrict access to a given set of hosts.  At startup,
	&man.ypserv.8; will attempt to load the securenets information
	from a file called
	<filename>/var/yp/securenets</filename>.</para>

      <note>
	<para>This path varies depending on the path specified with the
	  <option>-p</option> option.  This file contains entries that
	  consist of a network specification and a network mask separated
	  by white space.  Lines starting with <quote>#</quote> are
	  considered to be comments.  A sample securenets file might look
	  like this:</para>
      </note>

      <programlisting># allow connections from local host -- mandatory
127.0.0.1     255.255.255.255
# allow connections from any host
# on the 192.168.128.0 network
192.168.128.0 255.255.255.0
# allow connections from any host
# between 10.0.0.0 to 10.0.15.255
# this includes the machines in the testlab
10.0.0.0      255.255.240.0</programlisting>

      <para>If &man.ypserv.8; receives a request from an address that
	matches one of these rules, it will process the request
	normally.  If the address fails to match a rule, the request
	will be ignored and a warning message will be logged.  If the
	<filename>/var/yp/securenets</filename> file does not exist,
	<command>ypserv</command> will allow connections from any
	host.</para>

      <para>The <command>ypserv</command> program also has support for
	Wietse Venema's <application>TCP Wrapper</application> package.
	This allows the administrator to use the
	<application>TCP Wrapper</application> configuration files for
	access control instead of
	<filename>/var/yp/securenets</filename>.</para>

      <note>
        <para>While both of these access control mechanisms provide some
          security, they, like the privileged port test, are
          vulnerable to <quote>IP spoofing</quote> attacks.  All
          NIS-related traffic should be blocked at your firewall.</para>

        <para>Servers using <filename>/var/yp/securenets</filename>
          may fail to serve legitimate NIS clients with archaic TCP/IP
          implementations.  Some of these implementations set all
          host bits to zero when doing broadcasts and/or fail to
          observe the subnet mask when calculating the broadcast
          address.  While some of these problems can be fixed by
          changing the client configuration, other problems may force
          the retirement of the client systems in question or the
          abandonment of <filename>/var/yp/securenets</filename>.</para>

        <para>Using <filename>/var/yp/securenets</filename> on a
          server with such an archaic implementation of TCP/IP is a
          really bad idea and will lead to loss of NIS functionality
          for large parts of your network.</para>

	<indexterm><primary>TCP Wrappers</primary></indexterm>
        <para>The use of the <application>TCP Wrapper</application>
          package increases the latency of your NIS server.  The
          additional delay may be long enough to cause timeouts in
          client programs, especially in busy networks or with slow
          NIS servers.  If one or more of your client systems
          suffers from these symptoms, you should convert the client
          systems in question into NIS slave servers and force them
          to bind to themselves.</para>
      </note>
    </sect2>

    <sect2>
      <title>Barring Some Users from Logging On</title>

      <para>In our lab, there is a machine <hostid>basie</hostid> that
        is supposed to be a faculty only workstation.  We do not want
        to take this machine out of the NIS domain, yet the
        <filename>passwd</filename> file on the master NIS server
        contains accounts for both faculty and students.  What can we
        do?</para>

      <para>There is a way to bar specific users from logging on to a
        machine, even if they are present in the NIS database.  To do
        this, all you must do is add
        <literal>-<replaceable>username</replaceable></literal> to the
        end of the <filename>/etc/master.passwd</filename> file on the
        client machine, where <replaceable>username</replaceable> is
        the username of the user you wish to bar from logging in.
        This should preferably be done using <command>vipw</command>,
        since <command>vipw</command> will sanity check your changes
        to <filename>/etc/master.passwd</filename>, as well as
        automatically rebuild the password database when you finish
        editing.  For example, if we wanted to bar user
        <username>bill</username> from logging on to
        <hostid>basie</hostid> we would:</para>

        <screen>basie&prompt.root; <userinput>vipw</userinput>
<userinput>[add -bill to the end, exit]</userinput>
vipw: rebuilding the database...
vipw: done

basie&prompt.root; <userinput>cat /etc/master.passwd</userinput>

root:[password]:0:0::0:0:The super-user:/root:/bin/csh
toor:[password]:0:0::0:0:The other super-user:/root:/bin/sh
daemon:*:1:1::0:0:Owner of many system processes:/root:/sbin/nologin
operator:*:2:5::0:0:System &amp;:/:/sbin/nologin
bin:*:3:7::0:0:Binaries Commands and Source,,,:/:/sbin/nologin
tty:*:4:65533::0:0:Tty Sandbox:/:/sbin/nologin
kmem:*:5:65533::0:0:KMem Sandbox:/:/sbin/nologin
games:*:7:13::0:0:Games pseudo-user:/usr/games:/sbin/nologin
news:*:8:8::0:0:News Subsystem:/:/sbin/nologin
man:*:9:9::0:0:Mister Man Pages:/usr/share/man:/sbin/nologin
bind:*:53:53::0:0:Bind Sandbox:/:/sbin/nologin
uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucico
xten:*:67:67::0:0:X-10 daemon:/usr/local/xten:/sbin/nologin
pop:*:68:6::0:0:Post Office Owner:/nonexistent:/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/sbin/nologin
+:::::::::
-bill

basie&prompt.root;</screen>
    </sect2>

    <sect2 id="network-netgroups">
      <sect2info>
        <authorgroup>
          <author>
            <firstname>Udo</firstname>
            <surname>Erdelhoff</surname>
            <contrib>Contributed by </contrib>
          </author>
        </authorgroup>
      </sect2info>

      <title>Using Netgroups</title>
      <indexterm><primary>netgroups</primary></indexterm>

      <para>The method shown in the previous section works reasonably
        well if you need special rules for a very small number of
        users and/or machines.  On larger networks, you
        <emphasis>will</emphasis> forget to bar some users from logging
        onto sensitive machines, or you may even have to modify each
        machine separately, thus losing the main benefit of NIS:
        <emphasis>centralized</emphasis> administration.</para>

      <para>The NIS developers' solution for this problem is called
        <emphasis>netgroups</emphasis>.  Their purpose and semantics
        can be compared to the normal groups used by &unix; file
        systems.  The main differences are the lack of a numeric ID
        and the ability to define a netgroup by including both user
        accounts and other netgroups.</para>

      <para>Netgroups were developed to handle large, complex networks
        with hundreds of users and machines.  On one hand, this is
        a Good Thing if you are forced to deal with such a situation.
        On the other hand, this complexity makes it almost impossible to
        explain netgroups with really simple examples.  The example
        used in the remainder of this section demonstrates this
        problem.</para>

      <para>Let us assume that your successful introduction of NIS in
        your laboratory caught your superiors' interest.  Your next
        job is to extend your NIS domain to cover some of the other
        machines on campus.  The two tables contain the names of the
        new users and new machines as well as brief descriptions of
        them.</para>

      <informaltable frame="none" pgwide="1">
        <tgroup cols="2">
          <thead>
            <row>
              <entry>User Name(s)</entry>
              <entry>Description</entry>
            </row>
          </thead>

          <tbody>
            <row>
              <entry><username>alpha</username>, <username>beta</username></entry>
              <entry>Normal employees of the IT department</entry>
            </row>

            <row>
              <entry><username>charlie</username>, <username>delta</username></entry>
              <entry>The new apprentices of the IT department</entry>
            </row>

            <row>
              <entry><username>echo</username>, <username>foxtrott</username>, <username>golf</username>, ...</entry>
              <entry>Ordinary employees</entry>
            </row>

            <row>
              <entry><username>able</username>, <username>baker</username>, ...</entry>
              <entry>The current interns</entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>

      <informaltable frame="none" pgwide="1">
        <tgroup cols="2">
          <thead>
            <row>
              <entry>Machine Name(s)</entry>
              <entry>Description</entry>
            </row>
          </thead>

          <tbody>
            <row>
              <!--  Names taken from "Good Omens" by Neil Gaiman and Terry
                    Pratchett.  Many thanks for a brilliant book.  -->

              <entry><hostid>war</hostid>, <hostid>death</hostid>,
              <hostid>famine</hostid>,
              <hostid>pollution</hostid></entry>
              <entry>Your most important servers.  Only the IT
                employees are allowed to log onto these
                machines.</entry>
            </row>
            <row>
              <!-- gluttony was omitted because it was too fat -->

              <entry><hostid>pride</hostid>, <hostid>greed</hostid>,
              <hostid>envy</hostid>, <hostid>wrath</hostid>,
              <hostid>lust</hostid>, <hostid>sloth</hostid></entry>
              <entry>Less important servers.  All members of the IT
              department are allowed to login onto these
              machines.</entry>
            </row>

            <row>
              <entry><hostid>one</hostid>, <hostid>two</hostid>,
                <hostid>three</hostid>, <hostid>four</hostid>,
                ...</entry>

              <entry>Ordinary workstations.  Only the
                <emphasis>real</emphasis> employees are allowed to use
                these machines.</entry>
            </row>

            <row>
              <entry><hostid>trashcan</hostid></entry>
              <entry>A very old machine without any critical data.
                Even the intern is allowed to use this box.</entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>

      <para>If you tried to implement these restrictions by separately
        blocking each user, you would have to add one
        <literal>-<replaceable>user</replaceable></literal> line to
        each system's <filename>passwd</filename> for each user who is
        not allowed to login onto that system.  If you forget just one
        entry, you could be in trouble.  It may be feasible to do this
        correctly during the initial setup, however you
        <emphasis>will</emphasis> eventually forget to add the lines
        for new users during day-to-day operations.  After all, Murphy
        was an optimist.</para>

      <para>Handling this situation with netgroups offers several
        advantages.  Each user need not be handled separately; you
        assign a user to one or more netgroups and allow or forbid
        logins for all members of the netgroup.  If you add a new
        machine, you will only have to define login restrictions for
        netgroups.  If a new user is added, you will only have to add
        the user to one or more netgroups.  Those changes are
        independent of each other: no more <quote>for each combination
        of user and machine do...</quote> If your NIS setup is planned
        carefully, you will only have to modify exactly one central
        configuration file to grant or deny access to machines.</para>

      <para>The first step is the initialization of the NIS map
        netgroup.  FreeBSD's &man.ypinit.8; does not create this map by
        default, but its NIS implementation will support it once it has
        been created.  To create an empty map, simply type</para>

      <screen>ellington&prompt.root; <userinput>vi /var/yp/netgroup</userinput></screen>

      <para>and start adding content.  For our example, we need at
         least four netgroups: IT employees, IT apprentices, normal
         employees and interns.</para>

      <programlisting>IT_EMP  (,alpha,test-domain)    (,beta,test-domain)
IT_APP  (,charlie,test-domain)  (,delta,test-domain)
USERS   (,echo,test-domain)     (,foxtrott,test-domain) \
        (,golf,test-domain)
INTERNS (,able,test-domain)     (,baker,test-domain)</programlisting>

      <para><literal>IT_EMP</literal>, <literal>IT_APP</literal> etc.
        are the names of the netgroups.  Each bracketed group adds
        one or more user accounts to it.  The three fields inside a
        group are:</para>

      <orderedlist>
        <listitem>
          <para>The name of the host(s) where the following items are
            valid.  If you do not specify a hostname, the entry is
            valid on all hosts.  If you do specify a hostname, you
            will enter a realm of darkness, horror and utter confusion.</para>
        </listitem>

        <listitem>
          <para>The name of the account that belongs to this
            netgroup.</para>
        </listitem>

        <listitem>
          <para>The NIS domain for the account.  You can import
            accounts from other NIS domains into your netgroup if you
            are one of the unlucky fellows with more than one NIS
            domain.</para>
        </listitem>
      </orderedlist>

      <para>Each of these fields can contain wildcards.  See
        &man.netgroup.5; for details.</para>

      <note>
        <indexterm><primary>netgroups</primary></indexterm>
        <para>Netgroup names longer than 8 characters should not be
          used, especially if you have machines running other
          operating systems within your NIS domain.  The names are
          case sensitive; using capital letters for your netgroup
          names is an easy way to distinguish between user, machine
          and netgroup names.</para>

        <para>Some NIS clients (other than FreeBSD) cannot handle
          netgroups with a large number of entries.  For example, some
          older versions of &sunos; start to cause trouble if a netgroup
          contains more than 15 <emphasis>entries</emphasis>.  You can
          circumvent this limit by creating several sub-netgroups with
          15 users or less and a real netgroup that consists of the
          sub-netgroups:</para>

        <programlisting>BIGGRP1  (,joe1,domain)  (,joe2,domain)  (,joe3,domain) [...]
BIGGRP2  (,joe16,domain)  (,joe17,domain) [...]
BIGGRP3  (,joe31,domain)  (,joe32,domain)
BIGGROUP  BIGGRP1 BIGGRP2 BIGGRP3</programlisting>

        <para>You can repeat this process if you need more than 225
          users within a single netgroup.</para>
      </note>

      <para>Activating and distributing your new NIS map is
        easy:</para>

      <screen>ellington&prompt.root; <userinput>cd /var/yp</userinput>
ellington&prompt.root; <userinput>make</userinput></screen>

      <para>This will generate the three NIS maps
        <filename>netgroup</filename>,
        <filename>netgroup.byhost</filename> and
        <filename>netgroup.byuser</filename>.  Use &man.ypcat.1; to
        check if your new NIS maps are available:</para>

      <screen>ellington&prompt.user; <userinput>ypcat -k netgroup</userinput>
ellington&prompt.user; <userinput>ypcat -k netgroup.byhost</userinput>
ellington&prompt.user; <userinput>ypcat -k netgroup.byuser</userinput></screen>

      <para>The output of the first command should resemble the
        contents of <filename>/var/yp/netgroup</filename>.  The second
        command will not produce output if you have not specified
        host-specific netgroups.  The third command can be used to
        get the list of netgroups for a user.</para>

      <para>The client setup is quite simple.  To configure the server
        <hostid>war</hostid>, you only have to start
        &man.vipw.8; and replace the line</para>

      <programlisting>+:::::::::</programlisting>

      <para>with</para>

      <programlisting>+@IT_EMP:::::::::</programlisting>

      <para>Now, only the data for the users defined in the netgroup
        <literal>IT_EMP</literal> is imported into
        <hostid>war</hostid>'s password database and only
        these users are allowed to login.</para>

      <para>Unfortunately, this limitation also applies to the
	<literal>~</literal> function of the shell and all routines
	converting between user names and numerical user IDs.  In
	other words, <command>cd
	~<replaceable>user</replaceable></command> will not work,
	<command>ls -l</command> will show the numerical ID instead of
	the username and <command>find . -user joe -print</command>
	will fail with <errorname>No such user</errorname>.  To fix
	this, you will have to import all user entries
	<emphasis>without allowing them to login onto your
	servers</emphasis>.</para>

      <para>This can be achieved by adding another line to
        <filename>/etc/master.passwd</filename>.  This line should
        contain:</para>

      <para><literal>+:::::::::/sbin/nologin</literal>, meaning
        <quote>Import all entries but replace the shell with
        <filename>/sbin/nologin</filename> in the imported
        entries</quote>.  You can replace any field in the
        <literal>passwd</literal> entry by placing a default value in
        your <filename>/etc/master.passwd</filename>.</para>

      <!-- Been there, done that, got the scars to prove it - ue -->
      <warning>
        <para>Make sure that the line
        <literal>+:::::::::/sbin/nologin</literal> is placed after
        <literal>+@IT_EMP:::::::::</literal>.  Otherwise, all user
        accounts imported from NIS will have <filename>/sbin/nologin</filename> as their
        login shell.</para>
      </warning>

      <para>After this change, you will only have to change one NIS
        map if a new employee joins the IT department.  You could use
        a similar approach for the less important servers by replacing
        the old <literal>+:::::::::</literal> in their local version
        of <filename>/etc/master.passwd</filename> with something like
        this:</para>

      <programlisting>+@IT_EMP:::::::::
+@IT_APP:::::::::
+:::::::::/sbin/nologin</programlisting>

      <para>The corresponding lines for the normal workstations
        could be:</para>

      <programlisting>+@IT_EMP:::::::::
+@USERS:::::::::
+:::::::::/sbin/nologin</programlisting>

      <para>And everything would be fine until there is a policy
        change a few weeks later: The IT department starts hiring
        interns.  The IT interns are allowed to use the normal
        workstations and the less important servers; and the IT
        apprentices are allowed to login onto the main servers.  You
        add a new netgroup <literal>IT_INTERN</literal>, add the new
        IT interns to this netgroup and start to change the
        configuration on each and every machine...  As the old saying
        goes: <quote>Errors in centralized planning lead to global
        mess</quote>.</para>

      <para>NIS' ability to create netgroups from other netgroups can
        be used to prevent situations like these.  One possibility
        is the creation of role-based netgroups.  For example, you
        could create a netgroup called
        <literal>BIGSRV</literal> to define the login
        restrictions for the important servers, another netgroup
        called <literal>SMALLSRV</literal> for the less
        important servers and a third netgroup called
        <literal>USERBOX</literal> for the normal
        workstations.  Each of these netgroups contains the netgroups
        that are allowed to login onto these machines.  The new
        entries for your NIS map netgroup should look like this:</para>

      <programlisting>BIGSRV    IT_EMP  IT_APP
SMALLSRV  IT_EMP  IT_APP  ITINTERN
USERBOX   IT_EMP  ITINTERN USERS</programlisting>

      <para>This method of defining login restrictions works
        reasonably well if you can define groups of machines with
        identical restrictions.  Unfortunately, this is the exception
        and not the rule.  Most of the time, you will need the ability
        to define login restrictions on a per-machine basis.</para>

      <para>Machine-specific netgroup definitions are the other
        possibility to deal with the policy change outlined above.  In
        this scenario, the <filename>/etc/master.passwd</filename> of
        each box contains two lines starting with <quote>+</quote>.
        The first of them adds a netgroup with the accounts allowed to
        login onto this machine, the second one adds all other
        accounts with <filename>/sbin/nologin</filename> as shell.  It
        is a good idea to use the <quote>ALL-CAPS</quote> version of
        the machine name as the name of the netgroup.  In other words,
        the lines should look like this:</para>

      <programlisting>+@<replaceable>BOXNAME</replaceable>:::::::::
+:::::::::/sbin/nologin</programlisting>

      <para>Once you have completed this task for all your machines,
        you will not have to modify the local versions of
        <filename>/etc/master.passwd</filename> ever again.  All
        further changes can be handled by modifying the NIS map.  Here
        is an example of a possible netgroup map for this
        scenario with some additional goodies:</para>

      <programlisting># Define groups of users first
IT_EMP    (,alpha,test-domain)    (,beta,test-domain)
IT_APP    (,charlie,test-domain)  (,delta,test-domain)
DEPT1     (,echo,test-domain)     (,foxtrott,test-domain)
DEPT2     (,golf,test-domain)     (,hotel,test-domain)
DEPT3     (,india,test-domain)    (,juliet,test-domain)
ITINTERN  (,kilo,test-domain)     (,lima,test-domain)
D_INTERNS (,able,test-domain)     (,baker,test-domain)
#
# Now, define some groups based on roles
USERS     DEPT1   DEPT2     DEPT3
BIGSRV    IT_EMP  IT_APP
SMALLSRV  IT_EMP  IT_APP    ITINTERN
USERBOX   IT_EMP  ITINTERN  USERS
#
# And a groups for a special tasks
# Allow echo and golf to access our anti-virus-machine
SECURITY  IT_EMP  (,echo,test-domain)  (,golf,test-domain)
#
# machine-based netgroups
# Our main servers
WAR       BIGSRV
FAMINE    BIGSRV
# User india needs access to this server
POLLUTION  BIGSRV  (,india,test-domain)
#
# This one is really important and needs more access restrictions
DEATH     IT_EMP
#
# The anti-virus-machine mentioned above
ONE       SECURITY
#
# Restrict a machine to a single user
TWO       (,hotel,test-domain)
# [...more groups to follow]</programlisting>

      <para>If you are using some kind of database to manage your user
        accounts, you should be able to create the first part of the
        map with your database's report tools.  This way, new users
        will automatically have access to the boxes.</para>

      <para>One last word of caution: It may not always be advisable
        to use machine-based netgroups.  If you are deploying a couple of
        dozen or even hundreds of identical machines for student labs,
        you should use role-based netgroups instead of machine-based
        netgroups to keep the size of the NIS map within reasonable
        limits.</para>
    </sect2>

    <sect2>
      <title>Important Things to Remember</title>

      <para>There are still a couple of things that you will need to do
        differently now that you are in an NIS environment.</para>

      <itemizedlist>
        <listitem>
          <para>Every time you wish to add a user to the lab, you
            must add it to the master NIS server <emphasis>only</emphasis>,
            and <emphasis>you must remember to rebuild the NIS
            maps</emphasis>.  If you forget to do this, the new user will
            not be able to login anywhere except on the NIS master.
            For example, if we needed to add a new user
            <username>jsmith</username> to the lab, we would:</para>

          <screen>&prompt.root; <userinput>pw useradd jsmith</userinput>
&prompt.root; <userinput>cd /var/yp</userinput>
&prompt.root; <userinput>make test-domain</userinput></screen>

          <para>You could also run <command>adduser jsmith</command> instead
            of <command>pw useradd jsmith</command>.</para>
        </listitem>
        <listitem>
          <para><emphasis>Keep the administration accounts out of the
            NIS maps</emphasis>.  You do not want to be propagating
            administrative accounts and passwords to machines that
            will have users that should not have access to those
            accounts.</para>
        </listitem>
        <listitem>
          <para><emphasis>Keep the NIS master and slave secure, and
            minimize their downtime</emphasis>.  If somebody either
            hacks or simply turns off these machines, they have
            effectively rendered many people without the ability to
            login to the lab.</para>

          <para>This is the chief weakness of any centralized administration
            system.  If you do
            not protect your NIS servers, you will have a lot of angry
            users!</para>
        </listitem>
      </itemizedlist>
    </sect2>

    <sect2>
      <title>NIS v1 Compatibility</title>

      <para> FreeBSD's <application>ypserv</application> has some
	support for serving NIS v1 clients.  FreeBSD's NIS
	implementation only uses the NIS v2 protocol, however other
	implementations include support for the v1 protocol for
	backwards compatibility with older systems.  The
	<application>ypbind</application> daemons supplied with these
	systems will try to establish a binding to an NIS v1 server
	even though they may never actually need it (and they may
	persist in broadcasting in search of one even after they
	receive a response from a v2 server).  Note that while support
	for normal client calls is provided, this version of
	<application>ypserv</application> does not handle v1 map
	transfer requests; consequently, it cannot be used as a master
	or slave in conjunction with older NIS servers that only
	support the v1 protocol.  Fortunately, there probably are not
	any such servers still in use today.</para>
    </sect2>

    <sect2 id="network-nis-server-is-client">
      <title>NIS Servers That Are Also NIS Clients</title>

      <para> Care must be taken when running
	<application>ypserv</application> in a multi-server domain
	where the server machines are also NIS clients.  It is
	generally a good idea to force the servers to bind to
	themselves rather than allowing them to broadcast bind
	requests and possibly become bound to each other.  Strange
	failure modes can result if one server goes down and others
	are dependent upon it.  Eventually all the clients will time
	out and attempt to bind to other servers, but the delay
	involved can be considerable and the failure mode is still
	present since the servers might bind to each other all over
	again.</para>

      <para>You can force a host to bind to a particular server by running
	<command>ypbind</command> with the <option>-S</option>
	flag.  If you do not want to do this manually each time you
        reboot your NIS server, you can add the following lines to
        your <filename>/etc/rc.conf</filename>:</para>

      <programlisting>nis_client_enable="YES"	# run client stuff as well
nis_client_flags="-S <replaceable>NIS domain</replaceable>,<replaceable>server</replaceable>"</programlisting>

      <para>See &man.ypbind.8; for further information.</para>
    </sect2>

    <sect2>
      <title>Password Formats</title>
      <indexterm>
        <primary>NIS</primary>
	<secondary>password formats</secondary>
      </indexterm>
      <para>One of the most common issues that people run into when trying
	to implement NIS is password format compatibility.  If your NIS
	server is using DES encrypted passwords, it will only support
	clients that are also using DES.  For example, if you have
	&solaris; NIS clients in your network, then you will almost certainly
	need to use DES encrypted passwords.</para>

      <para>To check which format your servers
	and clients are using, look at <filename>/etc/login.conf</filename>.
	If the host is configured to use DES encrypted passwords, then the
	<literal>default</literal> class will contain an entry like this:</para>

      <programlisting>default:\
	:passwd_format=des:\
	:copyright=/etc/COPYRIGHT:\
	[Further entries elided]</programlisting>

      <para>Other possible values for the <literal>passwd_format</literal>
	capability include <literal>blf</literal> and <literal>md5</literal>
	(for Blowfish and MD5 encrypted passwords, respectively).</para>

      <para>If you have made changes to
	<filename>/etc/login.conf</filename>, you will also need to
	rebuild the login capability database, which is achieved by
	running the following command as
	<username>root</username>:</para>

      <screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen>

      <note><para>The format of passwords already in
	<filename>/etc/master.passwd</filename> will not be updated
	until a user changes his password for the first time
	<emphasis>after</emphasis> the login capability database is
	rebuilt.</para></note>

      <para>Next, in order to ensure that passwords are encrypted with
	the format that you have chosen, you should also check that
	the <literal>crypt_default</literal> in
	<filename>/etc/auth.conf</filename> gives precedence to your
	chosen password format.  To do this, place the format that you
	have chosen first in the list.  For example, when using DES
	encrypted passwords, the entry would be:</para>

      <programlisting>crypt_default	=	des blf md5</programlisting>

      <para>Having followed the above steps on each of the &os; based
	NIS servers and clients, you can be sure that they all agree
	on which password format is used within your network.  If you
	have trouble authenticating on an NIS client, this is a pretty
	good place to start looking for possible problems.  Remember:
	if you want to deploy an NIS server for a heterogenous
	network, you will probably have to use DES on all systems
	because it is the lowest common standard.</para>
    </sect2>
  </sect1>

  <sect1 id="network-dhcp">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Greg</firstname>
      	  <surname>Sutter</surname>
	  <contrib>Written by </contrib>
        </author>
      </authorgroup>
    </sect1info>
    <title>Automatic Network Configuration (DHCP)</title>

    <sect2>
      <title>What Is DHCP?</title>
      <indexterm>
        <primary>Dynamic Host Configuration Protocol</primary>
        <see>DHCP</see>
      </indexterm>
      <indexterm>
        <primary>Internet Software Consortium (ISC)</primary>
      </indexterm>

      <para>DHCP, the Dynamic Host Configuration Protocol, describes
        the means by which a system can connect to a network and obtain the
        necessary information for communication upon that network.  FreeBSD
	versions prior to 6.0 use the ISC (Internet Software
	Consortium) DHCP client (&man.dhclient.8;) implementation.
	Later versions use the OpenBSD <command>dhclient</command>
	taken from OpenBSD&nbsp;3.7.  All
	information here regarding <command>dhclient</command> is for
	use with either of the ISC or OpenBSD DHCP clients. The DHCP
	server is the one included in the ISC distribution.</para>
    </sect2>

    <sect2>
      <title>What This Section Covers</title>

      <para>This section describes both the client-side components of the ISC and OpenBSD DHCP client and
        server-side components of the ISC DHCP system.  The
        client-side program, <command>dhclient</command>, comes
        integrated within FreeBSD, and the server-side portion is
        available from the <filename
        role="package">net/isc-dhcp3-server</filename> port.  The
        &man.dhclient.8;, &man.dhcp-options.5;, and
        &man.dhclient.conf.5; manual pages, in addition to the
        references below, are useful resources.</para>
    </sect2>

    <sect2>
      <title>How It Works</title>
      <indexterm><primary>UDP</primary></indexterm>
      <para>When <command>dhclient</command>, the DHCP client, is
	executed on the client machine, it begins broadcasting
	requests for configuration information.  By default, these
	requests are on UDP port 68.  The server replies on UDP 67,
	giving the client an IP address and other relevant network
	information such as netmask, router, and DNS servers.  All of
	this information comes in the form of a DHCP
	<quote>lease</quote> and is only valid for a certain time
	(configured by the DHCP server maintainer).  In this manner,
	stale IP addresses for clients no longer connected to the
	network can be automatically reclaimed.</para>

      <para>DHCP clients can obtain a great deal of information from
        the server.  An exhaustive list may be found in
        &man.dhcp-options.5;.</para>
    </sect2>

    <sect2>
      <title>FreeBSD Integration</title>

      <para>&os; fully integrates the ISC or OpenBSD DHCP client,
        <command>dhclient</command> (according to the &os; version you run).  DHCP client support is provided
        within both the installer and the base system, obviating the need
        for detailed knowledge of network configurations on any network
        that runs a DHCP server.  <command>dhclient</command> has been
        included in all FreeBSD distributions since 3.2.</para>
        <indexterm>
          <primary><application>sysinstall</application></primary>
        </indexterm>

        <para>DHCP is supported by
          <application>sysinstall</application>.  When configuring a
          network interface within
          <application>sysinstall</application>, the second question
          asked is: <quote>Do you want to try DHCP configuration of
          the interface?</quote>. Answering affirmatively will
          execute <command>dhclient</command>, and if successful, will
          fill in the network configuration information
          automatically.</para>

        <para>There are two things you must do to have your system use
	  DHCP upon startup:</para>
        <indexterm>
          <primary>DHCP</primary>
          <secondary>requirements</secondary>
        </indexterm>
	<itemizedlist>
	  <listitem>
            <para>Make sure that the <devicename>bpf</devicename>
	      device is compiled into your kernel.  To do this, add
	      <literal>device bpf</literal> to your kernel
	      configuration file, and rebuild the kernel.  For more
	      information about building kernels, see <xref
	      linkend="kernelconfig"/>.</para> <para>The
	      <devicename>bpf</devicename> device is already part of
	      the <filename>GENERIC</filename> kernel that is supplied
	      with FreeBSD, so if you do not have a custom kernel, you
	      should not need to create one in order to get DHCP
	      working.</para>
	    <note>
	      <para>For those who are particularly security conscious,
	        you should be warned that <devicename>bpf</devicename>
		is also the device that allows packet sniffers to work
		correctly (although they still have to be run as
		<username>root</username>).  <devicename>bpf</devicename>
		<emphasis>is</emphasis> required to use DHCP, but if
		you are very sensitive about security, you probably
		should not add <devicename>bpf</devicename> to your
		kernel in the expectation that at some point in the
		future you will be using DHCP.</para>
	    </note>
	  </listitem>
          <listitem>
            <para>Edit your <filename>/etc/rc.conf</filename> to
	      include the following:</para>

            <programlisting>ifconfig_fxp0="DHCP"</programlisting>

            <note>
              <para>Be sure to replace <literal>fxp0</literal> with the
                designation for the interface that you wish to dynamically
                 configure, as described in
		 <xref linkend="config-network-setup"/>.</para>
            </note>

            <para>If you are using a different location for
              <command>dhclient</command>, or if you wish to pass additional
              flags to <command>dhclient</command>, also include the
              following (editing as necessary):</para>

            <programlisting>dhcp_program="/sbin/dhclient"
dhcp_flags=""</programlisting>
          </listitem>
        </itemizedlist>

        <indexterm>
          <primary>DHCP</primary>
          <secondary>server</secondary>
        </indexterm>
        <para>The DHCP server, <application>dhcpd</application>, is included
          as part of the <filename
          role="package">net/isc-dhcp3-server</filename> port in the ports
          collection.  This port contains the ISC DHCP server and
          documentation.</para>
    </sect2>

    <sect2>
      <title>Files</title>
      <indexterm>
        <primary>DHCP</primary>
        <secondary>configuration files</secondary>
      </indexterm>
      <itemizedlist>
        <listitem><para><filename>/etc/dhclient.conf</filename></para>
          <para><command>dhclient</command> requires a configuration file,
            <filename>/etc/dhclient.conf</filename>.  Typically the file
            contains only comments, the defaults being reasonably sane.  This
            configuration file is described by the &man.dhclient.conf.5;
            manual page.</para>
        </listitem>

        <listitem><para><filename>/sbin/dhclient</filename></para>
          <para><command>dhclient</command> is statically linked and
            resides in <filename>/sbin</filename>.  The &man.dhclient.8;
            manual page gives more information about
            <command>dhclient</command>.</para>
        </listitem>

        <listitem><para><filename>/sbin/dhclient-script</filename></para>
          <para><command>dhclient-script</command> is the FreeBSD-specific
            DHCP client configuration script.  It is described in
            &man.dhclient-script.8;, but should not need any user
            modification to function properly.</para>
        </listitem>

        <listitem><para><filename>/var/db/dhclient.leases</filename></para>
          <para>The DHCP client keeps a database of valid leases in this
            file, which is written as a log.  &man.dhclient.leases.5;
            gives a slightly longer description.</para>
        </listitem>
      </itemizedlist>
    </sect2>

    <sect2>
      <title>Further Reading</title>

      <para>The DHCP protocol is fully described in
        <ulink url="http://www.freesoft.org/CIE/RFC/2131/">RFC 2131</ulink>.
        An informational resource has also been set up at
        <ulink url="http://www.dhcp.org/"></ulink>.</para>
    </sect2>

    <sect2 id="network-dhcp-server">
	<title>Installing and Configuring a DHCP Server</title>

	<sect3>
	  <title>What This Section Covers</title>

	  <para>This section provides information on how to configure
	    a FreeBSD system to act as a DHCP server using the ISC
	    (Internet Software Consortium) implementation of the DHCP
	    server.</para>

	  <para>The server is not provided as part of
	    FreeBSD, and so you will need to install the
	    <filename role="package">net/isc-dhcp3-server</filename>
	    port to provide this service.  See <xref linkend="ports"/> for
	    more information on using the Ports Collection.</para>
	</sect3>

	<sect3>
	  <title>DHCP Server Installation</title>
	  <indexterm>
	    <primary>DHCP</primary>
	    <secondary>installation</secondary>
	  </indexterm>
	  <para>In order to configure your FreeBSD system as a DHCP
	    server, you will need to ensure that the &man.bpf.4;
	    device is compiled into your kernel.  To do this, add
	    <literal>device bpf</literal> to your kernel
	    configuration file, and rebuild the kernel.  For more
	    information about building kernels, see <xref
	    linkend="kernelconfig"/>.</para>

	  <para>The <devicename>bpf</devicename> device is already
	    part of the <filename>GENERIC</filename> kernel that is
	    supplied with FreeBSD, so you do not need to create a custom
	    kernel in order to get DHCP working.</para>

	    <note>
	      <para>Those who are particularly security conscious
	        should note that <devicename>bpf</devicename>
		is also the device that allows packet sniffers to work
		correctly (although such programs still need privileged
		access).  <devicename>bpf</devicename>
		<emphasis>is</emphasis> required to use DHCP, but if
		you are very sensitive about security, you probably
		should not include <devicename>bpf</devicename> in your
		kernel purely because you expect to use DHCP at some
		point in the future.</para>
	    </note>

	  <para>The next thing that you will need to do is edit the sample
	    <filename>dhcpd.conf</filename> which was installed by the
	    <filename role="package">net/isc-dhcp3-server</filename> port.
	    By default, this will be
	    <filename>/usr/local/etc/dhcpd.conf.sample</filename>, and you
	    should copy this to
	    <filename>/usr/local/etc/dhcpd.conf</filename> before proceeding
	    to make changes.</para>
	</sect3>

	<sect3>
	  <title>Configuring the DHCP Server</title>
	  <indexterm>
	    <primary>DHCP</primary>
	    <secondary>dhcpd.conf</secondary>
	  </indexterm>
	  <para><filename>dhcpd.conf</filename> is
	    comprised of declarations regarding subnets and hosts, and is
	    perhaps most easily explained using an example :</para>

	  <programlisting>option domain-name "example.com";<co id="domain-name"/>
option domain-name-servers 192.168.4.100;<co id="domain-name-servers"/>
option subnet-mask 255.255.255.0;<co id="subnet-mask"/>

default-lease-time 3600;<co id="default-lease-time"/>
max-lease-time 86400;<co id="max-lease-time"/>
ddns-update-style none;<co id="ddns-update-style"/>

subnet 192.168.4.0 netmask 255.255.255.0 {
  range 192.168.4.129 192.168.4.254;<co id="range"/>
  option routers 192.168.4.1;<co id="routers"/>
}

host mailhost {
  hardware ethernet 02:03:04:05:06:07;<co id="hardware"/>
  fixed-address mailhost.example.com;<co id="fixed-address"/>
}</programlisting>

	  <calloutlist>
	    <callout arearefs="domain-name">
	      <para>This option specifies the domain that will be provided
		to clients as the default search domain.  See
		&man.resolv.conf.5; for more information on what this
		means.</para>
	    </callout>

	    <callout arearefs="domain-name-servers">
	      <para>This option specifies a comma separated list of DNS
		servers that the client should use.</para>
	    </callout>

	    <callout arearefs="subnet-mask">
	      <para>The netmask that will be provided to clients.</para>
	    </callout>

	    <callout arearefs="default-lease-time">
	      <para>A client may request a specific length of time that a
		lease will be valid.  Otherwise the server will assign
		a lease with this expiry value (in seconds).</para>
	    </callout>

	    <callout arearefs="max-lease-time">
	      <para>This is the maximum length of time that the server will
		lease for.  Should a client request a longer lease, a lease
		will be issued, although it will only be valid for
		<literal>max-lease-time</literal> seconds.</para>
	    </callout>

	    <callout arearefs="ddns-update-style">
	      <para>This option specifies whether the DHCP server should
		attempt to update DNS when a lease is accepted or released.
		In the ISC implementation, this option is
		<emphasis>required</emphasis>.</para>
	    </callout>

	    <callout arearefs="range">
	      <para>This denotes which IP addresses should be used in
		the pool reserved for allocating to clients.  IP
		addresses between, and including, the ones stated are
		handed out to clients.</para>
	    </callout>

	    <callout arearefs="routers">
	      <para>Declares the default gateway that will be provided to
		clients.</para>
	    </callout>

	    <callout arearefs="hardware">
	      <para>The hardware MAC address of a host (so that the DHCP server
		can recognize a host when it makes a request).</para>
	    </callout>

	    <callout arearefs="fixed-address">
	      <para>Specifies that the host should always be given the
		same IP address.  Note that using a hostname is
		correct here, since the DHCP server will resolve the
		hostname itself before returning the lease
		information.</para>
	    </callout>
	  </calloutlist>

	  <para>Once you have finished writing your
	    <filename>dhcpd.conf</filename>,
	    you should enable the DHCP server in
	    <filename>/etc/rc.conf</filename>, i.e. by adding:</para>

	  <programlisting>dhcpd_enable="YES"
dhcpd_ifaces="dc0"</programlisting>

	  <para>Replace the <literal>dc0</literal> interface name with the
	    interface (or interfaces, separated by whitespace) that your DHCP
	    server should listen on for DHCP client requests.</para>

	  <para>Then, you can proceed to start the server by issuing the
	    following command:</para>

	  <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/isc-dhcpd.sh start</userinput></screen>

	  <para>Should you need to make changes to the configuration of your
	    server in the future, it is important to note that sending a
	    <literal>SIGHUP</literal> signal to
	    <application>dhcpd</application> does <emphasis>not</emphasis>
	    result in the configuration being reloaded, as it does with most
	    daemons.  You will need to send a <literal>SIGTERM</literal>
	    signal to stop the process, and then restart it using the command
	    above.</para>
	</sect3>

	<sect3>
	  <title>Files</title>
	  <indexterm>
	    <primary>DHCP</primary>
	    <secondary>configuration files</secondary>
	  </indexterm>
	  <itemizedlist>
	    <listitem><para><filename>/usr/local/sbin/dhcpd</filename></para>
	      <para><application>dhcpd</application> is statically linked and
		resides in <filename>/usr/local/sbin</filename>.  The
		&man.dhcpd.8; manual page installed with the
		port gives more information about
		<application>dhcpd</application>.</para>
	    </listitem>

	    <listitem><para><filename>/usr/local/etc/dhcpd.conf</filename></para>
	      <para><application>dhcpd</application> requires a configuration
		file, <filename>/usr/local/etc/dhcpd.conf</filename> before it
		will start providing service to clients.  This file needs to
		contain all the information that should be provided to clients
		that are being serviced, along with information regarding the
		operation of the server.  This configuration file is described
		by the &man.dhcpd.conf.5; manual page installed
		by the port.</para>
	    </listitem>

	    <listitem><para><filename>/var/db/dhcpd.leases</filename></para>
	      <para>The DHCP server keeps a database of leases it has issued
		in this file, which is written as a log.  The manual page
		&man.dhcpd.leases.5;, installed by the port
		gives a slightly longer description.</para>
	    </listitem>

	    <listitem><para><filename>/usr/local/sbin/dhcrelay</filename></para>
	      <para><application>dhcrelay</application> is used in advanced
		environments where one DHCP server forwards a request from a
		client to another DHCP server on a separate network.  If you
		require this functionality, then install the <filename
		role="package">net/isc-dhcp3-relay</filename> port.  The
		&man.dhcrelay.8; manual page provided with the
		port contains more detail.</para>
	    </listitem>
	  </itemizedlist>
	</sect3>

      </sect2>

  </sect1>

  <sect1 id="network-dns">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Chern</firstname>
          <surname>Lee</surname>
          <contrib>Contributed by </contrib>
        </author>

	<author>
	  <firstname>Tom</firstname>
	  <surname>Rhodes</surname>
	</author>

	<author>
	  <firstname>Daniel</firstname>
	  <surname>Gerzo</surname>
	</author>
      </authorgroup>
    </sect1info>
    <title>Domain Name System (<acronym>DNS</acronym>)</title>

    <sect2>
      <title>Overview</title>
      <indexterm><primary>BIND</primary></indexterm>

      <para>&os; utilizes, by default, a version of BIND (Berkeley
	Internet Name Domain), which is the most common implementation
	of the <acronym>DNS</acronym> protocol. <acronym>DNS</acronym>
	is the protocol through which names are mapped to
	<acronym>IP</acronym> addresses, and vice versa.  For example, a
	query for <hostid role="fqdn">www.FreeBSD.org</hostid> will
	receive a reply with the <acronym>IP</acronym> address of The
	&os; Project's web server, whereas, a query for <hostid
	role="fqdn">ftp.FreeBSD.org</hostid> will return the
	<acronym>IP</acronym> address of the corresponding
	<acronym>FTP</acronym> machine.  Likewise, the opposite can
	happen.  A query for an <acronym>IP</acronym> address can
	resolve its hostname.  It is not necessary to run a name server
	to perform <acronym>DNS</acronym> lookups on a system.</para>

      <para>&os; currently comes with <acronym>BIND</acronym>9
	<acronym>DNS</acronym> server software by default.  Our
	installation provides enhanced security features, a new file
	system layout and automated &man.chroot.8; configuration.</para>

      <indexterm><primary>DNS</primary></indexterm>
      <para><acronym>DNS</acronym> is coordinated across the Internet
	through a somewhat complex system of authoritative root, Top
	Level Domain (<acronym>TLD</acronym>), and other smaller-scale
	name servers which host and cache individual domain
	information.</para>

      <para>Currently, BIND is maintained by the
	Internet Software Consortium
	<ulink url="http://www.isc.org/"></ulink>.</para>
    </sect2>

    <sect2>
      <title>Terminology</title>

      <para>To understand this document, some terms related to
	<acronym>DNS</acronym> must be understood.</para>

      <indexterm><primary>resolver</primary></indexterm>
      <indexterm><primary>reverse DNS</primary></indexterm>
      <indexterm><primary>root zone</primary></indexterm>

      <informaltable frame="none" pgwide="1">
	<tgroup cols="2">
	  <colspec colwidth="1*"/>
	  <colspec colwidth="3*"/>

	  <thead>
	    <row>
	      <entry>Term</entry>
	      <entry>Definition</entry>
	    </row>
	  </thead>

	  <tbody>
	    <row>
	      <entry>Forward <acronym>DNS</acronym></entry>
	      <entry>Mapping of hostnames to IP addresses.</entry>
	    </row>

	    <row>
	      <entry>Origin</entry>
	      <entry>Refers to the domain covered in a particular zone
		file.</entry>
	    </row>

	    <row>
	      <entry><application>named</application>, BIND, name server</entry>
	      <entry>Common names for the BIND name server package within
		&os;.</entry>
	    </row>

	    <row>
	      <entry>Resolver</entry>
	      <entry>A system process through which a
		machine queries a name server for zone information.</entry>
	    </row>

	    <row>
	      <entry>Reverse <acronym>DNS</acronym></entry>
	      <entry>The opposite of forward <acronym>DNS</acronym>;
		mapping of <acronym>IP</acronym> addresses to
		hostnames.</entry>
	    </row>

	    <row>
	      <entry>Root zone</entry>

	      <entry>The beginning of the Internet zone hierarchy.
		All zones fall under the root zone, similar to how
		all files in a file system fall under the root
		directory.</entry>
	    </row>

	    <row>
	      <entry>Zone</entry>
	      <entry>An individual domain, subdomain, or portion of the
		<acronym>DNS</acronym> administered by the same
		authority.</entry>
	    </row>
	  </tbody>
	</tgroup>
      </informaltable>

      <indexterm>
	<primary>zones</primary>
	<secondary>examples</secondary>
      </indexterm>

      <para>Examples of zones:</para>

      <itemizedlist>
	<listitem>
	  <para><hostid>.</hostid> is the root zone.</para>
	</listitem>

	<listitem>
	  <para><hostid>org.</hostid> is a Top Level Domain
	    (<acronym>TLD</acronym>) under the root zone.</para>
	</listitem>

	<listitem>
	  <para><hostid role="domainname">example.org.</hostid> is a
	    zone under the <hostid>org.</hostid>
	    <acronym>TLD</acronym>.</para>
	</listitem>

	<listitem>
	  <para><hostid>1.168.192.in-addr.arpa</hostid> is a zone
	    referencing all <acronym>IP</acronym> addresses which fall
	    under the <hostid role="ipaddr">192.168.1.*</hostid>
	    <acronym>IP</acronym> space.</para>
	</listitem>
      </itemizedlist>

      <para>As one can see, the more specific part of a hostname appears
	to its left.  For example, <hostid
	role="domainname">example.org.</hostid> is more specific than
	<hostid>org.</hostid>, as <hostid>org.</hostid> is more specific
	than the root zone.  The layout of each part of a hostname is
	much like a file system: the
	<filename class="directory">/dev</filename> directory falls
	within the root, and so on.</para>
    </sect2>

    <sect2>
      <title>Reasons to Run a Name Server</title>

      <para>Name servers usually come in two forms: an authoritative
	name server, and a caching name server.</para>

      <para>An authoritative name server is needed when:</para>

      <itemizedlist>
	<listitem>
	  <para>One wants to serve <acronym>DNS</acronym> information to
	    the world, replying authoritatively to queries.</para>
	</listitem>

	<listitem>
	  <para>A domain, such as <hostid
	    role="domainname">example.org</hostid>, is registered and
	    <acronym>IP</acronym> addresses need to be assigned to
	    hostnames under it.</para>
	</listitem>

	<listitem>
	  <para>An <acronym>IP</acronym> address block requires reverse
	    <acronym>DNS</acronym> entries (<acronym>IP</acronym> to
	    hostname).</para>
	</listitem>

	<listitem>
	  <para>A backup or second name server, called a slave, will
	    reply to queries.</para>
	</listitem>
      </itemizedlist>

      <para>A caching name server is needed when:</para>

      <itemizedlist>
	<listitem>
	  <para>A local <acronym>DNS</acronym> server may cache and
	    respond more quickly than querying an outside name
	    server.</para>
	</listitem>
      </itemizedlist>

      <para>When one queries for <hostid
	role="fqdn">www.FreeBSD.org</hostid>, the resolver usually
	queries the uplink <acronym>ISP</acronym>'s name server, and
	retrieves the reply.  With a local, caching
	<acronym>DNS</acronym> server, the query only has to be made
	once to the outside world by the caching <acronym>DNS</acronym>
	server.  Every additional query will not have to look to the
	outside of the local network, since the information is cached
	locally.</para>
    </sect2>

    <sect2>
      <title>How It Works</title>
      <para>In &os;, the BIND daemon is called
	<application>named</application> for obvious reasons.</para>

      <informaltable frame="none" pgwide="1">
	<tgroup cols="2">
	  <thead>
	    <row>
	      <entry>File</entry>
	      <entry>Description</entry>
	    </row>
	  </thead>

	  <tbody>
	    <row>
	      <entry>&man.named.8;</entry>
	      <entry>The BIND daemon.</entry>
	    </row>

	    <row>
	      <entry>&man.rndc.8;</entry>
	      <entry>Name server control utility.</entry>
	    </row>

	    <row>
	      <entry><filename class="directory">/etc/namedb</filename></entry>
	      <entry>Directory where BIND zone information resides.</entry>
	    </row>

	    <row>
	      <entry><filename>/etc/namedb/named.conf</filename></entry>
	      <entry>Configuration file of the daemon.</entry>
	    </row>
	  </tbody>
	</tgroup>
      </informaltable>

      <para>Depending on how a given zone is configured on the server,
	the files related to that zone can be found in the <filename
	class="directory">master</filename>, <filename
	class="directory">slave</filename>, or <filename
	class="directory">dynamic</filename> subdirectories of the
	<filename class="directory">/etc/namedb</filename> directory.
	These files contain the <acronym>DNS</acronym> information that
	will be given out by the name server in response to queries.</para>
    </sect2>

    <sect2>
      <title>Starting BIND</title>
      <indexterm>
	<primary>BIND</primary>
	<secondary>starting</secondary>
      </indexterm>

      <para>Since BIND is installed by default, configuring it all is
	relatively simple.</para>

      <para>The default <application>named</application> configuration
	is that of a basic resolving name server, ran in a
	&man.chroot.8; environment.  To start the server one time with
	this configuration, use the following command:</para>

      <screen>&prompt.root; <userinput>/etc/rc.d/named forcestart</userinput></screen>

      <para>To ensure the <application>named</application> daemon is
         started at boot each time, put the following line into the
         <filename>/etc/rc.conf</filename>:</para>

      <programlisting>named_enable="YES"</programlisting>

      <para>There are obviously many configuration options for
	<filename>/etc/namedb/named.conf</filename> that are beyond the
	scope of this document.  However, if you are interested in the
	startup options for <application>named</application> on &os;,
	take a look at the
	<literal>named_<replaceable>*</replaceable></literal> flags in
	<filename>/etc/defaults/rc.conf</filename> and consult the
	&man.rc.conf.5; manual page.  The
	<xref linkend="configtuning-rcd"/> section is also a good read.</para>
    </sect2>

    <sect2>
      <title>Configuration Files</title>
      <indexterm>
	<primary>BIND</primary>
	<secondary>configuration files</secondary>
      </indexterm>

      <para>Configuration files for <application>named</application>
	currently reside in
	<filename class="directory">/etc/namedb</filename> directory and
	will need modification before use, unless all that is needed is
	a simple resolver.  This is where most of the configuration will
	be performed.</para>

      <sect3>
	<title>Using <command>make-localhost</command></title>

	<para>To configure a master zone for the localhost visit the
	  <filename class="directory">/etc/namedb</filename> directory
	  and run the following command:</para>

	<screen>&prompt.root; <userinput>sh make-localhost</userinput></screen>

	<para>If all went well, a new file should exist in the
	  <filename class="directory">master</filename> subdirectory.
	  The filenames should be <filename>localhost.rev</filename> for
	  the local domain name and <filename>localhost-v6.rev</filename>
	  for <acronym>IPv6</acronym> configurations.  As the default
	  configuration file, required information will
	  be present in the <filename>named.conf</filename> file.</para>
      </sect3>

      <sect3>
	<title><filename>/etc/namedb/named.conf</filename></title>

	<programlisting>// &dollar;FreeBSD&dollar;
//
// Refer to the named.conf(5) and named(8) man pages, and the documentation
// in /usr/share/doc/bind9 for more details.
//
// If you are going to set up an authoritative server, make sure you
// understand the hairy details of how DNS works.  Even with
// simple mistakes, you can break connectivity for affected parties,
// or cause huge amounts of useless Internet traffic.

options {
	directory	"/etc/namedb";
	pid-file	"/var/run/named/pid";
	dump-file	"/var/dump/named_dump.db";
	statistics-file	"/var/stats/named.stats";

// If named is being used only as a local resolver, this is a safe default.
// For named to be accessible to the network, comment this option, specify
// the proper IP address, or delete this option.
	listen-on	{ 127.0.0.1; };

// If you have IPv6 enabled on this system, uncomment this option for
// use as a local resolver.  To give access to the network, specify
// an IPv6 address, or the keyword "any".
//	listen-on-v6	{ ::1; };

// In addition to the "forwarders" clause, you can force your name
// server to never initiate queries of its own, but always ask its
// forwarders only, by enabling the following line:
//
//	forward only;

// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below.  This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.
/*
	forwarders {
		127.0.0.1;
	};
*/</programlisting>

	<para>Just as the comment says, to benefit from an uplink's
	  cache, <literal>forwarders</literal> can be enabled here.
	  Under normal circumstances, a name server will recursively
	  query the Internet looking at certain name servers until it
	  finds the answer it is looking for.  Having this enabled will
	  have it query the uplink's name server (or name server
	  provided) first, taking advantage of its cache.  If the uplink
	  name server in question is a heavily trafficked, fast name
	  server, enabling this may be worthwhile.</para>

	<warning>
	  <para><hostid role="ipaddr">127.0.0.1</hostid> will
	    <emphasis>not</emphasis> work here.  Change this
	    <acronym>IP</acronym> address to a name server at your
	    uplink.</para>
	</warning>

	<programlisting>	/*
	 * If there is a firewall between you and nameservers you want
	 * to talk to, you might need to uncomment the query-source
	 * directive below.  Previous versions of BIND always asked
	 * questions using port 53, but BIND versions 8 and later
	 * use a pseudo-random unprivileged UDP port by default.
	 */
	 // query-source address * port 53;
};

// If you enable a local name server, don't forget to enter 127.0.0.1
// first in your /etc/resolv.conf so this server will be queried.
// Also, make sure to enable it in /etc/rc.conf.

zone "." {
	type hint;
	file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
	type master;
	file "master/localhost.rev";
};

// RFC 3152
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA" {
	type master;
	file "master/localhost-v6.rev";
};

// NB: Do not use the IP addresses below, they are faked, and only
// serve demonstration/documentation purposes!
//
// Example slave zone config entries.  It can be convenient to become
// a slave at least for the zone your own domain is in.  Ask
// your network administrator for the IP address of the responsible
// primary.
//
// Never forget to include the reverse lookup (IN-ADDR.ARPA) zone!
// (This is named after the first bytes of the IP address, in reverse
// order, with ".IN-ADDR.ARPA" appended.)
//
// Before starting to set up a primary zone, make sure you fully
// understand how DNS and BIND works.  There are sometimes
// non-obvious pitfalls.  Setting up a slave zone is simpler.
//
// NB: Don't blindly enable the examples below. :-)  Use actual names
// and addresses instead.

/* An example master zone
zone "example.net" {
	type master;
	file "master/example.net";
};
*/

/* An example dynamic zone
key "exampleorgkey" {
	algorithm hmac-md5;
	secret "sf87HJqjkqh8ac87a02lla==";
};
zone "example.org" {
	type master;
	allow-update {
		key "exampleorgkey";
	};
	file "dynamic/example.org";
};
*/

/* Examples of forward and reverse slave zones
zone "example.com" {
	type slave;
	file "slave/example.com";
	masters {
		192.168.1.1;
	};
};
zone "1.168.192.in-addr.arpa" {
	type slave;
	file "slave/1.168.192.in-addr.arpa";
	masters {
		192.168.1.1;
	};
};
*/</programlisting>

	<para>In <filename>named.conf</filename>, these are examples of
	  slave entries for a forward and reverse zone.</para>

	<para>For each new zone served, a new zone entry must be added
	  to <filename>named.conf</filename>.</para>

	<para>For example, the simplest zone entry for
	  <hostid role="domainname">example.org</hostid> can look
	  like:</para>

	<programlisting>zone "example.org" {
	type master;
	file "master/example.org";
};</programlisting>

	<para>The zone is a master, as indicated by the
	  <option>type</option> statement, holding its zone information
	  in <filename>/etc/namedb/master/example.org</filename>
	  indicated by the <option>file</option> statement.</para>

	<programlisting>zone "example.org" {
	type slave;
	file "slave/example.org";
};</programlisting>

	<para>In the slave case, the zone information is transferred
	  from the master name server for the particular zone, and saved
	  in the file specified.  If and when the master server dies or
	  is unreachable, the slave name server will have the
	  transferred zone information and will be able to serve
	  it.</para>
      </sect3>

      <sect3>
	<title>Zone Files</title>
	<indexterm>
	  <primary>BIND</primary>
	  <secondary>zone files</secondary>
	</indexterm>

	<para>An example master zone file for <hostid
	  role="domainname">example.org</hostid> (existing within
	  <filename>/etc/namedb/master/example.org</filename>) is as
	  follows:</para>

	<programlisting>&dollar;TTL 3600        ; 1 hour
example.org.    IN      SOA      ns1.example.org. admin.example.org. (
                                2006051501      ; Serial
                                10800           ; Refresh
                                3600            ; Retry
                                604800          ; Expire
                                86400           ; Minimum TTL
                        )

; DNS Servers
                IN      NS      ns1.example.org.
                IN      NS      ns2.example.org.

; MX Records
                IN      MX 10   mx.example.org.
                IN      MX 20   mail.example.org.

                IN      A       192.168.1.1

; Machine Names
localhost       IN      A       127.0.0.1
ns1             IN      A       192.168.1.2
ns2             IN      A       192.168.1.3
mx              IN      A       192.168.1.4
mail            IN      A       192.168.1.5

; Aliases
www             IN      CNAME   @</programlisting>

        <para>
          Note that every hostname ending in a <quote>.</quote> is an
          exact hostname, whereas everything without a trailing
          <quote>.</quote> is referenced to the origin.  For example,
          <literal>www</literal> is translated into
          <literal>www.<replaceable>origin</replaceable></literal>.
          In our fictitious zone file, our origin is
          <hostid>example.org.</hostid>, so <literal>www</literal>
          would translate to <hostid>www.example.org.</hostid>
        </para>

        <para>
          The format of a zone file follows:
        </para>
        <programlisting>recordname      IN recordtype   value</programlisting>

	<indexterm>
	  <primary>DNS</primary>
	  <secondary>records</secondary>
	</indexterm>
        <para>
          The most commonly used DNS records:
        </para>

	<variablelist>
	  <varlistentry>
	    <term>SOA</term>

	    <listitem><para>start of zone authority</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>NS</term>

	    <listitem><para>an authoritative name server</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>A</term>

	    <listitem><para>a host address</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>CNAME</term>

	    <listitem><para>the canonical name for an alias</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>MX</term>

	    <listitem><para>mail exchanger</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>PTR</term>

	    <listitem><para>a domain name pointer (used in reverse DNS)
	      </para></listitem>
	  </varlistentry>
	</variablelist>

        <programlisting>
example.org. IN SOA ns1.example.org. admin.example.org. (
                        2006051501      ; Serial
                        10800           ; Refresh after 3 hours
                        3600            ; Retry after 1 hour
                        604800          ; Expire after 1 week
                        86400 )         ; Minimum TTL of 1 day</programlisting>



	<variablelist>
	  <varlistentry>
	    <term><hostid role="domainname">example.org.</hostid></term>

	    <listitem><para>the domain name, also the origin for this
		zone file.</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term><hostid role="fqdn">ns1.example.org.</hostid></term>

	    <listitem><para>the primary/authoritative name server for this
		zone.</para></listitem>
	  </varlistentry>

	  <varlistentry>
	    <term><literal>admin.example.org.</literal></term>

	    <listitem><para>the responsible person for this zone,
		email address with <quote>@</quote>
          replaced.  (<email>admin@example.org</email> becomes
		<literal>admin.example.org</literal>)</para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term><literal>2006051501</literal></term>

	      <listitem><para>the serial number of the file.  This
		  must be incremented each time the zone file is
		  modified.  Nowadays, many admins prefer a
		  <literal>yyyymmddrr</literal> format for the serial
		  number.  <literal>2006051501</literal> would mean
		  last modified 05/15/2006, the latter
		  <literal>01</literal> being the first time the zone
		  file has been modified this day.  The serial number
		  is important as it alerts slave name servers for a
		  zone when it is updated.</para>
	      </listitem>
	  </varlistentry>
	</variablelist>

        <programlisting>
       IN NS           ns1.example.org.</programlisting>

        <para>
          This is an NS entry.  Every name server that is going to reply
          authoritatively for the zone must have one of these entries.
        </para>

        <programlisting>
localhost       IN      A       127.0.0.1
ns1             IN      A       192.168.1.2
ns2             IN      A       192.168.1.3
mx              IN      A       192.168.1.4
mail            IN      A       192.168.1.5</programlisting>

        <para>
          The A record indicates machine names.  As seen above,
          <hostid role="fqdn">ns1.example.org</hostid> would resolve
          to <hostid role="ipaddr">192.168.1.2</hostid>.
        </para>

        <programlisting>
                IN      A       192.168.1.1</programlisting>

	<para>This line assigns IP address
	  <hostid role="ipaddr">192.168.1.1</hostid> to the current origin,
	  in this case <hostid role="domainname">example.org</hostid>.</para>

        <programlisting>
www             IN CNAME        @</programlisting>

        <para>
          The canonical name record is usually used for giving aliases
          to a machine.  In the example, <hostid>www</hostid> is
          aliased to the <quote>master</quote> machine which name equals
          to domain name <hostid role="domainname">example.org</hostid>
          (<hostid role="ipaddr">192.168.1.1</hostid>).
          CNAMEs can be used to provide alias
          hostnames, or round robin one hostname among multiple
          machines.
        </para>

	<indexterm>
	  <primary>MX record</primary>
	</indexterm>

        <programlisting>
               IN MX   10      mail.example.org.</programlisting>

        <para>
          The MX record indicates which mail
          servers are responsible for handling incoming mail for the
          zone.  <hostid role="fqdn">mail.example.org</hostid> is the
          hostname of the mail server, and 10 being the priority of
          that mail server.
        </para>

        <para>
          One can have several mail servers, with priorities of 10,
          20 and so on.  A mail server attempting to deliver to <hostid
          role="domainname">example.org</hostid> would first try the
          highest priority MX (the record with the lowest priority
	  number), then the second highest, etc, until the mail can be
	  properly delivered.
        </para>

        <para>
          For in-addr.arpa zone files (reverse DNS), the same format is
          used, except with PTR entries instead of
	  A or CNAME.
        </para>

        <programlisting>$TTL 3600

1.168.192.in-addr.arpa. IN SOA ns1.example.org. admin.example.org. (
                        2006051501      ; Serial
                        10800           ; Refresh
                        3600            ; Retry
                        604800          ; Expire
                        3600 )          ; Minimum

        IN      NS      ns1.example.org.
        IN      NS      ns2.example.org.

1       IN      PTR     example.org.
2       IN      PTR     ns1.example.org.
3       IN      PTR     ns2.example.org.
4       IN      PTR     mx.example.org.
5       IN      PTR     mail.example.org.</programlisting>

        <para>This file gives the proper IP address to hostname
          mappings of our above fictitious domain.</para>
      </sect3>
    </sect2>

    <sect2>
      <title>Caching Name Server</title>
      <indexterm>
        <primary>BIND</primary>
        <secondary>caching name server</secondary>
      </indexterm>

      <para>A caching name server is a name server that is not
        authoritative for any zones.  It simply asks queries of its
        own, and remembers them for later use.  To set one up, just
        configure the name server as usual, omitting any inclusions of
        zones.</para>
    </sect2>

    <sect2>
      <title>Security</title>

      <para>Although BIND is the most common implementation of DNS,
        there is always the issue of security.  Possible and
        exploitable security holes are sometimes found.
      </para>

      <para>While &os; automatically drops
	<application>named</application> into a &man.chroot.8;
	environment; there are several other security mechanisms in
	place which could help to lure off possible
	<acronym>DNS</acronym> service attacks.</para>

      <para>It is always good idea to read <ulink
	url="http://www.cert.org/">CERT</ulink>'s security advisories
	and to subscribe to the &a.security-notifications; to stay up to
	date with the current Internet and &os; security issues.</para>

      <tip>
	<para>If a problem arises, keeping sources up to date and
	  having a fresh build of <application>named</application> would
	  not hurt.</para>
      </tip>
    </sect2>

    <sect2>
      <title>Further Reading</title>

      <para>BIND/<application>named</application> manual pages:
      &man.rndc.8; &man.named.8; &man.named.conf.5;</para>

      <itemizedlist>
	<listitem>
	  <para><ulink
	      url="http://www.isc.org/products/BIND/">Official ISC BIND
	      Page</ulink></para>
	</listitem>

	<listitem>
	  <para><ulink
	      url="http://www.isc.org/sw/guild/bf/">Official ISC BIND
	      Forum</ulink></para>
	</listitem>

	<listitem>
	  <para><ulink
	      url="http://www.nominum.com/getOpenSourceResource.php?id=6">
	      BIND FAQ</ulink></para>
	</listitem>

	<listitem>
	  <para><ulink url="http://www.oreilly.com/catalog/dns5/">O'Reilly
	      DNS and BIND 5th Edition</ulink></para>
	</listitem>

	<listitem>
	  <para><ulink
	      url="ftp://ftp.isi.edu/in-notes/rfc1034.txt">RFC1034
	      - Domain Names - Concepts and Facilities</ulink></para>
	</listitem>

	<listitem>
	  <para><ulink
	      url="ftp://ftp.isi.edu/in-notes/rfc1035.txt">RFC1035
	      - Domain Names - Implementation and Specification</ulink></para>
	</listitem>
      </itemizedlist>
    </sect2>
  </sect1>

  <sect1 id="network-apache">
    <sect1info>
      <authorgroup>
	<author>
	  <firstname>Murray</firstname>
	  <surname>Stokely</surname>
	  <contrib>ÓõíåéóöïñÜ ôïõ </contrib>
	</author>

	<author>
	  <firstname>ÂáããÝëçò</firstname>
	  <surname>ÔõðÜëäïò</surname>
	  <contrib>ÌåôÜöñáóç </contrib>
	</author>
      </authorgroup>
    </sect1info>

    <title>Ï åîõðçñåôçôÞò HTTP Apache</title>

    <indexterm><primary>åîõðçñåôçôÝò web</primary>
      <secondary>åãêáôÜóôáóç</secondary></indexterm>
    <indexterm><primary>Apache</primary></indexterm>

    <sect2>
      <title>Óýíïøç</title>

      <para>Ôï &os; ÷ñçóéìïðïéåßôáé ãéá íá öéëïîåíåß ðáãêïóìßùò éóôïóåëßäåò
        ìåãÜëçò åðéóêåøéìüôçôáò.  Ïé ðåñéóóüôåñïé äéáêïìéóôÝò web óôï
        äéáäßêôõï ÷ñçóéìïðïéïýí ôïí <application>åîõðçñåôçôÞ HTTP
        Apache</application>.  Ôá ðáêÝôá ëïãéóìéêïý
        ôïõ <application>Apache</application> èá ðñÝðåé íá ðåñéÝ÷ïíôáé óôï
        ìÝóï åãêáôáôÜóôáóçò ôïõ &os; ðïõ ÷ñçóéìïðïéåßôå. Áí äåí åãêáôáóôÞóáôå
        ôïí <application>Apache</application> êáôÜ ôçí äéÜñêåéá ôçò
        åãêáôÜóôáóçò ôïõ &os;, ôüôå ìðïñåßôå íá ôïí åãêáôáóôÞóåôå áðü ôï
        ðáêÝôï <filename role="package">www/apache13</filename> Þ áðü ôï
        ðáêÝôï <filename role="package">www/apache20</filename>.</para>

      <para>Áöïý ïëïêëçñþóåôå åðéôõ÷þò ôçí åãêáôÜóôáóç
        ôïõ <application>Apache</application>, èá ðñÝðåé íá êÜíåôå ôéò
        áðáñáßôçôåò ñõèìßóåéò.</para>

      <note>
	<para>ÁõôÞ ç åíüôçôá êáëýðôåé ôçí Ýêäïóç
          åîõðçñåôçôþí <application>Apache HTTP 1.3.X</application>, ìéáò ðïõ
          áõôÞ ç Ýêäïóç åßíáé ç ðéï äéáäåäïìÝíç ãéá ôï &os;.
          Ï <application>Apache</application>&nbsp;2.X ðáñïõóéÜæåé ðïëëÝò íÝåò
          ôå÷íïëïãßåò áëëÜ áõôÝò äåí ðåñéãñÜöïíôáé óå áõôÞ ôçí åíüôçôá.
          Ðåñéóóüôåñåò ðëçñïöïñßåò ãéá
          ôïí <application>Apache</application>&nbsp;2.X, ìðïñåßôå íá äåßôå
          óôçí óåëßäá <ulink url="http://httpd.apache.org/"></ulink>.</para>
      </note>
    </sect2>

    <sect2>
      <title>Ñõèìßóåéò</title>

      <indexterm>
	<primary>Apache</primary>
	<secondary>áñ÷åßï ñõèìßóåùí</secondary>
      </indexterm>

      <para>Óôï &os; ôï óçìáíôéêüôåñï áñ÷åßï ñõèìßóåùí
	ôïõ <application>ÅîõðçñåôçôÞ HTTP Apache</application> åßíáé
	ôï <filename>/usr/local/etc/apache/httpd.conf</filename>.  Åßíáé Ýíá
	ôõðéêü &unix; ñõèìéóôéêü áñ÷åßï êåéìÝíïõ, ìå ãñáììÝò ó÷ïëßùí ðïõ
	îåêéíïýí ìå ôïí ÷áñáêôÞñá <literal>#</literal>.  Óêïðüò ìáò åäþ äåí
	åßíáé ìéá ïëïêëçñùìÝíç ðåñéãñáöÞ üëùí ôùí ðéèáíþí åðéëïãþí, åðïìÝíùò
	èá ðåñéãñÜøïõìå ìüíï ôéò ðéï äçìïöéëåßò åðéëïãÝò ñõèìßóåéò
	(configuration directives).</para>

      <variablelist>
	<varlistentry>
	  <term><literal>ServerRoot "/usr/local"</literal></term>

	  <listitem>
	    <para>Åäþ ðåñéãñÜöåôáé ï ðñïåðéëåãìÝíïò éåñáñ÷éêÜ êáôÜëïãïò
	      åãêáôÜóôáóçò ãéá ôïí <application>Apache</application>.  Ôá
	      åêôåëÝóéìá áñ÷åßá åßíáé áðïèçêåõìÝíá óôïõò
	      õðïêáôáëüãïõò <filename class="directory">bin</filename>
	      êáé <filename class="directory">sbin</filename> ôïõ
	      êáôáëüãïõ <quote>ServerRoot</quote> êáé ôá áñ÷åßá ñõèìßóåùí
	      áðïèçêåýïíôáé óôïí
	      êáôÜëïãï <filename class="directory">etc/apache</filename>.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term><literal>ServerAdmin you@your.address</literal></term>

	  <listitem>
	    <para>Ç çëåêôñïíéêÞ äéåýèõíóç óôçí ïðïßá èá ðñÝðåé íá
	      áðïóôÝëëïíôáé áíáöïñÝò ðñïâëçìÜôùí ó÷åôéêÜ ìå ôïí
	      åîõðçñåôçôÞ. ÁõôÞ ç äéåýèõíóç åìöáíßæåôáé óå êÜðïéåò óåëßäåò ðïõ
	      äçìéïõñãïýíôáé áðü ôïí åîõðçñåôçôÞ, üðùò ïé óåëßäåò
	      óöáëìÜôùí.</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term><literal>ServerName www.example.com</literal></term>

	  <listitem>
	    <para>Ôï <literal>ServerName</literal> óáò åðéôñÝðåé íá èÝóåôå Ýíá
	      üíïìá êüìâïõ (hostname) ãéá ôïí åîõðçñåôçôÞ óáò, ôï ïðïßï
	      áðïóôÝëëåôáé ðßóù óôïõò clients áí åßíáé äéáöïñåôéêü áðü åêåßíï
	      ðïõ Ý÷åôå Þäç ñõèìßóåé óôïí êüìâï óáò (åäþ ìðïñåßôå, ãéá
	      ðáñÜäåéãìá, íá ÷ñçóéìïðïéÞóåôå <hostid>www</hostid> áíôß ôïõ
	      ðñáãìáôéêïý ïíüìáôïò ôïõ êüìâïõ).</para>
	  </listitem>
	</varlistentry>

	<varlistentry>
	  <term><literal>DocumentRoot "/usr/local/www/data"</literal></term>

	  <listitem>
	    <para><literal>DocumentRoot</literal>: Åßíáé ï êáôÜëïãïò áðü ôïí
	      ïðïßï èá ðñïóöÝñïíôáé ôá Ýããñáöá óáò. ÐñïåðéëåãìÝíá, üëá ôá
	      áéôÞìáôá èá åîõðçñåôïýíôáé áðü áõôü ôïí êáôÜëïãï, áëëÜ ìðïñïýí
	      åðßóçò íá ÷ñçóéìïðïéçèïýí óõìâïëéêïß äåóìïß (symbolic link) Þ
	      ðáñùíýìéá (aliases) ðïõ èá óôï÷åýïõí óå Üëëåò ôïðïèåóßåò.</para>
	  </listitem>
	</varlistentry>
      </variablelist>

      <para>Ðñéí êÜíåôå ïðïéáäÞðïôå áëëáãÞ, åßíáé êáëü íá äçìéïõñãåßôå
	áíôßãñáöá áóöáëåßáò (backup) ôïõ áñ÷åßïõ ñõèìßóåùí
	ôïõ <application>Apache</application>.  Ìüëéò êñßíåôå ðùò åßóôå
	éêáíïðïéçìÝíïò ìå ôéò áñ÷éêÝò ñõèìßóåéò ìðïñåßôå íá îåêéíÞóåôå ìå ôçí
	åêôÝëåóç ôïõ <application>Apache</application>.</para>

<!-- sect3 for performance tuning directives?  maxservers minservers -->
<!-- etc..?? -->

<!-- Advanced configuration section.

Performance tuning directives.

Log file format -->
    </sect2>

    <sect2>
      <title>ÅêôÝëåóç ôïõ <application>Apache</application></title>

      <indexterm>
	<primary>Apache</primary>
	<secondary>åêêßíçóç Þ óôáìÜôçìá</secondary>
      </indexterm>

      <para>O <application>Apache</application> äåí ôñÝ÷åé äéáìÝóïõ ôïõ
	õðåñ-äéáêïìéóôÞ <application>inetd</application> üðùò êÜíïõí ðïëëïß
	Üëëïé äéêôõáêïß åîõðçñåôçôÝò.  Åßíáé ñõèìéóìÝíïò íá ôñÝ÷åé áõôüíïìá
	ãéá íá åîõðçñåôåß êáëýôåñá ôéò áéôÞóåéò HTTP ôùí ðåëáôþí ôïõ, äçëáäÞ
	ôùí ðñïãñáììÜôùí ðëïÞãçóçò (browsers).  Ç åãêáôÜóôáóç
	ôïõ <application>Apache</application> áðü ôá &os; Ports ðåñéÝ÷åé Ýíá
	âïçèçôéêü shell script ãéá ôçí åêêßíçóç, ôï óôáìÜôçìá êáé ôçí
	åðáíåêêßíçóç ôïõ åîõðçñåôçôÞ.  Ãéá íá îåêéíÞóåôå
	ôïí <application>Apache</application> ãéá ðñþôç öïñÜ, áðëÜ
	ôñÝîôå:</para>

      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl start</userinput></screen>

      <para>Ìðïñåßôå ïðïéáäÞðïôå óôéãìÞ íá óôáìáôÞóåôå ôïí åîõðçñåôçôÞ,
	ðëçêôñïëïãþíôáò:</para>

      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl stop</userinput></screen>

      <para>ÌåôÜ áðü áëëáãÝò ðïõ ðéèáíþò íá êÜíáôå ãéá ïðïéïíäÞðïôå ëüãï óôï
	áñ÷åßï ñõèìßóåùí, èá ÷ñåéáóôåß íá åðáíåêêéíÞóåôå ôïí
	åîõðçñåôçôÞ:</para>

      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl restart</userinput></screen>

      <para>Ãéá íá åðáíåêêéíÞóåôå ôïí <application>Apache</application> äß÷ùò
        íá äéáêüøåôå ôéò ôñÝ÷ïõóåò óõíäÝóåéò, ôñÝîôå:</para>

      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl graceful</userinput></screen>

      <para>Ðåñéóóüôåñåò ðëçñïöïñßåò èá âñåßôå óôç óåëßäá âïÞèåéáò ôïõ
	&man.apachectl.8;.</para>

      <para>Ãéá íá îåêéíÜåé ï <application>Apache</application> áõôüìáôá êáôÜ
        ôç äéÜñêåéá åêêßíçóçò ôïõ óõóôÞìáôïò, ðñïóèÝóôå ôçí áêüëïõèç ãñáììÞ
        óôï <filename>/etc/rc.conf</filename>:</para>

      <programlisting>apache_enable="YES"</programlisting>

      <para>Áí åðéèõìåßôå íá ðáñÝ÷ïíôáé êáôÜ ôçí åêêßíçóç ôïõ óõóôÞìáôïò
	ðñüóèåôåò åðéëïãÝò óôçí ãñáììÞ åíôïëþí ãéá ôï
	ðñüãñáììá <application>Apache</application> <command>httpd</command>
	ìðïñåßôå íá ôéò äçëþóåôå ìå ìéá ðñüóèåôç ãñáììÞ
	óôï <filename>rc.conf</filename>:</para>

      <programlisting>apache_flags=""</programlisting>

      <para>Ôþñá ðïõ Ý÷åé îåêéíÞóåé ï åîõðçñåôÞò web, ìðïñåßôå íá äåßôå ôçí
        éóôïóåëßäá óáò óôï÷åýïíôáò ôï ðñüãñáììá ðëïÞãçóçò
        óôï <literal>http://localhost/</literal>.  Ç ðñïêáèïñéóìÝíç óåëßäá ðïõ
        åìöáíßæåôáé åßíáé
        ç <filename>/usr/local/www/data/index.html</filename>.</para>
    </sect2>

    <sect2>
      <title>Virtual Hosting</title>

      <para>Ï <application>Apache</application> õðïóôçñßæåé äýï äéáöïñåôéêïýò
        ôýðïõò Virtual Hosting.  Ôï Ïíïìáóôéêü virtual hosting ÷ñçóéìïðïéåß
        ôïõò HTTP/1.1 headers ãéá íá êáèïñßóåé ôïí êüìâï.  Áõôü åðéôñÝðåé ôçí
        êïéíÞ ÷ñÞóç ôçò ßäéáò IP ãéá ðïëëÜ êáé äéáöïñåôéêÜ domains.</para>

      <para>Ãéá íá ñõèìßóåôå ôïí <application>Apache</application> íá
        ÷ñçóéìïðïéåß ôï Ïíïìáóôéêü Virtual Hosting åéóÜãåôå ìéá êáôá÷þñéóç
        óôï <filename>httpd.conf</filename> óáí ôçí áêüëïõèç:</para>

      <programlisting>NameVirtualHost *</programlisting>

      <para>Áí ï äéáêïìéóôÞò web
	ïíïìÜæåôáé <hostid role="fqdn">www.domain.tld</hostid> êáé åðéèõìåßôå
	íá åãêáôáóôÞóåôå Ýíá virtual domain ãéá
	ôï <hostid role="fqdn">www.someotherdomain.tld</hostid> ôüôå èá ðñÝðåé
	íá ðñïóèÝóåôå ôéò áêüëïõèåò êáôá÷ùñÞóåéò
	óôï<filename>httpd.conf</filename>:</para>

      <screen>&lt;VirtualHost *&gt;
ServerName www.domain.tld
DocumentRoot /www/domain.tld
&lt;/VirtualHost&gt;

&lt;VirtualHost *&gt;
ServerName www.someotherdomain.tld
DocumentRoot /www/someotherdomain.tld
&lt;/VirtualHost&gt;</screen>

      <para>ÁíôéêáôáóôÞóôå ôéò ðáñáðÜíù äéåõèýíóåéò ìå åêåßíåò ðïõ åðéèõìåßôå
	íá ÷ñçóéìïðïéÞóåôå êáé ôçí êáôÜëëçëç äéáäñïìÞ ðñïò ôá ÝããñáöÜ
	óáò.</para>

      <para>Ãéá ðåñéóóüôåñåò ðëçñïöïñßåò ó÷åôéêÜ ìå ôéò ñõèìßóåéò ãéá ôá
	virtual host, óáò ðñïôñÝðïõìå íá óõìâïõëåõôåßôå ôçí åðßóçìç ôåêìçñßùóç
	ôïõ <application>Apache</application>
	óôï <ulink url="http://httpd.apache.org/docs/vhosts/"></ulink>.</para>
    </sect2>

    <sect2>
      <title>Apache Modules</title>

      <indexterm>
	<primary>Apache</primary>
	<secondary>modules</secondary>
      </indexterm>
      <indexterm>
	<primary>Apache</primary>
	<secondary>áñèñþìáôá</secondary>
      </indexterm>
      <indexterm>
	<primary>Apache</primary>
	<secondary>åðåêôÜóåéò</secondary>
      </indexterm>

      <para>ÕðÜñ÷ïõí ðïëëïß êáé äéÜöïñïé äéáèÝóéìïé ôýðïé áñèñùìÜôùí (modules)
	ãéá ôïí <application>Apache</application>, ôá ïðïßá åðåêôåßíïõí êé
	åìðëïõôßæïõí ôéò ëåéôïõñãßåò ôïõ âáóéêïý åîõðçñåôçôÞ.  Ç ÓõëëïãÞ ôùí
	Ports ôïõ &os; ðáñÝ÷åé Ýíáí åýêïëï ôñüðï ãéá íá åãêáôáóôÞóåôå
	ôïí <application>Apache</application> êáé ìåñéêÜ áðü ôá ðéï äçìïöéëÞ
	áñèñþìáôá.</para>

      <sect3>
        <title>mod_ssl</title>

	<indexterm>
	  <primary>web servers</primary>
          <secondary>secure</secondary>
	</indexterm>
	<indexterm><primary>SSL</primary></indexterm>
	<indexterm><primary>cryptography</primary></indexterm>

        <para>Ôï Üñèñùìá <application>mod_ssl</application> ÷ñçóéìïðïéåß ôçí
          âéâëéïèÞêç OpenSSL ãéá íá ðáñÝ÷åé éó÷õñÞ êñõðôïãñÜöçóç äéáìÝóïõ ôùí
          ðñùôïêüëùí Secure Sockets Layer (SSL v2/v3) êáé Transport Layer
          Security (TLS v1).  Ôï Üñèñùìá ðáñÝ÷åé üëá ôá áðáñáßôçôá óõóôáôéêÜ
          ãéá íá ìðïñåß íá áéôåßôáé õðïãåããñáììÝíá ðéóôïðïéçôéêÜ áðü Ýìðéóôïõò
          åîïõóéïäïôçìÝíïõò öïñåßò ðéóôïðïßçóçò Ýôóé þóôå íá ìðïñåßôå íá
          ôñÝ÷åôå Ýíáí áóöáëÞ åîõðçñåôçôÞ web óôï &os;.</para>

	<para>ÅÜí äåí Ý÷åôå åãêáôáóôÞóåé áêüìç
	  ôïí <application>Apache</application>, ìðïñåßôå íá åãêáôáóôÞóåôå ôçí
	  Ýêäïóç ôïõ <application>Apache</application> 1.3.X ðïõ ðåñéëáìâÜíåé
	  ôï <application>mod_ssl</application> áðü ôçí
	  port <filename role="package">www/apache13-modssl</filename> . Ôï
	  SSL åßíáé åðßóçò äéáèÝóéìï ãéá
	  ôïí <application>Apache</application>&nbsp;2.X óôçí
	  port <filename role="package">www/apache20</filename>, üðïõ ôï SSL
	  åßíáé åíåñãïðïéçìÝíï áðü ðñïåðéëïãÞ.</para>

<!-- XXX add more information about configuring mod_ssl here. -->
<!-- Generating keys, getting the key signed, setting up your secure -->
<!-- web server! -->
      </sect3>

      <sect3>
        <title>ÄõíáìéêÝò Éóôïóåëßäåò ìå  Perl &amp; PHP</title>

        <para>Ôçí ôåëåõôáßá äåêáåôßá, ðïëëÝò åðé÷åéñÞóåéò óôñÝøáíå ôéò
          äñáóôçñéüôçôåò ôïõò ðñïò ôï ºíôåñíåô ìå óêïðü íá âåëôéþóïõí ôá Ýóïäá
          ôïõò êáé ãéá ìåãáëýôåñç ðñïâïëÞ.  Áõôü ìå ôç óåéñÜ ôïõ äçìéïýñãçóå
          ôçí áíÜãêç ãéá äéáäñáóôéêü äéáäéêôõáêü ðåñéå÷üìåíï.  Åíþ êÜðïéåò
          åôáéñåßåò, üðùò ç &microsoft;, ðáñïõóßáóáí ëýóåéò åíóùìáôùìÝíåò óôá
          éäéüêôçôá ðñïúüíôá ôïõò, ç êïéíüôçôá áíïé÷ôïý ëïãéóìéêïý Ýëáâå ôï
          ìÞíõìá. Óôéò óýã÷ñïíåò åðéëïãÝò ãéá äéáäéêôõáêÝò óåëßäåò äõíáìéêïý
          ðåñéå÷ïìÝíïõ ðåñéëáìâÜíïíôáé ôá Django, Ruby on Rails, mod_perl êáé
          mod_php.

          <application>mod_perl</application> &amp;
          <application>mod_php</application>.</para>

        <sect4>
        <title>mod_perl</title>

	<indexterm>
          <primary>mod_perl</primary>
          <secondary>Perl</secondary>
        </indexterm>

        <para>Ôï ãåãïíüò óõíýðáñîçò <application>Apache</application>/Perl
	  öÝñíåé êïíôÜ ôç ìåãÜëç äýíáìç ôçò ãëþóóáò ðñïãñáììáôéóìïý Perl êáé
	  ôïí <application>åîõðçñåôçôÞ HTTP Apache</application>.  Ìå ôï
	  Üñèñùìá <application>mod_perl</application> Ý÷åôå ôç äõíáôüôçôá íá
	  ãñÜøåôå åðåêôÜóåéò ãéá ôïí <application>Apache</application> åî'
	  ïëïêëÞñïõ óå Perl.  ÅðéðëÝïí, ï äéáôçñÞóéìïò ìåôáãëùôôéóôÞò ðïõ
	  åßíáé åíóùìáôùìÝíïò óôïí åîõðçñåôçôÞ óáò åðéôñÝðåé íá áðïöýãåôå ôçí
	  ÷ñÞóç åíüò åîùôåñéêïý ìåôáãëùôôéóôÞ Perl êáé íá åðéâáñõíèåßôå áðü ôï
	  ÷ñüíï åêêßíçóçò ôïõ.</para>

        <para>Ôï <application>mod_perl</application> äéáôßèåôáé ìå äéÜöïñïõò
          ôñüðïõò.  Ãéá íá ÷ñçóéìïðïéÞóåôå
          ôï <application>mod_perl</application> íá èõìÜóôå üôé ôï mod_perl
          1.0 <application>mod_perl</application> 1.0 äïõëåýåé ìüíï ìå
          ôïí <application>Apache</application> 1.3 êáé
          ôï <application>mod_perl</application> 2.0 äïõëåýåé ìüíï ìå
          ôïí <application>Apache</application> 2.
          Ôï <application>mod_perl</application> 1.0 åßíáé äéáèÝóéìï óôï
          port <filename role="package">www/mod_perl</filename> åíþ ìéá
          óôáôéêÜ ìåôáãëùôôéóìÝíç Ýêäïóç åßíáé äéáèÝóéìç
          óôï <filename role="package">www/apache13-modperl</filename>.
          Ôï <application>mod_perl</application> 2.0 äéáôßèåôáé óôï
          port <filename role="package">www/mod_perl2</filename>.</para>
        </sect4>

        <sect4>
          <sect4info>
	  <authorgroup>
	    <author>
	      <firstname>Tom</firstname>
	      <surname>Rhodes</surname>
	      <contrib>ÓõããñáöÞ áðü ôïí </contrib>
	    </author>
	  </authorgroup>
        </sect4info>
        <title>mod_php</title>

	<indexterm>
          <primary>mod_php</primary>
          <secondary>PHP</secondary>
        </indexterm>

	<para>Ôï <acronym>PHP</acronym>, ãíùóôü êáé ùò <quote>PHP: Hypertext
            Preprocessor</quote> åßíáé ìéá script ãëþóóá ðñïãñáììáôéóìïý
          ãåíéêÞò ÷ñÞóçò áëëÜ éäéáßôåñá êáôÜëëçëç ãéá áíÜðôõîç ëïãéóìéêïý Web.
          Ç óýíôáîÞ ôçò ðñïÝñ÷åôáé áðü ôéò C, &java; êáé Perl êáé Ý÷åé ôçí
          äõíáôüôçôá íá åíóùìáôþíåôáé óå êþäéêá <acronym>HTML</acronym>, ìå
          óêïðü íá åðéôñÝðåé óôïõò ðñïãñáììáôéóôÝò web íá ãñÜöïõí ãñÞãïñá
          äõíáìéêÝò éóôïóåëßäåò.</para>

	<para>Ï <application>Apache</application> õðïóôçñßæåé
          ôï <acronym>PHP</acronym>5.  Ìðïñåßôå íá îåêéíÞóåôå åãêáèéóôþíôáò ôï
          ðáêÝôï <filename role="package">lang/php5</filename>.</para>

	<para>Áí ôï ðáêÝôï <filename role="package">lang/php5</filename>
	  åãêáèßóôáôáé ãéá ðñþôç öïñÜ, áõôüìáôá èá óáò åìöáíéóôïýí üëåò ïé
	  äõíáôÝò åðéëïãÝò <literal>OPTIONS</literal>. Áí êÜðïéï ìåíïý äåí
	  åìöáíßæåôáé, ð.÷. åðåéäÞ ôï
	  ðáêÝôï <filename role="package">lang/php5</filename> åß÷å
	  åãêáôáóôáèåß óôï ðáñåëèüí, ìðïñåßôå ðÜíôá íá ñõèìßóåôå áðü ôçí áñ÷Þ
	  ôï ðáêÝôï, ôñÝ÷ïíôáò óôïí êáôÜëïãï ôïõ port:</para>

	<screen>&prompt.root; <userinput>make config</userinput></screen>

	<para>Óôéò åðéëïãÝò åãêáôÜóôáóçò, äéáëÝîôå ôçí
	  åðéëïãÞ <literal>APACHE</literal> þóôå íá óõìðåñéëçöèåß êáé ôï
	  Üñèñùìá <application>mod_php</application> ãéá ôïí
	  åîõðçñåôçôÞ <application>Apache</application>.</para>

	<note>
	  <para>ÌåñéêÝò ôïðïèåóßåò ÷ñçóéìïðïéïýí áêüìç
	    ôï <acronym>PHP</acronym>4 ãéá äéÜöïñïõò ëüãïõò (ð.÷. èÝìáôá
	    óõìâáôüôçôïò Þ åðåéäÞ Ý÷ïõí Þäç åãêáôåóôçìÝíåò åöáñìïãÝò ðïõ ôï
	    áðáéôïýí).  Áí åßíáé áíÜãêç íá ÷ñçóéìïðïéÞóåôå
	    ôï <application>mod_php4</application> áíôß
	    ôïõ <application>mod_php5</application>, ôüôå ÷ñçóéìïðïéåßóôå ôï
	    port <filename role="package">lang/php4</filename>.  Ôï
	    port <filename role="package">lang/php4</filename> õðïóôçñßæåé
	    ðïëëÝò áðü ôéò ñõèìßóåéò êáé ôéò åðéëïãÝò åãêáôÜóôáóçò ôïõ
	    port <filename role="package">lang/php5</filename>.</para>
	</note>

	<para>Ìå áõôü ôïí ôñüðï èá åãêáôáóôáèïýí êáé èá ñõèìéóôïýí ôá
          áðáéôïýìåíá áñèñþìáôá þóôå íá õðïóôçñßæïõí äõíáìéêÝò
          åöáñìïãÝò <acronym>PHP</acronym>. Ãéá åðéâåâáßùóç åëÝãîôå ðùò Ý÷ïõí
          ðñïóôåèåß óôéò áíôßóôïé÷åò åíüôçôåò
          ôïõ <filename>/usr/local/etc/apache/httpd.conf</filename> ôá
          áêüëïõèá::</para>

	<programlisting>LoadModule php5_module        libexec/apache/libphp5.so</programlisting>

        <programlisting>AddModule mod_php5.c
    &lt;IfModule mod_php5.c&gt;
        DirectoryIndex index.php index.html
    &lt;/IfModule&gt;
    &lt;IfModule mod_php5.c&gt;
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
    &lt;/IfModule&gt;</programlisting>

        <para>Áöïý ïëïêëçñþóåôå ôïí Ýëåã÷ï, ãéá íá öïñôùèåß ôï
          Üñèñùìá <acronym>PHP</acronym> ÷ñåéÜæåôáé ìéá áðëÞ êëÞóç ìå ôçí
          åíôïëÞ <command>apachectl</command> ãéá ìéá êáíïíéêÞ (graceful)
          åðáíåêêßíçóç:</para>

	<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>

	<para>Ãéá ìåëëïíôéêÝò áíáâáèìßóåéò ôïõ <acronym>PHP</acronym>, äåí
	  áðáéôåßôáé ç åíôïëÞ <command>make config</command>.  Ïé
	  åðéëåãìÝíåò <literal>OPTIONS</literal> áðïèçêåýïíôáé áõôüìáôá áðü ôï
	  ìç÷áíéóìü åãêáôÜóôáóçò ôùí Ports ôïõ &os;.</para>

        <para>Ç óýíèåóç ôïõ <acronym>PHP</acronym> óôï &os;, åßíáé åîáéñåôéêÜ
	  óôïé÷åéáêÞ, êáé ï âáóéêüò êïñìüò ðïõ Ý÷åé åãêáôáóôáèåß åßíáé ðïëý
	  ðåñéïñéóìÝíïò.  Åßíáé ðïëý åýêïëï üìùò íá ðñïóèÝóïõìå åðåêôÜóåéò
	  ÷ñçóéìïðïéþíôáò ôï
	  port <filename role="package">lang/php5-extensions</filename>.  Áõôü
	  ôï port ðáñÝ÷åé ìåíïý åðéëïãþí ãéá ôçí åãêáôÜóôáóç ôùí åðåêôÜóéìùí
	  óõóôáôéêþí ôïõ <acronym>PHP</acronym>.  ÅíáëëáêôéêÜ, ìðïñåßôå íá
	  åãêáôáóôÞóåôå êáèåìßá åðÝêôáóç îå÷ùñéóôÜ ÷ñçóéìïðïéþíôáò ôï
	  êáôÜëëçëï port.</para>

	<para>Ãéá ðáñÜäåéãìá, ãéá íá ðñïóèÝóåôå óôï <acronym>PHP</acronym>5,
	  ôç äõíáôüôçôá õðïóôÞñéîçò ãéá âÜóåéò
	  äåäïìÝíùí<application>MySQL</application> áðëÜ åãêáôáóôÞóôå ôï
	  port <filename role="package">databases/php5-mysql</filename>.</para>

        <para>ÌåôÜ ôçí åãêáôÜóôáóç åíüò íÝïõ áñèñþìáôïò Þ êÜðïéáò Üëëçò
	  åðÝêôáóçò, ï åîõðçñåôçôÞò <application>Apache</application> èá
	  ðñÝðåé íá åðáíáöïñôùèåß ãéá íá åíåñãïðïéçèïýí ïé íÝåò
	  ñõèìßóåéò:</para>

	<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>
        </sect4>
      </sect3>
    </sect2>
  </sect1>

  <sect1 id="network-ftp">
    <sect1info>
      <authorgroup>
	<author>
	  <firstname>Murray</firstname>
	  <surname>Stokely</surname>
	  <contrib>ÓõíåéóöïñÜ ôïõ </contrib>
	</author>
      </authorgroup>
    </sect1info>
    <title>Ðñùôüêïëï ÌåôáöïñÜò Áñ÷åßùí (FTP)</title>

    <indexterm><primary>FTP servers</primary></indexterm>

    <sect2>
      <title>Óýíïøç</title>

      <para>Ôï Ðñùôüêïëï ÌåôáöïñÜò Áñ÷åßùí (File Transfer Protocol - FTP)
	ðáñÝ÷åé óôïõò ÷ñÞóôåò Ýíáí åýêïëï ôñüðï ãéá íá ìåôáöÝñïõí ôá áñ÷åßá
	ôïõò áðü êáé ðñïò Ýíáí åîõðçñåôçôÞ <acronym role="File Transfer
	Protocol">FTP</acronym>.  Ôï âáóéêü óýóôçìá ôïõ &os; ðåñéëáìâÜíåé Ýíá
	åîõðçñåôçôÞ FTP, ôï <application>ftpd</application>.  Áõôü êáèéóôÜ ôçí
	åãêáôÜóôáóç êáé ôçí äéá÷åßñéóç ôïõ åîõðçñåôçôÞ <acronym role="File
	Transfer Protocol">FTP</acronym> ðïëý åýêïëç õðüèåóç.</para>
    </sect2>

    <sect2>
      <title>Ñõèìßóåéò</title>

      <para>Ôï ðéï óçìáíôéêü âÞìá óôéò ñõèìßóåéò åßíáé íá áðïöáóßóåôå óå
	ðïéïýò ëïãáñéáóìïýò èá åðéôñáðåß ç ðñüóâáóç óôïí åîõðçñåôçôÞ FTP.  ¸íá
	óõíçèéóìÝíï óýóôçìá &os; äçìéïõñãåß ìåñéêïýò ëïãáñéáóìïýò óõóôÞìáôïò
	ãéá äéÜöïñïõò äáßìïíåò, áëëÜ äåí ðñÝðåé íá åðéôñÝðåôáé ç ðñüóâáóç óôï
	óýóôçìá ìå áõôïýò ôïõò ëïãáñéáóìïýò.  Ôï
	áñ÷åßï <filename>/etc/ftpusers</filename> ðåñéÝ÷åé ìéá ëßóôá áðü
	÷ñÞóôåò ãéá ôïõò ïðïßïõò áðïññßðôåôáé ç ðñüóâáóç ìÝóù FTP.
	ÐñïåðéëåãìÝíá, ðåñéÝ÷ïíôáé ïé ðñïáíáöåñèÝíôåò ëïãáñéáóìïß ôïõ
	óõóôÞìáôïò, áëëÜ ìðïñåßôå åðßóçò íá ðñïóèÝóåôå óõãêåêñéìÝíïõò ÷ñÞóôåò
	ðïõ äå èá ðñÝðåé íá Ý÷ïõí ðñüóâáóç ìÝóù FTP.</para>

      <para>Ìðïñåßôå áí èÝëåôå íá ðåñéïñßóåôå ôçí ðñüóâáóç óå êÜðïéïõò
	÷ñÞóôåò, äß÷ùò üìùò íá ôïõò åìðïäßóåôå ðëÞñùò.  Áõôü ìðïñåß íá óõìâåß
	ìå ôéò ñõèìßóåéò ôïõ áñ÷åßïõ <filename>/etc/ftpchroot</filename>.
	Áõôü ôï áñ÷åßï ðåñéÝ÷åé ëßóôåò ÷ñçóôþí êáé ïìÜäùí ðåñéïñéóìÝíçò
	ðñüóâáóçò FTP.  Ç óåëßäá âïÞèåéáò &man.ftpchroot.5; ðåñéÝ÷åé üëåò ôéò
	áðáñáßôçôåò ëåðôïìÝñåéåò, åðïìÝíùò äå èá ÷ñåéáóôåß íá ìðïýìå óå
	ëåðôïìÝñåéåò åäþ.</para>

      <indexterm>
	<primary>FTP</primary>
	<secondary>anonymous</secondary>
      </indexterm>

      <para>Áí åðéèõìåßôå íá åíåñãïðïéÞóåôå áíþíõìç ðñüóâáóç FTP óôïí
	åîõðçñåôçôÞ óáò, èá ðñÝðåé íá äçìéïõñãÞóåôå, óôï &os; óýóôçìá óáò, Ýíá
	÷ñÞóôç ìå üíïìá <username>ftp</username> . Ïé áíþíõìïé ÷ñÞóôåò èá
	ìðïñïýí íá åéóÝñ÷ïíôáé óôïí åîõðçñåôçôÞ FTP ìå ôï ãåíéêü üíïìá
	÷ñÞóôç <username>ftp</username> Þ ìå <username>anonymous</username>
	êáé ìå ïðïéáäÞðïôå êùäéêü ðñüóâáóçò (óõíçèßæåôáé íá æçôåßôáé ç
	äéåýèõíóç email ôïõ ÷ñÞóôç ùò êùäéêüò ðñüóâáóçò).  Ï åîõðçñåôçôÞò FTP
	èá êáëÝóåé ôï &man.chroot.2; ìüëéò åéóÝëèç ï áíþíõìïò ÷ñÞóôçò, ãéá íá
	ôïõ ðåñéïñßóåé ôçí ðñüóâáóç, åðéôñÝðïíôáò ôïõ ìüíï ôïí áñ÷éêü êáôÜëïãï
	(home directory) ôïõ ÷ñÞóôç <username>ftp</username>.</para>

      <para>ÕðÜñ÷ïõí äýï áñ÷åßá êåéìÝíïõ ãéá ôïí ïñéóìü ìçíõìÜôùí
	êáëùóïñßóìáôïò ðïõ èá åìöáíßæïíôáé óôïõò ðåëÜôåò FTP.  Ôï ðåñéå÷üìåíï
	ôïõ áñ÷åßïõ <filename>/etc/ftpwelcome</filename> åìöáíßæåôáé óôïõò
	÷ñÞóôåò ðñéí öôÜóïõí óôçí ðñïôñïðÞ åéóüäïõ.  ÌåôÜ áðü ìéá ðåôõ÷çìÝíç
	åßóïäï óôï óýóôçìá, åìöáíßæåôáé ôï ðåñéå÷üìåíï ôïõ
	áñ÷åßïõ <filename>/etc/ftpmotd</filename>.  ÐáñáôçñÞóôå ðùò ç äéáäñïìÞ
	óå áõôü ôï áñ÷åßï åßíáé ó÷åôéêÞ ìå ôï ðåñéâÜëëïí ðñüóâáóçò, åðïìÝíùò
	ãéá ôïõò áíþíõìïõò ÷ñÞóôåò èá åìöáíßæåôáé ôï ðåñéå÷üìåíï ôïõ
	áñ÷åßïõ <filename>~ftp/etc/ftpmotd</filename>.</para>

      <para>Áöïý ñõèìßóåôå êáôÜëëçëá ôïí åîõðçñåôçôÞ FTP, èá ðñÝðåé íá ôïí
	åíåñãïðïéÞóåôå óôï áñ÷åßï <filename>/etc/inetd.conf</filename>.  Ôï
	ìüíï ðïõ ÷ñåéÜæåôáé íá êÜíåôå åßíáé íá áöáéñÝóåôå ôï óýìâïëï
	ó÷ïëéáóìïý <quote>#</quote> ìðñïóôÜ áðü ôçí õðÜñ÷ïõóá
	ãñáììÞ <application>ftpd</application> :</para>

      <programlisting>ftp	stream	tcp	nowait	root	/usr/libexec/ftpd	ftpd -l</programlisting>

      <para>¼ðùò åîçãÞóáìå óôï <xref linkend="network-inetd-reread"/>, ç
	äéåñãáóßá <application>inetd</application> èá ðñÝðåé íá îáíáöïñôþíåôáé
	áí Ý÷ïõí ãßíåé áëëáãÝò óôï áñ÷åßï ñõèìßóåùí ôçò.</para>

      <para>Ôþñá ìðïñåßôå íá äþóåôå ôá óôïé÷åßá ôïõ ëïãáñéáóìïý óáò ãéá íá
	åéóÝëèåôå óôïí åîõðçñåôçôÞ FTP.</para>

      <screen>&prompt.user; <userinput>ftp localhost</userinput></screen>
    </sect2>

    <sect2>
      <title>ÓõíôÞñçóç</title>

      <indexterm><primary>syslog</primary></indexterm>
      <indexterm>
	<primary>log files</primary>
	<secondary>FTP</secondary>
      </indexterm>

      <para>Ï äáßìïíáò <application>ftpd</application> ÷ñçóéìïðïéåß ôï
	&man.syslog.3; ãéá ôçí äçìéïõñãßá ìçíõìÜôùí áíáöïñÜò.  ÐñïåðéëåãìÝíá,
	ï äáßìïíáò ôùí log ôïõ óõóôÞìáôïò èá åíáðïèÝôåé ôéò ó÷åôéêÝò ìå ôï FTP
	áíáöïñÝò óôï áñ÷åßï <filename>/var/log/xferlog</filename>.  Ç
	ôïðïèåóßá ôïõ áñ÷åßïõ áíáöïñÜò ìðïñåß íá ôñïðïðïéçèåß áëëÜæïíôáò ôçí
	áêüëïõèç ãñáììÞ óôï <filename>/etc/syslog.conf</filename>:</para>

      <programlisting>ftp.info      /var/log/xferlog</programlisting>

      <indexterm>
	<primary>FTP</primary>
	<secondary>anonymous</secondary>
      </indexterm>

      <para>ÐñÝðåé íá åßóôå åíÞìåñïé ãéá ôá ðñïâëÞìáôá ðïõ ìðïñïýí íá
	ðáñïõóéáóôïýí ó÷åôéêÜ ìå ôç ëåéôïõñãßá åíüò áíþíõìïõ åîõðçñåôçôÞ FTP.
	Åéäéêüôåñá, èá ðñÝðåé íá óêåöôåßôå óïâáñÜ áí üíôùò åðéèõìåßôå íá Ý÷ïõí
	äõíáôüôçôá íá áíåâÜæïõí áñ÷åßá ïé áíþíõìïé ÷ñÞóôåò óáò.  Áí áöÞóåôå
	ïðïéïíäÞðïôå áíþíõìï ÷ñÞóôç íá áíåâÜæåé áñ÷åßá, ìðïñåß îáöíéêÜ íá
	áíáêáëýøåôå ðùò ï åîõðçñåôçôÞò óáò FTP ÷ñçóéìïðïéåßôáé ãéá äéáêßíçóç
	ðåéñáôéêïý åìðïñéêïý ëïãéóìéêïý Þ ãéá Üëëï, áêüìá ÷åéñüôåñï, ðáñÜíïìï
	õëéêü.  ÅÜí üíôùò ÷ñåéÜæåôáé ïé ÷ñÞóôåò íá Ý÷ïõí Üäåéá ðñïóèÞêçò
	áñ÷åßùí, ôüôå èá ðñÝðåé íá ñõèìßóåôå ôéò Üäåéåò Ýôóé þóôå ôá áñ÷åßá
	áõôÜ íá ìçí åßíáé ïñáôÜ áðü Üëëïõò áíþíõìïõò ÷ñÞóôåò, Ýùò üôïõ íá
	ðÜñïõí ôçí áóöáëÞ Ýãêñéóç óáò.</para>
    </sect2>
  </sect1>

  <sect1 id="network-samba">
    <sect1info>
      <authorgroup>
	<author>
	  <firstname>Murray</firstname>
	  <surname>Stokely</surname>
	  <contrib>Contributed by </contrib>
	</author>
      </authorgroup>
    </sect1info>
    <title>File and Print Services for &microsoft.windows; clients (Samba)</title>

    <indexterm><primary>Samba server</primary></indexterm>
    <indexterm><primary>Microsoft Windows</primary></indexterm>
    <indexterm>
      <primary>file server</primary>
      <secondary>Windows clients</secondary>
    </indexterm>
    <indexterm>
      <primary>print server</primary>
      <secondary>Windows clients</secondary>
    </indexterm>

    <sect2>
      <title>Overview</title>

      <para><application>Samba</application> is a popular open source
        software package that provides file and print services for
        &microsoft.windows; clients.  Such clients can connect to and
        use FreeBSD filespace as if it was a local disk drive, or
        FreeBSD printers as if they were local printers.</para>

      <para><application>Samba</application> software packages should
        be included on your FreeBSD installation media.  If you did
        not install <application>Samba</application> when you first
        installed FreeBSD, then you can install it from the <filename
        role="package">net/samba3</filename> port or package.</para>

<!-- mention LDAP, Active Directory, WinBIND, ACL, Quotas, PAM, .. -->

    </sect2>

    <sect2>
      <title>Configuration</title>

      <para>A default <application>Samba</application> configuration
        file is installed as
        <filename>/usr/local/etc/smb.conf.default</filename>.  This
        file must be copied to
        <filename>/usr/local/etc/smb.conf</filename> and customized
        before <application>Samba</application> can be used.</para>

      <para>The <filename>smb.conf</filename> file contains runtime
        configuration information for
        <application>Samba</application>, such as definitions of the
        printers and <quote>file system shares</quote> that you would
        like to share with &windows; clients.  The
        <application>Samba</application> package includes a web based
        tool called <application>swat</application> which provides a
        simple way of configuring the <filename>smb.conf</filename>
        file.</para>

      <sect3>
	<title>Using the Samba Web Administration Tool (SWAT)</title>

	<para>The Samba Web Administration Tool (SWAT) runs as a
	  daemon from <application>inetd</application>.  Therefore, the
	  following line in <filename>/etc/inetd.conf</filename>
	  should be uncommented before <application>swat</application> can be
	  used to configure <application>Samba</application>:</para>

	<programlisting>swat   stream  tcp     nowait/400      root    /usr/local/sbin/swat</programlisting>
        <para>As explained in <xref linkend="network-inetd-reread"/>,
          the <application>inetd</application> must be reloaded after this configuration
          file is changed.</para>

	<para>Once <application>swat</application> has been enabled in
	  <filename>inetd.conf</filename>, you can use a browser to
	  connect to <ulink url="http://localhost:901"></ulink>.  You will
	  first have to log on with the system <username>root</username> account.</para>

<!-- XXX screenshots go here, loader is creating them -->

	<para>Once you have successfully logged on to the main
	  <application>Samba</application> configuration page, you can
	  browse the system documentation, or begin by clicking on the
	  <guimenu>Globals</guimenu> tab.  The <guimenu>Globals</guimenu> section corresponds to the
	  variables that are set in the <literal>[global]</literal>
	  section of
	  <filename>/usr/local/etc/smb.conf</filename>.</para>
      </sect3>

      <sect3>
	<title>Global Settings</title>

	<para>Whether you are using <application>swat</application> or
	  editing <filename>/usr/local/etc/smb.conf</filename>
	  directly, the first directives you are likely to encounter
	  when configuring <application>Samba</application>
	  are:</para>

        <variablelist>
	  <varlistentry>
	    <term><literal>workgroup</literal></term>

	    <listitem>
	      <para>NT Domain-Name or Workgroup-Name for the computers
	        that will be accessing this server.</para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term><literal>netbios name</literal></term>

	    <listitem>
	      <indexterm><primary>NetBIOS</primary></indexterm>

	      <para>This sets the NetBIOS name by which a <application>Samba</application> server
		is known. By default it is the same as the first
		component of the host's DNS name.</para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term><literal>server string</literal></term>

	    <listitem>
	      <para>This sets the string that will be displayed with
		the <command>net view</command> command and some other
		networking tools that seek to display descriptive text
		about the server.</para>
	    </listitem>
	  </varlistentry>
        </variablelist>
      </sect3>

      <sect3>
	<title>Security Settings</title>

	<para>Two of the most important settings in
	  <filename>/usr/local/etc/smb.conf</filename> are the
	  security model chosen, and the backend password format for
	  client users.  The following directives control these
	  options:</para>

        <variablelist>
	  <varlistentry>
	    <term><literal>security</literal></term>

	    <listitem>
	      <para>The two most common options here are
	        <literal>security = share</literal> and <literal>security
	        = user</literal>.  If your clients use usernames that
	        are the same as their usernames on your &os; machine
	        then you will want to use user level security.  This
	        is the default security policy and it requires clients
	        to first log on before they can access shared
	        resources.</para>

	      <para>In share level security, client do not need to log
	        onto the server with a valid username and password
	        before attempting to connect to a shared resource.
	        This was the default security model for older versions
	        of <application>Samba</application>.</para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term><literal>passdb backend</literal></term>

	    <listitem>
	      <indexterm><primary>NIS+</primary></indexterm>
	      <indexterm><primary>LDAP</primary></indexterm>
	      <indexterm><primary>SQL database</primary></indexterm>

	      <para><application>Samba</application> has several
	        different backend authentication models.  You can
	        authenticate clients with LDAP, NIS+, a SQL database,
	        or a modified password file.  The default
	        authentication method is <literal>smbpasswd</literal>,
	        and that is all that will be covered here.</para>
	    </listitem>
	  </varlistentry>
	</variablelist>

	<para>Assuming that the default <literal>smbpasswd</literal>
	  backend is used, the
	  <filename>/usr/local/private/smbpasswd</filename> file must
	  be created to allow <application>Samba</application> to
	  authenticate clients.  If you would like to give
	  your &unix; user accounts access from &windows; clients, use the
	  following command:</para>

	<screen>&prompt.root; <userinput>smbpasswd -a username</userinput></screen>

	<para>Please see the
	  <ulink
	  url="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/">Official Samba HOWTO</ulink>
	  for additional information about configuration
	  options.  With the basics outlined here, you should have
	  everything you need to start running
	  <application>Samba</application>.</para>
      </sect3>

    </sect2>
    <sect2>
      <title>Starting <application>Samba</application></title>

      <para>The <filename role="package">net/samba3</filename> port adds
	a new startup script, which can be used to control
	<application>Samba</application>.  To enable this script, so
	that it can be used for example to start, stop or restart
	<application>Samba</application>, add the following line to the
	<filename>/etc/rc.conf</filename> file:</para>

      <programlisting>samba_enable="YES"</programlisting>

      <note>
	<para>This will also configure <application>Samba</application>
	  to automatically start at system boot time.</para>
      </note>

      <para>It is possible then to start
	<application>Samba</application> at any time by typing:</para>

      <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/samba start</userinput>
Starting SAMBA: removing stale tdbs :
Starting nmbd.
Starting smbd.</screen>

      <para>Please refer to <xref linkend="configtuning-rcd"/> for more
	information about using rc scripts.</para>

      <para><application>Samba</application> actually consists of
        three separate daemons.  You should see that both the
        <application>nmbd</application> and <application>smbd</application> daemons
        are started by the <filename>samba.sh</filename> script.  If
        you enabled winbind name resolution services in
        <filename>smb.conf</filename>, then you will also see that
        the <application>winbindd</application> daemon is started.</para>

      <para>You can stop <application>Samba</application> at any time
        by typing :</para>

      <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/samba.sh stop</userinput></screen>

      <para><application>Samba</application> is a complex software
        suite with functionality that allows broad integration with
        &microsoft.windows; networks.  For more information about
        functionality beyond the basic installation described here,
        please see <ulink url="http://www.samba.org"></ulink>.</para>
    </sect2>

  </sect1>

  <sect1 id="network-ntp">
    <sect1info>
      <authorgroup>
	<author>
	  <firstname>Tom</firstname>
	  <surname>Hukins</surname>
	  <contrib>ÓõíåéóöïñÜ ôïõ </contrib>
	</author>
      </authorgroup>
    </sect1info>
    <title>Óõã÷ñïíéóìüò Ñïëïãéïý ÓõóôÞìáôïò ìå NTP</title>

    <indexterm><primary>NTP</primary></indexterm>

    <sect2>
      <title>Óýíïøç</title>

      <para>Ìå ôï ðÝñáóìá ôïõ ÷ñüíïõ, ôï ñïëüé óõóôÞìáôïò åíüò õðïëïãéóôÞ Ý÷åé
	ôçí ôÜóç íá áðïóõã÷ñïíßæåôáé. Ôï Ðñùôüêïëï ×ñïíéóìïý Äéêôýùí (Network
	Time Protocol Þ NTP) ðáñÝ÷åé Ýíá ôñüðï ãéá íá åîáóöáëßóåôå ôçí
	áêñßâåéá ôïõ clock óáò. </para>

      <para>ÐïëëÝò äéáäéêôõáêÝò õðçñåóßåò âáóßæïíôáé Þ ùöåëïýíôáé óå ìåãÜëï
	âáèìü áðü ôçí áêñßâåéá ôïõ ñïëïãéïý óõóôÞìáôïò åíüò õðïëïãéóôÞ.  Ãéá
	ðáñÜäåéãìá, Ýíáò åîõðçñåôçôÞò web ìðïñåß íá äå÷èåß áéôÞóåéò ãéá
	áðïóôïëÞ åíüò áñ÷åßïõ üôáí ôï áñ÷åßï áõôü Ý÷åé ôñïðïðïéçèåß ìÝ÷ñé
	êÜðïéá óõãêåêñéìÝíç þñá. Óå Ýíá ðåñéâÜëëïí ôïðéêïý äéêôýïõ, åßíáé
	èåìåëéþäçò áñ÷Þ ïé õðïëïãéóôÝò ðïõ èá äéáìïéñáóôïýí áñ÷åßá áðü ôïí
	ßäéï äéáêïìéóôÞ áñ÷åßùí íá Ý÷ïõí óõã÷ñïíéóìÝíá ñïëüãéá, Ýôóé þóôå ôá
	÷ñïíéêÜ ÷áñáêôçñéóôéêÜ ôïõ áñ÷åßïõ íá óõìöùíïýí.  Åðßóçò äéåñãáóßåò
	üðùò ç &man.cron.8; âáóßæïíôáé óå Ýíá áêñéâÝò ñïëüé þóôå íá ìðïñïýí íá
	ôñÝ÷ïõí åíôïëÝò óôïõò ðñïêáèïñéóìÝíïõò ÷ñüíïõò.</para>

      <indexterm>
	<primary>NTP</primary>
	<secondary>ntpd</secondary>
      </indexterm>
      <para>Ôï &os; äéáôßèåôáé ìå ôïí åîõðçñåôçôÞ <acronym role="Network Time
	Protocol">NTP</acronym> &man.ntpd.8;, ï ïðïßïò ìðïñåß íá
	÷ñçóéìïðïéçèåß ãéá íá óõã÷ñïíßæåé ôï ñïëüé óõóôÞìáôïò ôïõ õðïëïãéóôÞ
	óáò, åîåôÜæïíôáò Üëëïõò åîõðçñåôçôÝò <acronym role="Network Time
	Protocol">NTP</acronym> Þ íá ðáñÝ÷åé ï ßäéïò õðçñåóßåò óõã÷ñïíéóìïý óå
	Üëëá ìç÷áíÞìáôá.</para>
    </sect2>

    <sect2>
      <title>ÅðéëïãÞ ôùí ÊáôÜëëçëùí Åîõðçñåôçôþí NTP</title>

      <indexterm>
	<primary>NTP</primary>
	<secondary>åðéëïãÞ åîõðçñåôçôþí</secondary>
      </indexterm>

      <para>Ãéá íá óõã÷ñïíßóåôå ôï ñïëüé óõóôÞìáôïò ôïõ õðïëïãéóôÞ óáò èá
	ðñÝðåé íá âñåßôå Ýíáí Þ ðåñéóóüôåñïõò
	äéáèÝóéìïõò <acronym role="Network Time Protocol">NTP</acronym>
	åîõðçñåôçôÝò ãéá íá ÷ñçóéìïðïéÞóåôå. Ï äéá÷åéñéóôÞò äéêôýïõ Þ ï ISP
	óáò ìðïñåß íá Ý÷ïõí åãêáôáóôÞóåé êÜðïéïí åîõðçñåôçôÞ NTP ãéá áõôü ôï
	óêïðü&nbsp;&mdash; åëÝãîôå ôçí ôåêìçñßùóç ôïõò íá äåßôå áí õðÜñ÷åé
	ôÝôïéá ðåñßðôùóç. ÅðéðëÝïí, õðÜñ÷åé
	ìßá <ulink url="http://ntp.isc.org/bin/view/Servers/WebHome">online
	ëßóôá åîõðçñåôçôþí äçìüóéáò ðñüóâáóçò</ulink>, ðïõ ìðïñåßôå íá
	÷ñçóéìïðïéÞóåôå ãéá íá âñåßôå Ýíáí êïíôéíü åîõðçñåôçôÞ NTP.  ¼ðïéïí
	åîõðçñåôçôÞ êé áí åðéëÝîåôå, åíçìåñùèåßôå ãéá ôçí ðïëéôéêÞ ÷ñÞóçò ôïõ
	êáé æçôÞóôå Üäåéá íá ôïí ÷ñçóéìïðïéÞóåôå áí ÷ñåéÜæåôáé ôÝôïéá
	Üäåéá.</para>

      <para> Åßíáé êáëÞ éäÝá íá åðéëÝîåôå ðïëëïýò åîõðçñåôçôÝò NTP, ïé ïðïßïé
	íá ìçí óõíäÝïíôáé ìåôáîý ôïõò, óôçí ðåñßðôùóç ðïõ êÜðïéïò áðü ôïõò
	åîõðçñåôçôÝò ðïõ ÷ñçóéìïðïéåßôå ãßíåé áðñüóéôïò Þ ôï ñïëüé ôïõ åßíáé
	áíáêñéâÝò.  Ï åîõðçñåôçôÞò &man.ntpd.8; ôïõ &os; ÷åéñßæåôáé Ýîõðíá ôéò
	áðáíôÞóåéò ðïõ ëáìâÜíåé áðü ôïõò õðüëïéðïõò åîõðçñåôçôÝò&nbsp;&mdash;
	åõíïåß ôïõò ðéï áîéüðéóôïõò êáé äåß÷íåé ìéêñüôåñç ðñïôßìçóç óôïõò
	ëéãüôåñï áîéüðéóôïõò åîõðçñåôçôÝò.</para>
    </sect2>

    <sect2>
      <title>Ñõèìßóôå Ôï Ìç÷Üíçìá Óáò</title>

      <indexterm>
	<primary>NTP</primary>
	<secondary>ñõèìßóåéò</secondary>
      </indexterm>

      <sect3>
	<title>ÂáóéêÝò Ñõèìßóåéò</title>
	<indexterm><primary>ntpdate</primary></indexterm>

	<para>Áí åðéèõìåßôå íá óõã÷ñïíßæåôáé ôï clock óáò ìüíï êáôÜ ôçí
	  åêêßíçóç ëåéôïõñãßáò ôïõ ìç÷áíÞìáôïò, ôüôå ìðïñåßôå íá
	  ÷ñçóéìïðïéÞóåôå ôï &man.ntpdate.8;. Áõôüò ï ôñüðïò óõã÷ñïíéóìïý
	  åßíáé êáôÜëëçëïò ãéá ìç÷áíÞìáôá desktop ôá ïðïßá êÜíïõí åðáíáêêßíçóç
	  áíÜ ôáêôÜ ÷ñïíéêÜ äéáóôÞìáôá êáé ìüíï óå åéäéêÝò ðåñéðôþóåéò Ý÷ïõí
	  áíÜãêç óõã÷ñïíéóìïý.  ÁíôéèÝôùò, ôá õðüëïéðá ìç÷áíÞìáôá èá ðñÝðåé íá
	  ôñÝ÷ïõí ôçí äéåñãáóßá &man.ntpd.8;.</para>

	<para>Åßíáé êáëÞ ðñáêôéêÞ ôá ìç÷áíÞìáôá ðïõ ôñÝ÷ïõí &man.ntpd.8; íá
	  ÷ñçóéìïðïéïýí êáé ôï &man.ntpdate.8; êáôÜ ôç äéÜñêåéá åêêßíçóçò
	  ôïõò.  Ôï &man.ntpd.8; ìåôáâÜëëåé ôï clock âáèìéáßá, åíþ ôï
	  &man.ntpdate.8; ñõèìßæåé Üìåóá ôï clock áíåîÜñôçôá áðü ôï ðüóï
	  ìåãÜëç åßíáé ç ÷ñïíéêÞ äéáöïñÜ ìåôáîý ðñáãìáôéêÞò êáé ôñÝ÷ïõóáò þñáò
	  ôïõ clock ôïõ ìç÷áíÞìáôïò.</para>

	<para>Ãéá íá åíåñãïðïéÞóåôå ôï &man.ntpdate.8; êáôÜ ôçí åêêßíçóç,
	  ðñïóèÝóôå <literal>ntpdate_enable="YES"</literal>
	  óôï <filename>/etc/rc.conf</filename>.  Èá ðñÝðåé íá ðñïóäéïñßóåôå
	  óôï <varname>ntpdate_flags</varname> üëïõò ôïõò äéáêïìéóôÝò ìå ôïõò
	  ïðïßïõò åðéèõìåßôå íá óõã÷ñïíßæåóôå êáé üëá ôá flag ðïõ èÝëåôå íá
	  óõíïäåýïõí ôï&man.ntpdate.8;.</para>
      </sect3>

      <sect3>
	<title>ÃåíéêÝò Ñõèìßóåéò</title>

	<indexterm>
	  <primary>NTP</primary>
	  <secondary>ntp.conf</secondary>
	</indexterm>

	<para>Ïé ñõèìßóåéò ôïõ NTP âñßóêïíôáé óôï
	  áñ÷åßï <filename>/etc/ntp.conf</filename> êáé åßíáé óôç ìïñöÞ ðïõ
	  ðåñéãñÜöåôáé óôï &man.ntp.conf.5;. Áêïëïõèåß Ýíá áðëü
	  ðáñÜäåéãìá:</para>

	<programlisting>server ntplocal.example.com prefer
server timeserver.example.org
server ntp2a.example.net

driftfile /var/db/ntp.drift</programlisting>

	<para>Ç åðéëïãÞ <literal>server</literal> ðñïóäéïñßæåé ðïéïé
	  åîõðçñåôçôÝò èá ÷ñçóéìïðïéçèïýí, ðáñáèÝôïíôáò Ýíáí óå êÜèå
	  ãñáììÞ. Áí Ýíáò åîõðçñåôçôÞò öÝñåé ôï
	  ðñüèåìá <literal>prefer</literal>, üðùò óõìâáßíåé ìå
	  ôïí <hostid role="fqdn">ntplocal.example.com</hostid>, ôüôå áõôüò ï
	  åîõðçñåôçôÞò åßíáé ï ðñïôéìþìåíïò. Èá áðïññéöèåß ç áðÜíôçóç áðü ôïí
	  ðñïôéìþìåíï åîõðçñåôçôÞ óå ðåñßðôùóç ðïõ äéáöÝñåé óçìáíôéêÜ áðü
	  üëïõò ôïõò Üëëïõò åîõðçñåôçôÝò, Óå ðåñßðôùóç ðïõ äåí õðÜñ÷åé ìåãÜëç
	  áðüêëéóç èá ÷ñçóéìïðïéçèåß äß÷ùò íá ëçöèïýí õðüøéí ïé Üëëåò
	  áðáíôÞóåéò. Ôï ðñüèåìá <literal>prefer</literal> óõíÞèùò
	  ÷ñçóéìïðïéåßôáé ìå åîõðçñåôçôÝò NTP áêñéâåßáò, üðùò áõôïß ðïõ öÝñïõí
	  åéäéêïýò ìç÷áíéóìïýò ðáñáêïëïýèçóçò ÷ñïíéóìïý.</para>

	<para>Ç åðéëïãÞ <literal>driftfile</literal> ðñïóäéïñßæåé ðïéü áñ÷åßï
	  ÷ñçóéìïðïéåßôáé ãéá íá äéáôçñåß ôç óõ÷íüôçôá äéüñèùóçò ôïõ clock ôïõ
	  óõóôÞìáôïò. Ôï ðñüãñáììá &man.ntpd.8; ÷ñçóéìïðïéåß áõôüìáôá áõôÞ ôç
	  ôéìÞ ãéá íá áíôéóôáèìßæåé ôéò öõóéêÝò áðïêëßóåéò ôïõ clock,
	  åðéôñÝðïíôáò ôïõ íá äéáôçñåß ìéá ëïãéêÞ ñýèìéóç, áêüìç êé áí ôïõ
	  áðáãïñåõôåß ãéá êÜðïéï ÷ñïíéêü äéÜóôçìá ç ðñüóâáóç ðñïò üëåò ôéò
	  åîùôåñéêÝò ðçãÝò óõã÷ñïíéóìïý.</para>

	<para>Ç åðéëïãÞ <literal>driftfile</literal> ðñïóäéïñßæåé ðïéü áñ÷åßï
	  ÷ñçóéìïðïéåßôáé ãéá íá áðïèçêåýåé ðëçñïöïñßåò ó÷åôéêÜ ìå ôéò
	  ðñïçãïýìåíåò áðáíôÞóåéò áðü ôïõò åîõðçñåôçôÝò NTP. Áõôü ôï áñ÷åßï
	  ðåñéÝ÷åé åóùôåñéêÝò ðëçñïöïñßåò ôïõ NTP. Äåí èá Ýðñåðå íá
	  ôñïðïðïéåßôå áðü êáììßá Üëëç äéåñãáóßá.</para>
      </sect3>

      <sect3>
	<title>¸ëåã÷ïò Ðñüóâáóçò óôïí ÅîõðçñåôçôÞ Óáò</title>

	<para>ÐñïåðéëåãìÝíá, ï åîõðçñåôçôÞò óáò NTP èá åßíáé ðñïóâÜóéìïò áðü
	  üëïõò ôïõò êüìâïõò óôï äéáäßêôõï. Ç
	  åðéëïãÞ <literal>restrict</literal>
	  óôï <filename>/etc/ntp.conf</filename> óáò åðéôñÝðåé íá åëÝã÷åôå
	  ðïéá ìç÷áíÞìáôá èá ìðïñïýí íá Ý÷ïõí ðñüóâáóç óôïí åîõðçñåôÞ
	  óáò. </para>

	<para>Áí åðéèõìåßôå íá áðïññßøåôå ôçí ðñüóâáóç ðñïò ôïí åîõðçñåôçôÞ
	  óáò NTP ãéá üëá ôá ìç÷áíÞìáôá, ðñïóèÝóôå ôçí áêüëïõèç ãñáììÞ
	  óôï <filename>/etc/ntp.conf</filename>:</para>

        <programlisting>restrict default ignore</programlisting>

        <para>Áí èÝëåôå ìüíï íá åðéôñÝøåôå ôïí óõã÷ñïíéóìü ôïõ åîõðçñåôçôÞ óáò
	  ìå ìç÷áíÞìáôá åíôüò ôïõ äéêôýïõ óáò, áëëÜ äß÷ùò äõíáôüôçôá ñýèìéóçò
	  ôïõ åîõðçñåôçôÞ Þ íá ãßíïõí ïìïéüâáèìá ìå Üäåéá óõã÷ñïíéóìïý, ôüôå
	  áíôéèÝôùò ðñïóèÝóôå:</para>

        <programlisting>restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap</programlisting>

	<para>üðïõ <hostid role="ipaddr">192.168.1.0</hostid> åßíáé ç
	  äéåýèõíóç IP ôïõ äéêôýïõ
	  êáé <hostid role="netmask">255.255.255.0</hostid> åßíáé ç ìÜóêá ôïõ
	  äéêôýïõ óáò.</para>

	<para>Ôï <filename>/etc/ntp.conf</filename> ìðïñåß íá ðåñéÝ÷åé
	  ðïëëáðëÝò åðéëïãÝò <literal>restrict</literal>. Ãéá ðåñéóóüôåñåò
	  ðëçñïöïñßåò, äåßôå ôçí õðïåíüôçôá <literal>ÕðïóôÞñéîç ÅëÝã÷ïõ
	  Ðñüóâáóçò (Access Control Support)</literal>, õðïåíüôçôá ôïõ
	  &man.ntp.conf.5;.</para>
      </sect3>
    </sect2>

    <sect2>
      <title>ÅêôÝëåóç ôïõ NTP ÅîõðçñåôçôÞ Óáò</title>

      <para>Ãéá íá âåâáéùèåßôå ðùò ï åîõðçñåôçôÞò NTP èá îåêéíÜåé êáôÜ ôçí
	äéÜñêåéá åêêßíçóçò ôïõ óõóôÞìáôïò, ðñïóèÝóôå ôç
	ãñáììÞ <literal>ntpd_enable="YES"</literal>óôï<filename>/etc/rc.conf</filename>.
	Ãéá íá îåêéíÞóåôå ôïí åîõðçñåôçôÞ äß÷ùò íá åðáíåêêéíÞóåôå ôï ìç÷Üíçìá
	óáò, ôñÝîôå &man.ntpd.8; ðñïóäéïñßæïíôáò êÜèå åðéðñüóèåôç ðáñÜìåôñï
	áðü ôá <varname>ntpd_flags</varname>
	óôï <filename>/etc/rc.conf</filename>. Ãéá ðáñÜäåéãìá:</para>

      <screen>&prompt.root; <userinput>ntpd -p /var/run/ntpd.pid</userinput></screen>
    </sect2>

    <sect2>
      <title>×ñÞóç ôïõ ntpd ìå ÐñïóùñéíÞ Óýíäåóç óôï ºíôåñíåô</title>

      <para>Ôï ðñüãñáììá &man.ntpd.8; äåí ÷ñåéÜæåôáé ìéá ìüíéìç óýíäåóç óôï
	ºíôåñíåô ãéá íá äïõëÝøåé óùóôÜ. Áí Ý÷åôå ìéá ðñïóùñéíÞ óýíäåóç ðïõ
	åßíáé ñõèìéóìÝíç íá êÜíåé êëÞóåéò ìÝóù ôçëåöþíïõ (dial out on demand),
	åßíáé êáëü íá ìçí åßíáé ç êßíçóç äåäïìÝíùí ôïõ NTP ôï áßôéï ôçò êëÞóçò
	Þ áõôÞ ðïõ èá êñáôÜåé åíåñãÞ ôçí óýíäåóç. Áí ÷ñçóéìïðïéåßôå PPP
	÷ñÞóôç, ìðïñåßôå íá ÷ñçóéìïðïéÞóåôå <literal>ößëôñá</literal> óôïõò
	êþäéêåò ðáñáðïìðÞò ôïõ <filename>/etc/ppp/ppp.conf</filename>, üðùò
	ãéá ðáñÜäåéãìá:</para>

      <programlisting> set filter dial 0 deny udp src eq 123
 # Prevent NTP traffic from initiating dial out
 set filter dial 1 permit 0 0
 set filter alive 0 deny udp src eq 123
 # Prevent incoming NTP traffic from keeping the connection open
 set filter alive 1 deny udp dst eq 123
 # Prevent outgoing NTP traffic from keeping the connection open
 set filter alive 2 permit 0/0 0/0</programlisting>

      <para>Ãéá ðåñéóóüôåñåò ëåðôïìÝñåéåò äåßôå ôï <literal>PACKET
	FILTERING</literal> óôçí åíüôçôá &man.ppp.8; êáé ôá ðáñáäåßãìáôá
	óôï <filename>/usr/share/examples/ppp/</filename>.</para>

      <note>
	<para>Óçìåßùóç: Ìåñéêïß ISP ìðëïêÜñïõí ôçí ÷ñÞóç èýñáò ìå ÷áìçëü
	  áñéèìü, åìðïäßæïíôáò óôï NTP íá äïõëåýåé áöïý ïé áðáíôÞóåéò äåí
	  öôÜíïõí ðïôÝ óôï ìç÷Üíçìá óáò.</para>
      </note>
    </sect2>

    <sect2>
      <title>ÐåñáéôÝñù Ðëçñïöïñßåò</title>

      <para>Ç ôåêìçñßùóç ãéá ôïõò åîõðçñåôçôÝò NTP äéáôßèåôáé êáé óå öüñìá
	HTML óôï <filename>/usr/share/doc/ntp/</filename>.</para>
    </sect2>
  </sect1>

</chapter>