aboutsummaryrefslogtreecommitdiff
path: root/zh_CN.GB2312/books/handbook/ppp-and-slip/chapter.sgml
blob: 79a0d33a263c73a04cd867f03f47fc001d873e81 (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
<?xml version="1.0" encoding="GB2312" standalone="no"?>
<!--
     The FreeBSD Documentation Project
     The FreeBSD Simplified Chinese Project

     Original Revision: 1.196
     $FreeBSD$
-->

<chapter id="ppp-and-slip">
  <chapterinfo>
    <authorgroup>
      <author>
	<firstname>Jim</firstname>
	<surname>Mock</surname>
	<contrib>Restructured, reorganized, and updated by </contrib>
	<!-- 1 Mar 2000 -->
      </author>
    </authorgroup>
  </chapterinfo>

  <title>PPP 和 SLIP</title>

  <sect1 id="ppp-and-slip-synopsis">
    <title>概述</title>
    <indexterm id="ppp-ppp">
      <primary>PPP</primary>
    </indexterm>
    <indexterm id="ppp-slip">
      <primary>SLIP</primary>
    </indexterm>

    <para>FreeBSD 有很多方法可以将计算机与计算机连接起来。
      通过使用拨号 modem 来建立网络或 Internet 连接,
      或允许其他人通过您的机器来连上网络,
      这些都要求使用 PPP 或 SLIP。
      这章将详细介绍设置这些基于 modem 的通信服务的方法。</para>

    <para>读完这一章, 您将了解:</para>

    <itemizedlist>
      <listitem>
	<para>如何设置用户级 PPP。</para>
      </listitem>
      <listitem>
	<para>如何设置内核级 PPP。 (仅限 &os; 7.X)。</para>
      </listitem>
      <listitem>
	<para>如何设置 <acronym>PPPoE</acronym> (PPP over
	  Ethernet)。</para>
      </listitem>
      <listitem>
	<para>如何设置 <acronym>PPPoA</acronym> (PPP over
	  ATM)。</para>
	</listitem>
      <listitem>
	<para>如何配置和安装 SLIP 客户端和服务器。 (仅限 &os; 7.X)。</para>
      </listitem>
    </itemizedlist>

    <indexterm id="ppp-ppp-user">
      <primary>PPP</primary>
      <secondary>用户级 PPP</secondary>
    </indexterm>
    <indexterm id="ppp-ppp-kernel">
      <primary>PPP</primary>
      <secondary>内核级 PPP</secondary>
    </indexterm>
    <indexterm id="ppp-ppp-ethernet">
      <primary>PPP</primary>
      <secondary>PPPoE</secondary>
    </indexterm>

    <para>在阅读这章之前, 您应:</para>

    <itemizedlist>
      <listitem>
	<para>熟悉基本的网络术语。</para>
      </listitem>
      <listitem>
	<para>理解拨号连接和 PPP、 SLIP 的基础知识。</para>
      </listitem>
    </itemizedlist>

    <para>您可能想知道用户级 PPP 与内核级 PPP 之间的不同之处。 回答很简单:
      用户级 PPP 处理用户级的输入和输出数据, 而不是内核级。
      在内核与用户区之间复制数据的花费要大一些,
      但它能提供具有更多特性的PPP实现。
      用户级PPP使用 <devicename>tun</devicename>
      设备与外界通信而内核级 PPP 使用
      <devicename>ppp</devicename> 设备。</para>

    <note>
      <para>在这章中, 如果没有特殊说明,
	则 <application>ppp</application> 指的是用户态 PPP,
	除非需要和其它 PPP 软件, 例如
	<application>pppd</application> (仅限 &os;&nbsp;7.X) 加以区分。
	另外, 若没有额外的注明, 本章所介绍的所有命令都需要以
	<username>root</username> 身份来运行权限。</para>
    </note>
  </sect1>

  <sect1 id="userppp">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Tom</firstname>
          <surname>Rhodes</surname>
          <contrib>Updated and enhanced by </contrib>
        </author>
      </authorgroup>
      <authorgroup>
        <author>
          <firstname>Brian</firstname>
          <surname>Somers</surname>
	  <contrib>Originally contributed by </contrib>
        </author>
      </authorgroup>
      <authorgroup>
	<author>
	  <firstname>Nik</firstname>
	  <surname>Clayton</surname>
	  <contrib>With input from </contrib>
        </author>
        <author>
	  <firstname>Dirk</firstname>
          <surname>Fr&ouml;mberg</surname>
        </author>
        <author>
          <firstname>Peter</firstname>
          <surname>Childs</surname>
        </author>
      </authorgroup>
    </sect1info>

    <title>使用用户级 PPP</title>

    <warning>
      <para>&os; 8.0 开始, &man.uart.4; 驱动取代了
	&man.sio.4; 驱动。 用以表示串口的设备节点由分别
	<filename>/dev/cuad<replaceable>N</replaceable></filename> 改为了
	<filename>/dev/cuau<replaceable>N</replaceable></filename>,
	并从
	<filename>/dev/ttyd<replaceable>N</replaceable></filename> 改为了
	<filename>/dev/ttyu<replaceable>N</replaceable></filename>&os;&nbsp;7.X 用户在升级时需要因应之对配置文件进行必要的更改。</para>
    </warning>

    <sect2>
      <title>用户级 PPP</title>

      <sect3>
	<title>前提条件</title>

	<para>本章假定您具备如下条件:</para>

	<itemizedlist>
	  <indexterm id="ppp-isp">
	    <primary>ISP</primary>
	  </indexterm>
	  <indexterm id="ppp-ppp2">
	    <primary>PPP</primary>
	  </indexterm>
	  <listitem>
	    <para>您有一个 ISP 提供的用于连接使用 PPP 的帐号。</para>
	  </listitem>

	  <listitem>
	    <para>您需要有连接在系统上, 并做了正确配置的 modem,
	      或其他能够连接您 ISP 的设备。</para>
	  </listitem>

	  <listitem>
	    <para>ISP 的拨号号码。</para>
	  </listitem>

	  <listitem>
	  <indexterm id="ppp-pap">
	    <primary>PAP</primary>
	  </indexterm>
	  <indexterm id="ppp-chap">
	    <primary>CHAP</primary>
	  </indexterm>
	  <indexterm id="ppp-unix">
	    <primary>UNIX</primary>
	  </indexterm>
	  <indexterm id="ppp-login">
	    <primary>login name</primary>
	  </indexterm>
	  <indexterm id="ppp-password">
	    <primary>password</primary>
	  </indexterm>
	    <para>您的登录名称和密码 (可能是一般的 UNIX 风格的登录名和密码对,
	    也可能是 PAP 或 CHAP 登录名和密码对)。</para>
	  </listitem>

	  <listitem>
	    <indexterm id="ppp-nameserver">
	      <primary>nameserver</primary>
	    </indexterm>

	    <para>一个或多个域名服务器 IP 地址。
	     通常, 您会从ISP处得到两个这样的IP地址。
	     如果您至少得到了一个, 就可以在文件
	     <filename>ppp.conf</filename> 中加入 <command>enable dns</command>
	     命令使 <application>ppp</application> 设置域名服务。
	     这个功能取决于 ISP 对支持 DNS 协商的具体实现。</para>
	  </listitem>
	</itemizedlist>

	<para>下面的信息由您的 ISP 提供, 但不是必需的:</para>

	<itemizedlist>
	  <listitem>
	    <para>ISP的网关IP地址。 网关是您准备连接, 并设为
	     <emphasis>默认路由</emphasis> 的主机。
	     如果您没有这个信息, 您可以虚构一个,
	     在连接时 ISP 的 PPP 服务器会自动告诉您正确的值。</para>

	    <para>这个虚构的 IP 地址在 <application>ppp</application> 中记做
	      <literal>HISADDR</literal></para>
	  </listitem>

	  <listitem>
	    <para>准备使用的子网掩码。 如果ISP没有提供, 一般使用
	    <hostid role="netmask">255.255.255.255</hostid> 是没有问题的。</para>
	  </listitem>

	  <listitem>
	    <indexterm id="ppp-static-ip">
	      <primary>static IP address (静态 IP 地址)</primary>
	    </indexterm>

	    <para>如果 ISP 提供了静态的IP地址和主机名, 可以输入它们。
	    反之, 则应让对方主机指定它认为合适的 IP 地址。</para>
	  </listitem>
	</itemizedlist>

	<para>如果您不知道这些信息, 请与您的 ISP 联系。</para>

	<note><para>在这节中, 所有作为例子展示的配置文件中都有行号。
	    这些行号只是为了使解释和讨论变得方便, 在真实的文件中并不存在。
	    此外, 在必要时应使用 Tab 和空格来进行缩进。</para>
	</note>

      </sect3>

      <sect3>
        <title><application>PPP</application>自动化配置</title>

	<indexterm>
	  <primary>PPP</primary>
	  <secondary>configuration (配置)</secondary>
	</indexterm>

	<para> <command>ppp</command><command>pppd</command>(PPP的内核级实现, 仅限 &os;&nbsp;7.X)
	  都使用 <filename class="directory">/etc/ppp</filename> 目录中的配置文件。 用户级 PPP
	  的例子可以在
	  <filename class="directory">/usr/share/examples/ppp/</filename> 中找到。</para>

	<para>配置<command>ppp</command>要求根据您的需要编辑几个文件。
	  编辑哪几个文件取决于您的
	  IP 是静态分配 (每次都使用同一个地址)
	  还是动态分配的 (每次连接到 ISP 都会获得不同的 IP 地址)。</para>

	<sect4 id="userppp-staticIP">
	  <title>PPP和静态IP地址</title>

	  <indexterm>
            <primary>PPP</primary>
            <secondary>with static IP addresses</secondary>
          </indexterm>

	  <para>您需要编辑配置文件<filename>/etc/ppp/ppp.conf</filename>, 如下所示。</para>

	  <note>
	    <para>以冒号<literal>:</literal>结尾的行从第一列 (行首)开始,
	      其它所有的行都要使用空格或制表符 (Tab) 来缩进。</para>
	  </note>

	  <programlisting>1     default:
2       set log Phase Chat LCP IPCP CCP tun command
3       ident user-ppp VERSION (built COMPILATIONDATE)
4       set device /dev/cuau0
5       set speed 115200
6       set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
7                 \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
8       set timeout 180
9       enable dns
10
11    provider:
12      set phone "(123) 456 7890"
13      set authname foo
14      set authkey bar
15      set login "TIMEOUT 10 \"\" \"\" gin:--gin: \\U word: \\P col: ppp"
16      set timeout 300
17      set ifaddr <replaceable>x.x.x.x</replaceable> <replaceable>y.y.y.y</replaceable> 255.255.255.255 0.0.0.0
18      add default HISADDR</programlisting>

	  <variablelist>
	    <varlistentry>
	      <term>1</term>

	      <listitem>
		<para>指定默认的项。 当PPP运行时这个项中的命令将自动执行。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>2</term>

	      <listitem>
		<para>启用登录参数。 工作正常后, 为避免产生过多的日志文件, 这行应该简化为:</para>

	        <programlisting>set log phase tun</programlisting>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>3</term>

	      <listitem>
		<para>告诉 PPP 怎样向对方标识自己。
                  如果在建立或使用连接时遇到任何麻烦, PPP就会向对方主机自我标识。
                  对方主机管理员在处理这个问题时, 这些信息会有用。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>4</term>

	      <listitem>
		<para>标明modem要连接的端口号。
                  <devicename>COM1</devicename> 对应的设备是
		  <filename class="devicefile">/dev/cuau0</filename><devicename>COM2</devicename>
		  对应的则是
		  <filename class="devicefile">/dev/cuau1</filename></para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>5</term>

	      <listitem>
		<para>设置连接的速度。 如果 115200
		  有问题, 试试 38400</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>6 &amp; 7</term>

	      <listitem>
		<indexterm>
		  <primary>PPP</primary>
		  <secondary>user PPP</secondary>
		</indexterm>

		<para>拨号字符串。 用户级 PPP 使用一种与 &man.chat.8;程序相似的语法。
		   请参考联机手册了解这种语言的相关信息。</para>

		<para>注意, 为了便于阅读此命令进行了换行。 任何
		  <filename>ppp.conf</filename> 里的命令都可以这样做,
		  前提是行的最后一个字符必须是 <literal>\</literal></para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>8</term>

	      <listitem>
		<para>设置连接的时间间隔。 默认是 180 秒, 所以这一行是多余的。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>9</term>

	      <listitem>
		<para>告诉PPP向对方主机确认本地域名解析设置。
		  如果您运行了本地的域名服务器, 要注释或删除掉这一行。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>10</term>

	      <listitem>
		<para>为了可读性的需要设置一个空行。 空行会被PPP忽略。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>11</term>

	      <listitem>
		<para><quote>provider</quote>指定一个项。 可以改成
		 <acronym>ISP</acronym>的名字, 这样您以后就可以使用
		 <option>load <replaceable>ISP</replaceable></option> 来开启连接。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>12</term>

	      <listitem>
		<para>设置提供商的电话号码。 多个电话号码可以使用冒号 (<literal>:</literal>)
		  或管道符号 (<literal>|</literal>) 隔开。
		  这两个字符的区别在&man.ppp.8;的联机手册中有介绍。
		  总的来讲, 如果您要循环使用这些号码, 可以使用冒号。
		  如果您想使用第一个号码, 当第一个号码失败了再用第二个号码,
		  就使用管道符号。 如所示的那样, 要给整个电话号码加上引号(")。</para>

	      <para> 如果电话号码里有空格, 必须用引号(<literal>"</literal>)将其括起来。
		     否则会造成简单却难以察觉的错误。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>行 13 &amp; 14:</term>

	      <listitem>
		<para>指定用户名和密码。 当使用 &unix; 风格的命令提示符登录时,
		  这些值可以用带有 \U \P 参数的 <command>set login</command>
		  命令进行修改。 当使用PAP或CHAP进行连接时, 这些值在验证使用。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>行 15:</term>

	      <listitem>
		<indexterm><primary>PAP</primary></indexterm>
		<indexterm><primary>CHAP</primary></indexterm>
		<para>如果您使用的是PAP或者CHAP, 在这里就不会有登录。
		  要注释或删除掉这一行。
		  请参考 <link linkend="userppp-PAPnCHAP">PAP 和 CHAP认证</link>
		  以了解更多细节。</para>

                <para>登录命令是的语法是chat类型的。 在这个例子中是这样的:</para>

		<screen>J. Random Provider
login: <replaceable>foo</replaceable>
password: <replaceable>bar</replaceable>
protocol: ppp</screen>

		<para>您需要改变这个脚本以适合您自己的需要。
		  当您第一次写这个脚本时, 应当确保已经启用
		  <quote>chat</quote> 并处于登录状态,
		  这样您才能确认通信是否正在按计划进行。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>行16:</term>

	      <listitem>
		<indexterm><primary>timeout</primary></indexterm>

		<para>设置默认的超时时间。 这里, 连接若在 300
		  秒内无响应将被断开。如果您不想设置成超时,
		  将这个值设置成0, 或在命令行使用 <option>-ddial</option> 选项。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>行 17:</term>
	      <listitem>
		<indexterm><primary>ISP</primary></indexterm>

		<para>设置接口地址。 您需要用 ISP 提供给您的 IP 地址替换字符串
		  <replaceable>x.x.x.x</replaceable>, 用 ISP 的网关 IP
		  地址 (即您要连接的主机) 替换字符串
		  <replaceable>y.y.y.y</replaceable>。
		  如果ISP没有给您提供网关地址, 可以使用
		  <hostid role="netmask">10.0.0.2/0</hostid>。
		  如果您需要使用一个 <quote>猜到</quote>的地址,
		  请确保在 <filename>/etc/ppp/ppp.linkup</filename>
		  中为每个 <link linkend="userppp-dynamicIP">PPP和动态IP地址</link>
		  指令创建了这一项。 如果没有这一行, <command>ppp</command>
		  将无法以 <option>-auto</option> 模式运行。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>第18行:</term>

	      <listitem>
		<para>添加一个到ISP网关的默认路由。
		  <literal>HISADDR</literal>这个关键字会被第17行所指定的网关地址替换。
		  这行必须出现在第17行之后,以免在 <literal>HISADDR</literal>
		  初始化之前使用它的值。</para>

		<para>如果您不想使用 <option>-auto</option> 的 PPP,则这行应挪到
                  <filename>ppp.linkup</filename> 文件中。</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>

	  <para>若您有一个静态IP地址, 且使用<option>-auto</option>
	    模式运行ppp(因为在连接之前已经正确设置了路由表项), 那就不需要再向<filename>ppp.linkup</filename>
           添加项。 您可能希望在连接以后创建一个项来调用程序。 这在以后的sendmail的例子中会解释。</para>

	  <para>示例配置文件可以在目录
	    <filename class="directory">/usr/share/examples/ppp/</filename> 中找到。</para>
	</sect4>

	<sect4 id="userppp-dynamicIP">
	  <title>PPP和动态IP地址</title>

	  <indexterm>
            <primary>PPP</primary>
            <secondary>with dynamic IP addresses</secondary>
          </indexterm>

	  <indexterm>
            <primary>IPCP</primary>
          </indexterm>

	  <para>如果ISP没给您指定静态的IP地址, <command>ppp</command>要被配置成能够与对方协商确定本地和远程地址。
	    要完成这项工作, 先要<quote>猜</quote>一个IP地址, 然后允许
	    <command>ppp</command>在连接后使用IP配置协议(IPCP)进行正确配置。
	    <filename>ppp.conf</filename>的配置是与
	    <link linkend="userppp-staticIP">PPP和静态IP地址</link>一样的, 除了以下的改变:</para>

	  <programlisting>17      set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255 0.0.0.0</programlisting>

	  <para>再次强调, 不要包括行号, 它只是一个引用标记。 缩排一个空格是必需的。</para>

	  <variablelist>
	    <varlistentry>
	      <term>行17:</term>

	      <listitem>
		<para><literal>/</literal> 字符后面是 PPP 所要求的地址掩码。
		您可以根据需要使用不同 IP 地址, 但以上的例子永远是可行的。</para>

		<para>最后的参数(<literal>0.0.0.0</literal>)告诉
		  PPP从<hostid
		    role="ipaddr">0.0.0.0</hostid> 而不是 <hostid
		    role="ipaddr">10.0.0.1</hostid> 开始协商地址, 对于有些ISP,
		  这是必需的。 不要将 <literal>0.0.0.0</literal>
		  作为 <command>set ifaddr</command> 的第一个参数,
		  因为这使得 PPP 在 <option>-auto</option> 模式时不能设置初始路由。</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>

	  <para>如果您不运行<option>-auto</option>模式,
	  就需要在<filename>/etc/ppp/ppp.linkup</filename>中创建一个项。
	   连接建立之后, <filename>ppp.linkup</filename>被启用。 这时候,
	   <command>ppp</command>将指派接口地址, 接着再添加路由表项:</para>
	 <programlisting>1     provider:
2        add default HISADDR</programlisting>

	  <variablelist>
	    <varlistentry>
	      <term>行 1:</term>

	      <listitem>
		<para>为了建立连接,
		  <command>ppp</command> 会按照如下规则在
		  <filename>ppp.linkup</filename>寻找项:首先, 试图寻找相同的标签
		  (如同在<filename>ppp.conf</filename>一样)。 如果失败了,
		  寻找作为网关 IP 地址的项, 此项是四个八位字节的风格。
		  如果依旧没有找到, 就寻找 <literal>MYADDR</literal> 项</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>行 2:</term>

	      <listitem>
		<para>这行告诉 <command>ppp</command>添加指向
		  <literal>HISADDR</literal>的默认路由。
		  <literal>HISADDR</literal>由通过IPCP协商得到的IP号替换。</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>

	  <para>参考<filename>/usr/share/examples/ppp/ppp.conf.sample</filename>
	    和<filename>/usr/share/examples/ppp/ppp.linkup.sample</filename>
	    中的<literal>pmdemand</literal>项以获取细节化的例子。</para>
	</sect4>

	<sect4>
	  <title>接收拨入</title>

	  <indexterm>
            <primary>PPP</primary>
            <secondary>receiving incoming calls</secondary>
          </indexterm>

	  <para>当要配置 <application>ppp</application>接受来自LAN上的
	    拨入时, 您需要决定是否将包转给LAN。 如果是的话, 您就必须从 LAN
	    子网中给对方分配一个IP, 需要在文件 <filename>/etc/ppp/ppp.conf</filename>
	    中使用命令 <command>enable proxy</command>。 您还应该确定文件
	    <filename>/etc/rc.conf</filename> 中包含以下内容:</para>

	  <programlisting>gateway_enable="YES"</programlisting>
	</sect4>

	  <sect4>
	    <title>使用哪个getty?</title>

	    <para><link linkend="dialup">配置 FreeBSD 的拨号服务</link>
	     描述了如何用 &man.getty.8; 来启动拨号服务。</para>

	    <para>除了 <command>getty</command> 之外还有 <ulink
		url="http://mgetty.greenie.net/">mgetty</ulink> (可通过
	      <filename role="package">comms/mgetty+sendfax</filename> port
	      来安装),
	      它是 <command>getty</command> 的智能版本, 是按照拨号线的思想设计的。</para>

	    <para>使用 <command>mgetty</command> 的好处是它能积极地与 modem 进行
	      <emphasis>会话</emphasis>,
	      这就意味着如果在<filename>/etc/ttys</filename>中的端口被关闭,
	      您的moderm就不会回应拨入。</para>

	    <para>较新版本的 <command>mgetty</command> (从
	      0.99beta 起) 也支持自动检测 PPP 数据流,
	      这样即便客户端不使用脚本也能访问服务器了。</para>

	    <para>参考<link linkend="userppp-mgetty">Mgetty 和
	      AutoPPP</link>的联机手册了解更多信息。</para>
	  </sect4>

	  <sect4>
	    <title><application>PPP</application> 权限</title>

	    <para><command>ppp</command> 命令通常必须以 <username>root</username>
	      用户的身份运行。 如果希望以普通用户的身份启动 <command>ppp</command>
	      服务 (就像下面描述的那样), 就必须把此用户加入
	      <groupname>network</groupname> 组, 使其获得运行 <command>ppp</command>
	      的权限。</para>

	    <para>您还需要使用<command>allow</command>命令使用户能访问配置文
	    件的一个或多个部分:</para>
	    <programlisting>allow users fred mary</programlisting>

	    <para>如果这个命令被用在 <literal>default</literal>
	      部分中, 您可以让指定的用户访问任何东西。</para>
	  </sect4>

	  <sect4>
	    <title>动态IP用户的PPP Shell</title>

	    <indexterm>
              <primary>PPP shells</primary>
            </indexterm>

	    <para>创建一个名为<filename>/etc/ppp/ppp-shell</filename>文件, 加入以下内容:</para>
	    <programlisting>#!/bin/sh
IDENT=`echo $0 | sed -e 's/^.*-\(.*\)$/\1/'`
CALLEDAS="$IDENT"
TTY=`tty`

if [ x$IDENT = xdialup ]; then
        IDENT=`basename $TTY`
fi

echo "PPP for $CALLEDAS on $TTY"
echo "Starting PPP for $IDENT"

exec /usr/sbin/ppp -direct $IDENT</programlisting>

	    <para>这个脚本要有可执行属性。 然后通过如下命令创建一个指向此脚本且名为
	       <filename>ppp-dialup</filename>的符号链接:</para>

	    <screen>&prompt.root; <userinput>ln -s ppp-shell /etc/ppp/ppp-dialup</userinput></screen>

	    <para>您应该将这个脚本作为所有拨入用户的
	      <emphasis>shell</emphasis>。
	      以下是在文件 <filename>/etc/passwd</filename>
	      中关于 PPP 用户
	      <username>pchilds</username> 的例子 (切记,
	      不要直接修改这个密码文件, 用 &man.vipw.8; 来修改它)。</para>

	    <programlisting>pchilds:*:1011:300:Peter Childs PPP:/home/ppp:/etc/ppp/ppp-dialup</programlisting>

	    <para>创建一个名为 <filename class="directory">/home/ppp</filename>
	      的目录作为拨入用户的主目录, 其中包含以下这些空文件:</para>

	    <screen>-r--r--r--   1 root     wheel           0 May 27 02:23 .hushlogin
-r--r--r--   1 root     wheel           0 May 27 02:22 .rhosts</screen>

	    <para>这样就可以防止<filename>/etc/motd</filename>被显示出来。</para>
	  </sect4>

	  <sect4>
	    <title>静态IP用户的Shell </title>

	    <indexterm>
              <primary>PPP shells</primary>
            </indexterm>

	    <para>像上面那样创建<filename>ppp-shell</filename>文件,
	      为每个静态分配IP用户创建一个到 <filename>ppp-shell</filename>的
	      符号链接。</para>

	    <para>例如, 如果您希望为三个拨号用户,
	      <username>fred</username><username>sam</username>, 和
	      <username>mary</username> 路由 /24 CIDR 的网络, 则需要键入以下内容:</para>

	    <screen>&prompt.root; <userinput>ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-fred</userinput>
&prompt.root; <userinput>ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-sam</userinput>
&prompt.root; <userinput>ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-mary</userinput></screen>

	    <para>每个用户的Shell必须被设成一个符号链接(例如用户
	      <username>mary</username>的Shell应该是<filename>/etc/ppp/ppp-mary</filename>)。</para>
	  </sect4>

	  <sect4>
	    <title>为动态IP用户设置<filename>ppp.conf</filename> </title>

	    <para> <filename>/etc/ppp/ppp.conf</filename>文件应该包含下面
	    这些行:</para>

	    <programlisting>default:
  set debug phase lcp chat
  set timeout 0

ttyu0:
  set ifaddr 203.14.100.1 203.14.100.20 255.255.255.255
  enable proxy

ttyu1:
  set ifaddr 203.14.100.1 203.14.100.21 255.255.255.255
  enable proxy</programlisting>

	    <note>
	      <para>缩进得必须的。</para>
	    </note>

	    <para> <literal>default:</literal>项在每次会话时都会加载。 每个在
	      <filename>/etc/ttys</filename> 中启用的行都必须为其创建一个相似于
	      <literal>ttyu0:</literal> 的项。 每一行应该从动态 IP
	      地址池中取得唯一的IP地址。</para>
	  </sect4>

	  <sect4>
	    <title>为静态 IP 用户配置 <filename>ppp.conf</filename></title>

	    <para>根据上面 <filename>/usr/share/examples/ppp/ppp.conf</filename> 文件的内容,
	    您必须为每个静态拨号用户添加一个项。 我们继续以
	    <username>fred</username><username>sam</username>
	    以及 <username>mary</username>为例。</para>

	    <programlisting>fred:
  set ifaddr 203.14.100.1 203.14.101.1 255.255.255.255

sam:
  set ifaddr 203.14.100.1 203.14.102.1 255.255.255.255

mary:
  set ifaddr 203.14.100.1 203.14.103.1 255.255.255.255</programlisting>

	    <para> 如果需要, <filename>/etc/ppp/ppp.linkup</filename>
	      也应该包括每个静态IP用户的的路由信息。
	      下面这一行为客户连接添加了到
	       <hostid role="ipaddr">203.14.101.0/24</hostid> 网络的路由。</para>

	    <programlisting>fred:
  add 203.14.101.0 netmask 255.255.255.0 HISADDR

sam:
  add 203.14.102.0 netmask 255.255.255.0 HISADDR

mary:
  add 203.14.103.0 netmask 255.255.255.0 HISADDR</programlisting>
	</sect4>

	  <sect4 id="userppp-mgetty">
	    <title><command>mgetty</command>和AutoPPP</title>

	    <indexterm>
	      <primary><command>mgetty</command></primary>
	    </indexterm>

	    <indexterm>
	      <primary>AutoPPP</primary>
	    </indexterm>

	    <indexterm>
	      <primary>LCP</primary>
	    </indexterm>

	    <para>默认情况下, <filename
	      role="package">comms/mgetty+sendfax</filename> port
	      在编译时启用了 <literal>AUTO_PPP</literal> 选项,
	      它使 <command>mgetty</command> 能够检测 PPP 连接的 LCP 状态,
	      并自动产生 PPP shell。 不过, 由于在默认配置中的
	      login/password 序列并不出现, 因此,
	      就必须使用 PAP 或 CHAP 来严重用户身份。</para>

	    <para>这节假定用户已经在系统中成功地编译并安装了 <filename
	      role="package">comms/mgetty+sendfax</filename></para>

	    <para>确认您的
	      <filename>/usr/local/etc/mgetty+sendfax/login.config</filename>
	      文件中包含以下内容:</para>

	    <programlisting>/AutoPPP/ -     -		      /etc/ppp/ppp-pap-dialup</programlisting>

	    <para>这行告诉<command>mgetty</command>运行
	      <filename>ppp-pap-dialup</filename>脚本来侦听PPP连接。</para>

	    <para>创建<filename>/etc/ppp/ppp-pap-dialup</filename>文件写入以下内容 (此文件应该是可执行的):</para>

	    <programlisting>#!/bin/sh
exec /usr/sbin/ppp -direct pap$IDENT</programlisting>

	    <para>对应于每个在<filename>/etc/ttys</filename>的启用行, 都要在<filename>/etc/ppp/ppp.conf</filename>
	    中创建相应的项。 这和上面的定义是相同的。</para>

	    <programlisting>pap:
  enable pap
  set ifaddr 203.14.100.1 203.14.100.20-203.14.100.40
  enable proxy</programlisting>

	    <para>每个以这种方式登录的用户, 都必须在
	      <filename>/etc/ppp/ppp.secret</filename> 文件中给出用户名/口令,
	      或者使用以下选项, 来通过 PAP 方式以 <filename>/etc/passwd</filename>
	      文件提供的信息来完成身份验证。</para>

	    <programlisting>enable passwdauth</programlisting>

	    <para>如果您想为某些用户分配静态IP,
	      可以在 <filename>/etc/ppp/ppp.secret</filename>
	      中将IP号作为第三个参数指定。 请参见
	      <filename>/usr/share/examples/ppp/ppp.secret.sample</filename>
	      中的例子。</para>
	  </sect4>

	  <sect4>
	    <title>MS Extensions</title>

	    <indexterm>
              <primary>DNS</primary>
            </indexterm>

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

	    <indexterm>
              <primary>PPP</primary><secondary>Microsoft extensions</secondary>
            </indexterm>

	    <para>可以配置PPP以提供DNS和NetBIOS域名服务器地址。</para>

	    <para>要在 PPP 1.x 版本中启用这些扩展, 需要在
	      <filename>/etc/ppp/ppp.conf</filename> 的对应项中加入下列配置:</para>

	    <programlisting>enable msext
set ns 203.14.100.1 203.14.100.2
set nbns 203.14.100.5</programlisting>

	    <para>PPP版本2及以上:</para>

	    <programlisting>accept dns
set dns 203.14.100.1 203.14.100.2
set nbns 203.14.100.5</programlisting>

	    <para>这将告诉客户端首选域名服务器和备用域名服务器。</para>

	    <para>在版本2及以上版本中, 如果省略了
	      <literal>set dns</literal>, PPP会使用
	      <filename>/etc/resolv.conf</filename>中的值。</para>
	</sect4>

        <sect4 id="userppp-PAPnCHAP">
	  <title>PAP 和 CHAP 验证</title>
	  <indexterm><primary>PAP</primary></indexterm>
	  <indexterm><primary>CHAP</primary></indexterm>
	  <para>一些 ISP 将系统配置为使用 PAP 或 CHAP 机制来完成连接验证。
	    如果遇到这种情况, 在您连接时 ISP 就不会看到
	    <prompt>login:</prompt> 提示符, 而是立即开始 PPP 对话。</para>

	  <para>PAP 安全性要比 CHAP 差一些, 但在这里安全性并不是问题,
	    因为密码 (即使用明文传送) 只是通过串行线传送,
	    攻击者并没有太多机会去 <quote>窃听</quote> 它。</para>

	  <para>参考 <link linkend="userppp-staticIP">PPP
	    与静态 IP 地址</link><link
	    linkend="userppp-dynamicIP">PPP 与动态 IP 地址</link>
	    小节, 并完成下列改动:</para>

	  <programlisting>13      set authname <replaceable>MyUserName</replaceable>
14      set authkey <replaceable>MyPassword</replaceable>
15      set login</programlisting>

	  <variablelist>
	    <varlistentry>
	      <term>13 行:</term>

	      <listitem>
		<para>这一行指明您的PAP/CHAP用户名。
		  您需要为<replaceable>MyUserName</replaceable>输入正确的值。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>14 行:</term>
	      <listitem>
		<indexterm><primary>password</primary></indexterm>

		<para>这一行指明您的 PAP/CHAP password密码。
		  您需要为 <replaceable>MyPassword</replaceable> 输入正确的值。
		  另外,您可能希望加入一些额外的选项,例如:</para>

		<programlisting>16      accept PAP</programlisting>

		<para></para>

		<programlisting>16      accept CHAP</programlisting>

		<para>以明确您的意图, 不过, 默认情况下 PAP 和 CHAP 都会被接受。</para>
	      </listitem>
	    </varlistentry>

	    <varlistentry>
	      <term>15</term>

	      <listitem>
		<para>如果您使用的是 PAP 或 CHAP, 一般来说 ISP
		  就不会要求您登录服务器了。 这时,
		  就必须禁用 <quote>set login</quote>
		  设置。</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>
	</sect4>

	<sect4>
	  <title>即时改变您的<command>ppp</command> 配置</title>

	  <para>与后台运行的<command>ppp</command>程序进行对话是可能的,
	前提是设置了一个合适的诊断端口。 做到这一点, 需要把下面的行加入到您的配置中:</para>

	  <programlisting>set server /var/run/ppp-tun<replaceable>%d</replaceable> DiagnosticPassword 0177</programlisting>

	  <para>这行告诉 PPP在指定的&unix;域socket中侦听, 当用户连接时需要给出指定的密码。
	    <literal>%d</literal><devicename>tun</devicename>设备号替换。</para>

	  <para>一旦启用了socket, 就可以在脚本中调用程序&man.pppctl.8;来处理正在运行的
	       的PPP。</para>
	</sect4>
      </sect3>

      <sect3 id="userppp-nat">
       <title>使用PPP网络地址翻译</title>

       <indexterm>
         <primary>PPP</primary>
         <secondary>NAT</secondary>
       </indexterm>

       <para>PPP 可以使用内建的 NAT, 而无需内核支持。
	 您可以在 <filename>/etc/ppp/ppp.conf</filename> 中加入如下配置来启用它:</para>

	<programlisting>nat enable yes</programlisting>

       <para> PPP NAT也可以使用命令行选项
	 <literal>-nat</literal>启动。 在
         <filename>/etc/rc.conf</filename> 文件中也有
         <literal>ppp_nat</literal> 项, 并默认启用。</para>

       <para>如果您使用了这个特性, 您还会发现在
         <filename>/etc/ppp/ppp.conf</filename>中以下
         选项对于启用incoming connections forwarding是有用的:</para>

	<programlisting>nat port tcp 10.0.0.2:ftp ftp
nat port tcp 10.0.0.2:http http</programlisting>

       <para>或者完全不信任外来的请求</para>

	<programlisting>nat deny_incoming yes</programlisting>
      </sect3>

      <sect3 id="userppp-final">
	<title>最后的系统配置</title>

	<indexterm>
          <primary>PPP</primary><secondary>configuration</secondary>
        </indexterm>

	<para>现在您已配置了<command>ppp</command>, 但在真正工作之前还有一些事情要做。
	  即修改 <filename>/etc/rc.conf</filename></para>

	<para>从上依次往下看, 确认已经正确地配置了
	  <literal>hostname=</literal>, 例如:</para>

	<programlisting>hostname="foo.example.com"</programlisting>

	<para>如果您的ISP提供给您一个静态的IP和名字, 将这个名字设为hostname是最合适的。</para>

	<para>寻找 <literal>network_interfaces</literal> 变量。
	  如果要配置系统通过拨号连入ISP,
	  一定要将<devicename>tun0</devicename>设备加入这个列表, 否则就删除它。</para>

	<programlisting>network_interfaces="lo0 tun0"
ifconfig_tun0=</programlisting>

	<note>
	  <para> <literal>ifconfig_tun0</literal>变量应该是空的, 且要创建一个名为
	    <filename>/etc/start_if.tun0</filename>的文件。
	  这个文件应该包含这一行:</para>

	  <programlisting>ppp -auto mysystem</programlisting>

	  <para>此脚本在网络配置时被执行, 开启PPP守护进程进入自动模式。
	    如果这台机子充当一个LAN的网关, 您可能希望使用
	    <option>-alias</option>。 参考相关联机手册了解更多细节。</para>
	</note>

	<para>务必在
	  <filename>/etc/rc.conf</filename> 中,
          把路由程序设置为 <literal>NO</literal></para>

	<programlisting>router_enable="NO"</programlisting>

	<indexterm>
          <primary><application>routed</application></primary>
        </indexterm>

	<para>不启动 <command>routed</command> 服务程序非常重要, 因为
	  <command>routed</command> 总会删掉由 <command>ppp</command>
	  所建立的默认路由。</para>

	<para>此外, 我们建议您确认一下
	  <literal>sendmail_flags</literal> 这一行中没有指定
	  <option>-q</option> 参数, 否则
	  <command>sendmail</command> 将会不断地尝试查找网络,
	  而这样做将会导致机器不断地进行拨号。 可以考虑:</para>

	<programlisting>sendmail_flags="-bd"</programlisting>

	<indexterm>
    <primary><application>sendmail</application></primary>
  </indexterm>
	<para>替代的做法是当每次 PPP 连接建立时您必须通过键入以下命令强制
	  <command>sendmail</command> 重新检查邮件队列:</para>

	<screen>&prompt.root; <userinput>/usr/sbin/sendmail -q</userinput></screen>

	<para>您也可以在<filename>ppp.linkup</filename>使用<command>!bg</command>命令自动完成这些工作:</para>

	<programlisting>1     provider:
2       delete ALL
3       add 0 0 HISADDR
4       !bg sendmail -bd -q30m</programlisting>

        <indexterm>
          <primary>SMTP</primary>
        </indexterm>

	<para>如果您不喜欢这样做, 可以设立一个
	  <quote>dfilter</quote> 以阻止 SMTP 传输。
	  参考相关文件了解更多细节。</para>

	<para>现在您唯一要做的事是重新启动计算机。
	  重启之后,可以输入:</para>

	<screen>&prompt.root; <userinput>ppp</userinput></screen>

	<para>然后是<command>dial provider</command>以开启 PPP会话。
	   或者如果您想让<command>ppp</command>自动建立会话,
	   因为您有一条广域网连接 (且没有创建 <filename>start_if.tun0</filename>
	   脚本), 键入:</para>

	<screen>&prompt.root; <userinput>ppp -auto provider</userinput></screen>
      </sect3>

      <sect3>
	<title>总结</title>

	<para>当第一次设置PPP时, 下面几步是必须的:</para>

	<para>客户端:</para>

	<procedure>
	  <step>
	    <para>确保 <devicename>tun</devicename>编译进了进核。</para>
	  </step>

	  <step>
	    <para>确保 <filename class="directory">/dev</filename>
	      目录中名为
	      <filename class="devicefile">tun<replaceable>N</replaceable></filename>
	      的设备文件是可用的。</para>
	  </step>

	  <step>
	    <para><filename>/etc/ppp/ppp.conf</filename>中创建一个项。
	      <filename>pmdemand</filename>示例应该适合于绝大多数ISP。</para>
	  </step>

	  <step>
	    <para>如果您使用动态IP地址, 在<filename>/etc/ppp/ppp.linkup</filename>创建一个项。</para>
	  </step>

	  <step>
	    <para>更新<filename>/etc/rc.conf</filename>
	      文件。</para>
	  </step>

	  <step>
	    <para>如果您要求按需拨号, 创建一个<filename>start_if.tun0</filename>脚本。</para>
	  </step>
	</procedure>

	<para>服务器端:</para>

	<procedure>
	  <step>
	    <para>确保<devicename>tun</devicename>设备已编译入内核。</para>
	  </step>

	  <step>
	    <para>确保 <filename class="directory">/dev</filename>
	      目录中名为
	      <filename class="devicefile">tun<replaceable>N</replaceable></filename>
	      的设备文件是可用的。</para>
	  </step>

	  <step>
	    <para><filename>/etc/passwd</filename>中创建一个项
	      (使用&man.vipw.8;程序)。</para>
	  </step>

	  <step>
	    <para>在用户的home目录创建一个运行
	      <command>ppp -direct direct-server</command>或相似命令的profile。</para>
	  </step>

	  <step>
	    <para><filename>/etc/ppp/ppp.conf</filename>中创建一个项。
	      <filename>direct-server</filename>示例应该能满足要求。</para>
	  </step>

	  <step>
	    <para><filename>/etc/ppp/ppp.linkup</filename>中创建一个项。</para>
	  </step>

	  <step>
	    <para>更新 <filename>/etc/rc.conf</filename>
	     文件。</para>
	  </step>
	</procedure>
      </sect3>
    </sect2>
  </sect1>

  <sect1 id="ppp">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Gennady B.</firstname>
          <surname>Sorokopud</surname>
          <contrib>Parts originally contributed by </contrib>
        </author>
        <author>
          <firstname>Robert</firstname>
          <surname>Huff</surname>
        </author>
      </authorgroup>
    </sect1info>

    <title>使用内核级PPP</title>

    <warning>
      <para>这节内容只在
	&os;&nbsp;7.X 上可用。</para>
    </warning>

    <sect2>
      <title>设立内核级PPP</title>

      <indexterm>
        <primary>PPP</primary>
        <secondary>kernel PPP</secondary>
      </indexterm>

      <para>在开始配置 PPP 之前,
	请确认 <command>pppd</command> 已经存放在
	<filename class="directory">/usr/sbin</filename> 中, 并且
	<filename class="directory">/etc/ppp</filename> 目录是存在的。</para>

      <para><command>pppd</command>能在两种模式下工作:</para>

      <orderedlist>
	<listitem>
	  <para>作为一个 <quote>客户</quote> &mdash;
	    您要通过PPP串行线或modem线把您的机器连接到互联网上。</para>
	</listitem>

	<listitem>
	  <indexterm>
	    <primary>PPP</primary>
	    <secondary>server</secondary>
	  </indexterm>

	  <para>作为<quote>服务器</quote> &mdash;计算机已经位于网络上, 且被用于通过PPP与其它计算机连接。</para>
	</listitem>
      </orderedlist>

      <para>两种情况您都需要设立一个选项文件,
        (<filename>/etc/ppp/options</filename> 或者是
	<filename>~/.ppprc</filename> 如果您的计算机有多个用户使用PPP)。</para>

      <para>您还需要一些modem/serial软件(<filename role="package">comms/kermit</filename>就很适合),
      使您能够拨号并与远程主机建立连接。</para>
    </sect2>

    <sect2>
      <sect2info>
	<authorgroup>
	  <author>
	    <firstname>Trev</firstname>
	    <surname>Roydhouse</surname>
	    <contrib>Based on information provided by </contrib>
	    <!-- Trev.Roydhouse@f401.n711.z3.fidonet.org -->
	  </author>
	</authorgroup>
      </sect2info>

      <title>使用<command>pppd</command>作为客户端</title>

      <indexterm>
        <primary>PPP</primary>
        <secondary>client</secondary>
      </indexterm>

      <indexterm>
        <primary>Cisco</primary>
      </indexterm>

      <para>下面这个 <filename>/etc/ppp/options</filename>选项文件能够被用来与CISCO终端服务器的
      PPP线连接。</para>

      <programlisting>crtscts         # enable hardware flow control
modem           # modem control line
noipdefault     # remote PPP server must supply your IP address
                # if the remote host does not send your IP during IPCP
                # negotiation, remove this option
passive         # wait for LCP packets
domain ppp.foo.com      # put your domain name here

:<replaceable>remote_ip</replaceable>    # put the IP of remote PPP host here
                # it will be used to route packets via PPP link
                # if you didn't specified the noipdefault option
                # change this line to <replaceable>local_ip</replaceable>:<replaceable>remote_ip</replaceable>

defaultroute    # put this if you want that PPP server will be your
                # default router</programlisting>

      <para>连接:</para>

      <indexterm><primary>Kermit</primary></indexterm>
      <indexterm><primary>modem</primary></indexterm>
      <procedure>
	<step>
	  <para>使用 <application>Kermit</application> (或其他 modem
	    程序来拨号), 然后输入您的用户名和口令
	    (或在远程主机上启用 PPP 所需的其他信息)。</para>
	</step>

	<step>
	  <para>退出 <application>Kermit</application> (并不挂断连接)。</para>
	</step>

	<step>
	  <para>键入下面这行:</para>

	  <screen>&prompt.root; <userinput>/usr/sbin/pppd <replaceable>/dev/tty01</replaceable> <replaceable>19200</replaceable></userinput></screen>

	  <para>一定要使用正确的速度和设备名。</para>
	</step>
      </procedure>

      <para>现在您的计算机已经用PPP连接。 如果连接失败,
	您可在文件 <filename>/etc/ppp/options</filename> 中添加
	<option>debug</option> 选项, 并查看控制台信息以跟踪问题。</para>

      <para>下面这个<filename>/etc/ppp/pppup</filename>脚本能自动完成这三个步骤:</para>

      <programlisting>#!/bin/sh
pgrep -l pppd
pid=`pgrep pppd`
if [ "X${pid}" != "X" ] ; then
        echo 'killing pppd, PID=' ${pid}
        kill ${pid}
fi
pgrep -l kermit
pid=`pgrep kermit`
if [ "X${pid}" != "X" ] ; then
        echo 'killing kermit, PID=' ${pid}
        kill -9 ${pid}
fi

ifconfig ppp0 down
ifconfig ppp0 delete

kermit -y /etc/ppp/kermit.dial
pppd /dev/tty01 19200</programlisting>

      <indexterm>
        <primary>Kermit</primary>
      </indexterm>

      <para><filename>/etc/ppp/kermit.dial</filename> 是一个 <application>Kermit</application>
      脚本, 它会完成拨号, 并在远程主机上完成所有需要的身份验证过程
      (这份文档的最后有一个脚本实例)。</para>

      <para>使用下面这个脚本<filename>/etc/ppp/pppdown</filename>断开PPP连线:</para>

      <programlisting>#!/bin/sh
pid=`pgrep pppd`
if [ X${pid} != "X" ] ; then
        echo 'killing pppd, PID=' ${pid}
        kill -TERM ${pid}
fi

pgrep -l kermit
pid=`pgrep kermit`
if [ "X${pid}" != "X" ] ; then
        echo 'killing kermit, PID=' ${pid}
        kill -9 ${pid}
fi

/sbin/ifconfig ppp0 down
/sbin/ifconfig ppp0 delete
kermit -y /etc/ppp/kermit.hup
/etc/ppp/ppptest</programlisting>

      <para>通过执行<filename>/usr/etc/ppp/ppptest</filename>,
        看看<command>pppd</command> 是否仍在运行:</para>

      <programlisting>#!/bin/sh
pid=`pgrep pppd`
if [ X${pid} != "X" ] ; then
        echo 'pppd running: PID=' ${pid-NONE}
else
        echo 'No pppd running.'
fi
set -x
netstat -n -I ppp0
ifconfig ppp0</programlisting>

      <para>执行脚本
	<filename>/etc/ppp/kermit.hup</filename>以挂起moderm, 这个文件包含:</para>

      <programlisting>set line /dev/tty01	; put your modem device here
set speed 19200
set file type binary
set file names literal
set win 8
set rec pack 1024
set send pack 1024
set block 3
set term bytesize 8
set command bytesize 8
set flow none

pau 1
out +++
inp 5 OK
out ATH0\13
echo \13
exit</programlisting>

      <para>也可以用<command>chat</command>
	代替<command>kermit</command></para>

      <para>以下两个文件用以建立<command>pppd</command>连接。</para>

      <para><filename>/etc/ppp/options</filename></para>

      <programlisting>/dev/cuad1 115200

crtscts		# enable hardware flow control
modem		# modem control line
connect "/usr/bin/chat -f /etc/ppp/login.chat.script"
noipdefault	# remote PPP serve must supply your IP address
	        # if the remote host doesn't send your IP during
                # IPCP negotiation, remove this option
passive         # wait for LCP packets
domain <replaceable>your.domain</replaceable>	# put your domain name here

:		# put the IP of remote PPP host here
	        # it will be used to route packets via PPP link
                # if you didn't specified the noipdefault option
                # change this line to <replaceable>local_ip</replaceable>:<replaceable>remote_ip</replaceable>

defaultroute	# put this if you want that PPP server will be
	        # your default router</programlisting>

      <para><filename>/etc/ppp/login.chat.script</filename></para>

      <note>
	<para>以下的内容应该放在一行内。</para>
      </note>

      <programlisting>ABORT BUSY ABORT 'NO CARRIER' "" AT OK ATDT<replaceable>phone.number</replaceable>
  CONNECT "" TIMEOUT 10 ogin:-\\r-ogin: <replaceable>login-id</replaceable>
  TIMEOUT 5 sword: <replaceable>password</replaceable></programlisting>

      <para>一旦这些被安装且修改正确, 您所要做的就是运行<command>pppd</command>, 就像这样:</para>

      <screen>&prompt.root; <userinput>pppd</userinput></screen>
    </sect2>

    <sect2>
      <title>使用<command>pppd</command>作为服务器</title>

      <para><filename>/etc/ppp/options</filename>要包括下面这些内容:</para>

      <programlisting>crtscts                         # Hardware flow control
netmask 255.255.255.0           # netmask (not required)
192.114.208.20:192.114.208.165  # IP's of local and remote hosts
                                # local ip must be different from one
                                # you assigned to the Ethernet (or other)
                                # interface on your machine.
                                # remote IP is IP address that will be
                                # assigned to the remote machine
domain ppp.foo.com              # your domain
passive                         # wait for LCP
modem                           # modem line</programlisting>

      <para>下面这个脚本<filename>/etc/ppp/pppserv</filename>
     使<application>pppd</application>以服务器方式启动:</para>

      <programlisting>#!/bin/sh 
pgrep -l pppd
pid=`pgrep pppd`
if [ "X${pid}" != "X" ] ; then
        echo 'killing pppd, PID=' ${pid}
        kill ${pid}
fi
pgrep -l kermit
pid=`pgrep kermit`
if [ "X${pid}" != "X" ] ; then
        echo 'killing kermit, PID=' ${pid}
        kill -9 ${pid}
fi

# reset ppp interface
ifconfig ppp0 down
ifconfig ppp0 delete

# enable autoanswer mode
kermit -y /etc/ppp/kermit.ans

# run ppp
pppd /dev/tty01 19200</programlisting>

      <para>使用脚本<filename>/etc/ppp/pppservdown</filename>停止服务器:</para>

      <programlisting>#!/bin/sh
pgrep -l pppd
pid=`pgrep pppd`
if [ "X${pid}" != "X" ] ; then
        echo 'killing pppd, PID=' ${pid}
        kill ${pid}
fi
pgrep -l kermit
pid=`pgrep kermit`
if [ "X${pid}" != "X" ] ; then
        echo 'killing kermit, PID=' ${pid}
        kill -9 ${pid}
fi
ifconfig ppp0 down
ifconfig ppp0 delete

kermit -y /etc/ppp/kermit.noans</programlisting>

      <para>下面的 <application>Kermit</application> 脚本
	(<filename>/etc/ppp/kermit.ans</filename>) 能够启用/禁用您 modem
	的自动应答模式。 其内容类似下面这样:</para>

      <programlisting>set line /dev/tty01
set speed 19200
set file type binary
set file names literal
set win 8
set rec pack 1024
set send pack 1024
set block 3
set term bytesize 8
set command bytesize 8
set flow none

pau 1
out +++
inp 5 OK
out ATH0\13
inp 5 OK
echo \13
out ATS0=1\13   ; change this to out ATS0=0\13 if you want to disable
                ; autoanswer mode
inp 5 OK
echo \13
exit</programlisting>

      <para>一个名为<filename>/etc/ppp/kermit.dial</filename>的脚本用于向远程主机
      进行拨号和验证。 您要根据需要定制它。 要加入您的登寻名和密码,
      您还要根据 modem 和远程主机的反应修改输入语句。</para>

      <programlisting>;
; put the com line attached to the modem here:
;
set line /dev/tty01
;
; put the modem speed here:
;
set speed 19200
set file type binary            ; full 8 bit file xfer
set file names literal
set win 8
set rec pack 1024
set send pack 1024
set block 3
set term bytesize 8
set command bytesize 8
set flow none
set modem hayes
set dial hangup off
set carrier auto                ; Then SET CARRIER if necessary,
set dial display on             ; Then SET DIAL if necessary,
set input echo on
set input timeout proceed
set input case ignore
def \%x 0                       ; login prompt counter
goto slhup

:slcmd                          ; put the modem in command mode
echo Put the modem in command mode.
clear                           ; Clear unread characters from input buffer
pause 1
output +++                      ; hayes escape sequence
input 1 OK\13\10                ; wait for OK
if success goto slhup
output \13
pause 1
output at\13
input 1 OK\13\10
if fail goto slcmd              ; if modem doesn't answer OK, try again

:slhup                          ; hang up the phone
clear                           ; Clear unread characters from input buffer
pause 1
echo Hanging up the phone.
output ath0\13                  ; hayes command for on hook
input 2 OK\13\10
if fail goto slcmd              ; if no OK answer, put modem in command mode

:sldial                         ; dial the number
pause 1
echo Dialing.
output atdt9,550311\13\10               ; put phone number here
assign \%x 0                    ; zero the time counter

:look
clear                           ; Clear unread characters from input buffer
increment \%x                   ; Count the seconds
input 1 {CONNECT }
if success goto sllogin
reinput 1 {NO CARRIER\13\10}
if success goto sldial
reinput 1 {NO DIALTONE\13\10}
if success goto slnodial
reinput 1 {\255}
if success goto slhup
reinput 1 {\127}
if success goto slhup
if &lt; \%x 60 goto look
else goto slhup

:sllogin                        ; login
assign \%x 0                    ; zero the time counter
pause 1
echo Looking for login prompt.

:slloop
increment \%x                   ; Count the seconds
clear                           ; Clear unread characters from input buffer
output \13
;
; put your expected login prompt here:
;
input 1 {Username: }
if success goto sluid
reinput 1 {\255}
if success goto slhup
reinput 1 {\127}
if success goto slhup
if &lt; \%x 10 goto slloop         ; try 10 times to get a login prompt
else goto slhup                 ; hang up and start again if 10 failures

:sluid
;
; put your userid here:
;
output ppp-login\13
input 1 {Password: }
;
; put your password here:
;
output ppp-password\13
input 1 {Entering SLIP mode.}
echo
quit

:slnodial
echo \7No dialtone.  Check the telephone line!\7
exit 1

; local variables:
; mode: csh
; comment-start: "; "
; comment-start-skip: "; "
; end:</programlisting>
    </sect2>
  </sect1>

  <sect1 id="ppp-troubleshoot">
    <sect1info>
      <authorgroup>
	<author>
	  <firstname>Tom</firstname>
	  <surname>Rhodes</surname>
	  <contrib>Contributed by </contrib>
	</author>
      </authorgroup>
      <!-- 13 June 2003 -->
    </sect1info>
    <title><acronym>PPP</acronym> 连接故障排除</title>

    <indexterm>
      <primary>PPP</primary>
      <secondary>troubleshooting</secondary>
    </indexterm>

    <warning>
      <para>&os; 8.0 开始, &man.uart.4; 驱动取代了
	&man.sio.4; 驱动。 用以表示串口的设备节点由分别
	<filename>/dev/cuad<replaceable>N</replaceable></filename> 改为了
	<filename>/dev/cuau<replaceable>N</replaceable></filename>,
	并从
	<filename>/dev/ttyd<replaceable>N</replaceable></filename> 改为了
	<filename>/dev/ttyu<replaceable>N</replaceable></filename>&os;&nbsp;7.X 用户在升级时需要因应之对配置文件进行必要的更改。</para>
    </warning>

      <para>本节将讲述通过modem连接使用PPP时可能出现的问题。
	例如, 您可能需要确切地知道您拨入的系统会出现一个怎样的命令行提示符。
	有些 <acronym>ISP</acronym> 会提供 <literal>ssword</literal>提示符,
	而其它的可能会出现 <literal>password</literal>;
	如果没有根据情况的不同相应地编写 <command>ppp</command>
	脚本, 登录就会失败。 诊断 <command>ppp</command>
	最常用的方法是手动进行连接。 以下的信息会一步一步地带您完成手动连接。</para>

    <sect2>
      <title>检查设备节点</title>

	<para>如果使用的是定制内核, 确认在其编译配置中包含下列配置:</para>

	<programlisting>device   uart</programlisting>

	<para>默认的 <literal>GENERIC</literal> 内核中包含了
	  <devicename>uart</devicename> 设备, 因此如果您使用的是它的话,
	  就不需要担心了。 只要查看 <command>dmesg</command> 输出中是否有 modem
	  设备:</para>

	<screen>&prompt.root; <userinput>dmesg | grep uart</userinput></screen>

	<para>您应该找到与 <devicename>uart</devicename> 设备有关的输出。
	  这些就是我们需要的 COM 端口。 如果您的 modem 按照标准串行端口工作,
	  您就会在 <devicename>uart1</devicename><devicename>COM2</devicename>
	  上找到它。 如果 modem 设备连接在 <devicename>uart1</devicename>
	  接口 (在 DOS 中称为<devicename>COM2</devicename>),
	  那么您的 modem 将会是 <filename class="devicefile">/dev/cuau1</filename></para>
    </sect2>

    <sect2>
      <title>手动连接</title>

      <para>通过手动控制<command>ppp</command>来连接Internet
      是诊断连接及获知<acronym>ISP</acronym>处理<application>PPP</application>客户端方式的一个快速, 简单的方法。
	让我们从<application>PPP</application> 命令行开始, 在所有的例子中我们使用
	<emphasis>example</emphasis> 表示运行 <application>PPP</application>
	服务的主机名。 键入<command>ppp</command>
	命令打开 <command>ppp</command></para>

      <screen>&prompt.root; <userinput>ppp</userinput></screen>

      <para>现在我们已经打开了<command>ppp</command></para>

      <screen>ppp ON example&gt; <userinput>set device <filename class="devicefile">/dev/cuau1</filename></userinput></screen>

      <para>设置modem设备, 在本例子中是
	<devicename>cuau1</devicename></para>

      <screen>ppp ON example&gt; <userinput>set speed 115200</userinput></screen>

      <para>设置连接速度, 在本例中我们使用15,200 <acronym>kbps</acronym></para>

      <screen>ppp ON example&gt; <userinput>enable dns</userinput></screen>

      <para>使<command>ppp</command>配置域名服务,
	在文件<filename>/etc/resolv.conf</filename>中添加域名服务器行。
	如果 <command>ppp</command>不能确定我们的主机名, 可以在稍后设置。</para>

      <screen>ppp ON example&gt; <userinput>term</userinput></screen>

      <para>切换到 <quote>终端</quote>样我们就能手动地控制这台 modem 的模式。</para>

      <programlisting>deflink: Entering terminal mode on <filename class="devicefile">/dev/cuau1</filename>
type '~h' for help</programlisting>

      <screen><userinput>at</userinput>
OK
<userinput>atdt<replaceable>123456789</replaceable></userinput></screen>

      <para>使用命令<command>at</command>初始化modem,
	然后使用<command>atdt</command><acronym>ISP</acronym>给您的号码进行拨号。</para>

      <screen>CONNECT</screen>

      <para>连接配置, 如果我们遇到了与硬件无关的连接问题, 可以在这里尝试解决。</para>

      <screen>ISP Login:<userinput>myusername</userinput></screen>

      <para>这里提示您输入用户名, 输入<acronym>ISP</acronym>提供的用户名然后按回车。</para>

      <screen>ISP Pass:<userinput>mypassword</userinput></screen>

      <para>这时提示我们输入密码, 输入
	<acronym>ISP</acronym>提供的密码。
	如同登录入&os;, 密码不会显示。</para>

      <screen>Shell or PPP:<userinput>ppp</userinput></screen>

      <para>由于<acronym>ISP</acronym>的不同, 这个提示符可能不会出现。
	这里我们需要考虑: 是使用运行于提供商端的 Shell,
	还是启动 <command>ppp</command>? 这本例中,
	我们选择使用 <command>ppp</command>, 因为我们希望得到 Internet 连接。</para>

      <screen>Ppp ON example&gt;</screen>

      <para>注意在这个例子中, 第一个 <option>p</option>已经大写。
	这表示我们已经成功地连接上了 <acronym>ISP</acronym></para>

      <screen>PPp ON example&gt;</screen>

      <para>我们已经成功通过了
	<acronym>ISP</acronym>的验证, 正在等待分配<acronym>IP</acronym>地址。</para>

      <screen>PPP ON example&gt;</screen>

      <para>我们得到了一个 <acronym>IP</acronym>
	地址, 成功地完成了连接。</para>

      <screen>PPP ON example&gt;<userinput>add default HISADDR</userinput></screen>

      <para>这样就完成了添加默认路由所需的配置。 这是与外界通信所必需的。
	因为之前我们只是与服务器端建立了连接。 如果由于已存在的路由而导致操作失败,
	您可以在 <option>add</option> 前加 <literal>!</literal>号。
	除此之外, 您也可以在真正连接之前设置这些 (指 add default HISADDR),
	ppp 会根据这项设定协商取得新的路由。</para>

      <para>如果一切顺利, 现在我们应该能得到一个活动的 Internet 连接,
	可以使用 <keycombo
	action="simul"><keycap>CTRL</keycap>
	<keycap>z</keycap></keycombo> 使其转入后台。 如果您发现
	<command>PPP</command>重新变为 <command>ppp</command>,
	则表示连接被断开。 大写的 P 表明建立了到 <acronym>ISP</acronym> 的连接,
	而小写的 p 则表示连接由于某种原因被断开, 这有助于帮助我们了解连接的状态。
	<command>ppp</command> 只有这两个状态。</para>

      <sect3>
	<title>诊断排错</title>

	<para>如果您有一根直连线且似乎不能建立连接, 要使用<option>set
	  ctsrts off</option>以关闭字节流的<acronym>CTS/RTS</acronym>。
	  这种情况一般发生在连接兼容 <application>PPP</application> 的终端服务器时。
	  当它向通信连接写入数据时, <application>PPP</application>就会挂起,
	  一直等待一个<acronym>CTS</acronym>,
	  或者一个不可能出现的 Clear to Send 信号。 如果使用了这个选项, 您还应使用
	  <option>set accmap</option>选项,
	  某些存在缺陷的硬件在完成端对端发送特定字符, 特别是
	  XON/XOFF 时可能会遇到困难。 请参见 &man.ppp.8;
	  联机手册以了解关于可用选项的更多细节, 以及如何使用它们。</para>

	<para>如果您的 modem 比较旧, 就需要使用
	  <option>set parity even</option> 了。 奇偶校验的默认设置是 none,
	  但在旧式的 (当流量大量增加时) 调制解调器和某些
	  <acronym>ISP</acronym> 被用来纠错。 您需要使用这个选项才能使用
	  Compuserve <acronym>ISP</acronym></para>

	<para><application>PPP</application> 可能并不返回命令模式,
	  这通常是 <acronym>ISP</acronym> 等待您这一端发起协商时发生了错误。
	  此时, 使用 <command>~p</command> 命令将强制 ppp 开始发送配置信息。</para>

	<para>如果您没有看到登录提示, 则很可能需要使用
	  <acronym>PAP</acronym><acronym>CHAP</acronym> 验证来代替前面例子中的
	  &unix; 风格验证。 要使用
	  <acronym>PAP</acronym><acronym>CHAP</acronym>
	  只需在进入终端模式之前把下面的选项加入
	  <application>PPP</application></para>

	<screen>ppp ON example&gt; <userinput>set authname <replaceable>myusername</replaceable></userinput></screen>

	<para>此处 <replaceable>myusername</replaceable> 应改为您的
	  <acronym>ISP</acronym> 分配给您的用户名。</para>

	<screen>ppp ON example&gt; <userinput>set authkey <replaceable>mypassword</replaceable></userinput></screen>

	<para>此处 <replaceable>mypassword</replaceable> 应该为您的
	  <acronym>ISP</acronym> 分配给您的口令。</para>

	<para>如果连接正常, 但无法查找域名, 请尝试
	  &man.ping.8; 某个 <acronym>IP</acronym>
	  地址来看看是否返回了信息。 如果您发现百分之百 (100%) 丢包,
	  那么您很可能没有分配默认路由。 请仔细检查选项
	  <option>add default HISADDR</option>
	  是否在连接时被设置了。 如果您能连接到远程的
	  <acronym>IP</acronym> 地址则有可能域名解析服务器的地址没有被加入到
	  <filename>/etc/resolv.conf</filename>。 这个文件应该是下面的样子:</para>

	<programlisting>domain <replaceable>example.com</replaceable>
nameserver <replaceable>x.x.x.x</replaceable>
nameserver <replaceable>y.y.y.y</replaceable></programlisting>

	<para>此处 <replaceable>x.x.x.x</replaceable><replaceable>y.y.y.y</replaceable> 应该改为您的
	  <acronym>ISP</acronym> 的 DNS 服务器的
	  <acronym>IP</acronym> 地址。
	  这一信息在您注册时可能会提供给您,
	  不过通常只需给 <acronym>ISP</acronym> 打个电话就能知道了。</para>

	<para>您还可以让 &man.syslog.3; 为您的 <application>PPP</application>
	  连接提供日志。 只需增加:</para>

	<programlisting>!ppp
*.*     /var/log/ppp.log</programlisting>

	<para><filename>/etc/syslog.conf</filename> 中。 绝大多数情况下,
	  这个功能默认已经打开了。</para>

      </sect3>
    </sect2>
  </sect1>




  <sect1 id="pppoe">
    <sect1info>
      <authorgroup>
        <author>
          <firstname>Jim</firstname>
          <surname>Mock</surname>
          <contrib>Contributed (from http://node.to/freebsd/how-tos/how-to-freebsd-pppoe.html) by </contrib>
	</author>
      </authorgroup>
      <!-- 10 Jan 2000 -->
    </sect1info>

    <title>使用基于以太网的PPP(PPPoE)</title>

    <indexterm>
      <primary>PPP</primary>
      <secondary>over Ethernet</secondary>
    </indexterm>

    <indexterm>
      <primary>PPPoE</primary>
      <see>PPP, over Ethernet (以太网上的 PPP)</see>
    </indexterm>

    <para>本节将介绍如何建立基于以太网的PPP
      (<acronym>PPPoE</acronym>)。</para>

    <sect2>
      <title>配置内核</title>

      <para>对于PPPOE, 并没有必须的内核配置。 如果必需的 netgraph
	支持没有编译入内核, 它可以由 <application>ppp</application> 动态加载。</para>
    </sect2>

    <sect2>
      <title>设置<filename>ppp.conf</filename></title>

      <para>以下是一个<filename>ppp.conf</filename>的例子:</para>

      <programlisting>default:
  set log Phase tun command # you can add more detailed logging if you wish
  set ifaddr 10.0.0.1/0 10.0.0.2/0

name_of_service_provider:
  set device PPPoE:<replaceable>xl1</replaceable> # replace xl1 with your Ethernet device
  set authname YOURLOGINNAME
  set authkey YOURPASSWORD
  set dial
  set login
  add default HISADDR</programlisting>

    </sect2>

    <sect2>
      <title>运行<application>ppp</application></title>

      <para><username>root</username> 身份执行:</para>

      <screen>&prompt.root; <userinput>ppp -ddial name_of_service_provider</userinput></screen>

    </sect2>

    <sect2>
      <title>启动时运行<application>ppp</application></title>

      <para><filename>/etc/rc.conf</filename> 中加入以下内容:</para>

      <programlisting>ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="YES"	# if you want to enable nat for your local network, otherwise NO
ppp_profile="name_of_service_provider"</programlisting>
    </sect2>

    <sect2>
      <title>使用 PPPoE 服务标签</title>

      <para>在某些时候, 有必要使用一个服务标签来建立您的连接。
	服务标签用于区分同一网络中的不同服务器。</para>

      <para>您可以在ISP提供的文档中找到必要的服务标签信息。
	若不能找到, 则应向您的 ISP 寻求技术支持。</para>

      <para>作为最后的方法, 您可以试试
	<ulink url="http://www.roaringpenguin.com/pppoe/">Roaring Penguin
	PPPoE</ulink>, 它可以在 <link
	linkend="ports">Ports Collection</link> 中找到。
	然而需要注意的是, 它可能会清楚 modem 的固件, 并使其无法正常工作,
	因此一定要仔细考虑之后再做这个操作。 简单地安装由服务提供商随 modem
	提供的程序。 随后, 选择
	<guimenu>System</guimenu> 菜单。 您的配置文件应该会在这里列出。
	一般来说它的名字应该是
	<emphasis>ISP</emphasis></para>

      <para>配置文件名 (service tag, 服务标签) 将被用于 PPPoE
	在 <filename>ppp.conf</filename> 中的配置项,
	作为服务商 <command>set device</command> 命令的一部分 (参见 &man.ppp.8;
	联机手册以了解更多细节)。 它应该类似下面的样子:</para>

      <programlisting>set device PPPoE:<replaceable>xl1</replaceable>:<replaceable>ISP</replaceable></programlisting>

      <para>记住将<replaceable>xl1</replaceable>换成实际的以太网设备。</para>
      <para>记住将 <replaceable>ISP</replaceable>
	换成您刚刚找到的profile名。</para>

      <para>获得更多的信息, 请参考:</para>

      <itemizedlist>
	<listitem>
	  <para><ulink
	    url="http://renaud.waldura.com/doc/freebsd/pppoe/">Cheaper
	    Broadband with FreeBSD on DSL</ulink> by Renaud
	    Waldura.</para>
	</listitem>

	<listitem>
	  <para><ulink
	      url="http://www.ruhr.de/home/nathan/FreeBSD/tdsl-freebsd.html">
	      Nutzung von T-DSL und T-Online mit FreeBSD</ulink>
	    by Udo Erdelhoff (in German).</para>
	</listitem>
      </itemizedlist>
    </sect2>

    <sect2 id="ppp-3com">

      <title>带有一个&tm.3com;
        <trademark class="registered">HomeConnect</trademark>
        ADSL Modem的PPPOE双重连接</title>

      <para>这个 modem 不遵循 <ulink
  	  url="http://www.faqs.org/rfcs/rfc2516.html">RFC 2516</ulink>
	(<emphasis>A Method for transmitting PPP over Ethernet
	(PPPoE)</emphasis>, 其作者为 L. Mamakos、 K. Lidl、 J. Evarts、
	D. Carrel、 D. Simone 以及 R. Wheeler)。
	而是使用不同的数据包格式作为以太网的框架。 请向
	<ulink url="http://www.3com.com/">3Com</ulink> 抱怨,
	如果您认为它应该遵守 PPPoE 的规范。</para>

      <para>为了让FreeBSD能够与这个设备通信, 必须设置sysctl。
	通过更改<filename>/etc/sysctl.conf</filename>,
	这一步可以在启动时自动完成:</para>

	<programlisting>net.graph.nonstandard_pppoe=1</programlisting>

      <para>或者, 也可以直接执行下面的命令:</para>

      <screen>&prompt.root; <userinput>sysctl net.graph.nonstandard_pppoe=1</userinput></screen>

      <para>很不幸,由于这是系统全局设置, 无法同时与正常的PPP客户端(或服务器)
      和&tm.3com;<trademark class="registered">HomeConnect</trademark>
      ADSL Modem通信。</para>

    </sect2>
  </sect1>

  <sect1 id="pppoa">
    <title>使用 ATM 上的 <application>PPP</application> (PPPoA)</title>

    <indexterm>
      <primary>PPP</primary>
      <secondary>over ATM</secondary>
    </indexterm>

    <indexterm>
      <primary>PPPoA</primary>
      <see>基于ATM的PPP</see>
    </indexterm>

    <para>以下将介绍如何设置基于ATM的PPP(PPPoA)。
      PPPoA是欧洲DSL提供商的普遍选择。</para>

    <sect2>
      <title>使用 Alcatel &speedtouch;USB 的 PPPoA</title>

      <para>针对这一设备的 PPPoA 支持, 在
	FreeBSD 中是作为 port 提供的, 因为其固件使用了 <ulink
	url="http://www.speedtouchdsl.com/disclaimer_lx.htm">阿尔卡特许可协议</ulink>,
	因而不能与 FreeBSD 的基本系统一起免费地再发布。</para>

      <para>使用 <link
	  linkend="ports">Ports 套件</link> 可以非常方便地安装
	<filename role="package">net/pppoa</filename> port,
	之后按照它提供的指示操作就可以了。</para>

      <para>和许多 USB 设备类似, 阿尔卡特的 &speedtouch; USB
        需要从主机上下载固件才能够正常工作。 在 &os; 中您可以将此操作自动化,
        在有设备插到某个 USB 口的时候自动下载固件。 可以在
        <filename>/etc/usbd.conf</filename>
        文件中加入下面的信息来让它自动完成固件的传送。 注意, 必须以
        <username>root</username> 用户的身份编辑它。</para>

      <programlisting>device "Alcatel SpeedTouch USB"
    devname "ugen[0-9]+"
    vendor 0x06b9
    product 0x4061
    attach "/usr/local/sbin/modem_run -f /usr/local/libdata/mgmt.o"</programlisting>

     <para>要启动USB守护进程<application>usbd</application>,
       在<filename>/etc/rc.conf</filename>加入以下行:</para>

     <programlisting>usbd_enable="YES"</programlisting>

     <para>也可以将<application>ppp</application>设置成启动时拨号。 向
       <filename>/etc/rc.conf</filename>加入以下这几行。
       同样地您需要以<username>root</username>用户登录。</para>

     <programlisting>ppp_enable="YES"
ppp_mode="ddial"
ppp_profile="adsl"</programlisting>

     <para>为了使其正常工作, 您需要使用<filename role="package">net/pppoa</filename>
     port提供的<filename>ppp.conf</filename>样例。</para>

    </sect2>

    <sect2>
      <title>使用mpd</title>

      <para>可以使用 <application>mpd</application> 来连接多种类型的服务,
        特别是 PPTP 服务。 您可以在 Ports Collection 中找到
        <application>mpd</application>, 它的位置是
        <filename role="package">net/mpd</filename>。 许多 ADSL modem
        需要在 modem 和计算机之间建立一条 PPTP 隧道,
        而阿尔卡特 &speedtouch; Home 正是其中的一种。</para>

      <para>首先需要从 port 完成安装,
        然后才能配置 <application>mpd</application> 来满足您的需要,
        并完成服务商的配置。 port 会把一系列包括了详细注解的配置文件实例放到
        <filename class="directory"><replaceable>PREFIX</replaceable>/etc/mpd/</filename>。
        注意, 这里的 <replaceable>PREFIX</replaceable> 表示 ports
        安装的目录, 默认情况下, 应该是
        <filename class="directory">/usr/local/</filename>。
        关于配置 <application>mpd</application> 的完整说明, 会以
        HTML 格式随 port 一起安装。 这些文件将放在
        <filename class="directory"><replaceable>PREFIX</replaceable>/share/doc/mpd/</filename>。
        下面是通过 <application>mpd</application> 连接 ADSL
        服务的一个简单例子。 配置被分别放到了两个文件中, 第一个是
        <filename>mpd.conf</filename></para>

      <programlisting>default:
    load adsl

adsl:
    new -i ng0 adsl adsl
    set bundle authname <replaceable>username</replaceable> <co
    id="co-mpd-ex-user"/>
    set bundle password <replaceable>password</replaceable> <co
    id="co-mpd-ex-pass"/>
    set bundle disable multilink

    set link no pap acfcomp protocomp
    set link disable chap
    set link accept chap
    set link keep-alive 30 10

    set ipcp no vjcomp
    set ipcp ranges 0.0.0.0/0 0.0.0.0/0

    set iface route default
    set iface disable on-demand
    set iface enable proxy-arp
    set iface idle 0

    open</programlisting>

    <calloutlist>
      <callout arearefs="co-mpd-ex-user">
        <para>username用来向您的ISP进行验证。</para>
      </callout>
      <callout arearefs="co-mpd-ex-pass">
        <para> password用来向您的ISP进行验证。</para>
      </callout>
    </calloutlist>

    <para><filename>mpd.links</filename>包含连接的信息:</para>

    <programlisting>adsl:
    set link type pptp
    set pptp mode active
    set pptp enable originate outcall
    set pptp self <replaceable>10.0.0.1</replaceable> <co
    id="co-mpd-ex-self"/>
    set pptp peer <replaceable>10.0.0.138</replaceable> <co
    id="co-mpd-ex-peer"/></programlisting>

    <calloutlist>
      <callout arearefs="co-mpd-ex-self">
	<para>运行<application>mpd</application>的主机的IP地址。</para>
      </callout>
      <callout arearefs="co-mpd-ex-peer">
	<para>ADSL modem的IP地址。 Alcatel
	  &speedtouch; Home 默认的是 <hostid
	  role="ipaddr">10.0.0.138</hostid></para>
      </callout>
    </calloutlist>

    <para>初始化连接:</para>

    <screen>&prompt.root; <userinput>mpd -b <replaceable>adsl</replaceable></userinput></screen>

    <para>您可以通过以下命令查看连接状态:</para>

    <screen>&prompt.user; <userinput>ifconfig <replaceable>ng0</replaceable></userinput>
ng0: flags=88d1&lt;UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST&gt; mtu 1500
     inet 216.136.204.117 --> 204.152.186.171 netmask 0xffffffff</screen>

    <para>使用<application>mpd</application>连接ADSL服务是推荐的方式。</para>

    </sect2>

    <sect2>
      <title>使用pptpclient</title>

      <para>也可以使用<filename role="package">net/pptpclient</filename>连接其它的
      PPPoA。</para>

      <para>要使用 <filename role="package">net/pptpclient</filename> 连接
	 DSL 服务, 需要安装 port 或 package 并编辑
	 <filename>/etc/ppp/ppp.conf</filename>。 您需要有
	 <username>root</username> 权限才能完成这两项操作。
	 以下是 <filename>ppp.conf</filename> 中的一个示例项。
	 参考 <application>ppp</application> 的联机手册 &man.ppp.8;,
	 以了解更多有关 <filename>ppp.conf</filename> 选项的信息。</para>

      <programlisting>adsl:
 set log phase chat lcp ipcp ccp tun command
 set timeout 0
 enable dns
 set authname <replaceable>username</replaceable> <co id="co-pptp-ex-user"/>
 set authkey <replaceable>password</replaceable> <co id="co-pptp-ex-pass"/>
 set ifaddr 0 0
 add default HISADDR</programlisting>

   <calloutlist>
     <callout arearefs="co-pptp-ex-user">
	   <para>您在 DSL 服务提供商那里的用户名</para>
	 </callout>
	 <callout arearefs="co-pptp-ex-pass">
	   <para>您帐户的口令。</para>
	 </callout>
   </calloutlist>

   <warning>
     <para>由于您必须将帐号密码以明文的方式放入<filename>ppp.conf</filename>
	 您应该确保没有任何人能看到此文件的内容。 以下一系列命令将会确保此文件只对
	 <username>root</username>用户可读。
	 请参见 &man.chmod.1; 和 &man.chown.8; 的联机手册以了解有关如何操作的进一步信息。</para>
	 <screen>&prompt.root; <userinput>chown root:wheel /etc/ppp/ppp.conf</userinput>
&prompt.root; <userinput>chmod 600 /etc/ppp/ppp.conf</userinput></screen>
   </warning>

      <para>以下将为到 DSL 路由器的会话打开一个 tunnel。
	以太网DSL modem有一个设置的局域网IP地址。 以 Alcatel &speedtouch; Home
	为例, 这个地址是 <hostid role="ipaddr">10.0.0.138</hostid>。
	路由器的文档应该会告诉您它使用的地址。
	执行以下命令以打开 tunnel 并开始会话:</para>

      <screen>&prompt.root; <userinput>pptp <replaceable>address</replaceable> <replaceable>adsl</replaceable></userinput></screen>

      <tip>
	<para>您应该在命令的最后加上(<quote>&amp;</quote>)号, 否则 <application>pptp</application>
	无法返回到命令行提示符。</para>
      </tip>

      <para>要创建一个 <devicename>tun</devicename>虚拟设备用于进程<application>pptp</application><application>ppp</application> 之间的交互。 一旦您回到了命令行,
	或者 <application>pptp</application>
	进程确认了一个连接, 您可以这样检查tunnel设备:</para>

      <screen>&prompt.user; <userinput>ifconfig <replaceable>tun0</replaceable></userinput>
tun0: flags=8051&lt;UP,POINTOPOINT,RUNNING,MULTICAST&gt; mtu 1500
        inet 216.136.204.21 --> 204.152.186.171 netmask 0xffffff00
        Opened by PID 918</screen>

      <para>如果您无法连接, 一般可以通过<application>telnet</application>或者web浏览器检查路由器(modem)的配置。
      如果依旧无法连接, 您应该检查<command>pptp</command>的输出及<application>ppp</application>的日志文件
	<filename>/var/log/ppp.log</filename> 以获得线索。</para>
    </sect2>
  </sect1>

  <sect1 id="slip">
    <sect1info>
      <authorgroup>
	<author>
	  <firstname>Satoshi</firstname>
	  <surname>Asami</surname>
	  <contrib>Originally contributed by </contrib>
	</author>
      </authorgroup>
      <authorgroup>
	<author>
	  <firstname>Guy</firstname>
	  <surname>Helmer</surname>
	  <contrib>With input from </contrib>
	</author>
	<author>
	  <firstname>Piero</firstname>
          <surname>Serini</surname>
	</author>
      </authorgroup>
    </sect1info>

    <title>使用SLIP</title>
    <indexterm><primary>SLIP</primary></indexterm>

    <warning>
      <para>这节内容只在
	&os;&nbsp;7.X 上可用。</para>
    </warning>

    <sect2 id="slipc">
      <title>设置 SLIP 客户端</title>

      <indexterm>
	<primary>SLIP</primary>
	<secondary>client (客户端)</secondary>
      </indexterm>

      <para>下面是在静态主机网络上配置 FreeBSD 机器使用 SLIP 的方法。
	对于动态主机名分配 (您的地址会随每次拨号而不同),
	您可能需要稍复杂一些的设置。</para>

      <para>首先, 您需要确认调制解调器所连接的串口。
	许多人会设置一个符号连接, 例如
	<filename class="devicefile">/dev/modem</filename>, 用以指向实际的设备名, 如
	<filename class="devicefile">/dev/cuad<replaceable>N</replaceable></filename>。
	这样您就可以对实际的设备名进行抽象,
	以备调制解调器换到其他串口时方便调整之用。 不然, 修改
	<filename class="directory">/etc</filename> 和遍布于系统中的 <filename>.kermrc</filename>
	文件将是一件很麻烦的事情!</para>

      <note>
	<para><filename class="devicefile">/dev/cuad0</filename> 对应
	  <devicename>COM1</devicename>, 而 <filename class="devicefile">/dev/cuad1</filename>
	  则对应
	  <devicename>COM2</devicename>, 等等。</para>
      </note>

      <para>确保您的内核文件包含以下内容:</para>

      <programlisting>device   sl</programlisting>

      <para>这包含在<filename>GENERIC</filename>内核, 所以这应该不会是个问题, 除非您
        已经删除了它。</para>

      <sect3>
	<title>只需做一次的事情</title>

	<procedure>
	  <step>
	    <para>把您本地网络上的机器、 网关以及域名服务器,
	      都加入到 <filename>/etc/hosts</filename> 文件中。
	      我们的是下面这个样子:</para>

	    <programlisting>127.0.0.1               localhost loghost
136.152.64.181          water.CS.Example.EDU water.CS water
136.152.64.1            inr-3.CS.Example.EDU inr-3 slip-gateway
128.32.136.9            ns1.Example.EDU ns1
128.32.136.12           ns2.Example.EDU ns2</programlisting>
	  </step>

	  <step>
	    <para>请确保在您的 <filename>/etc/nsswitch.conf</filename>
	      中的 <literal>hosts:</literal> 小节里面, <literal>files</literal> 先于
	      <literal>dns</literal> 出现。 如果不是这样的话,
	      可能会产生一些不希望的现象。</para>
	  </step>

	  <step>
	    <para>编辑<filename>/etc/rc.conf</filename></para>

	    <orderedlist>
	      <listitem>
		<para>编辑以下这行设置主机名(hostname):</para>

		<programlisting>hostname="myname.my.domain"</programlisting>

		<para>应该用您主机的Internet全名代替。</para>
	      </listitem>

	      <listitem>
		<indexterm><primary>default route</primary></indexterm>

		<para>改变这一行以指明默认的路由:</para>

		<programlisting>defaultrouter="NO"</programlisting>

		<para>改为:</para>

		<programlisting>defaultrouter="slip-gateway"</programlisting>
	      </listitem>
	    </orderedlist>
	  </step>

	  <step>
	    <para>创建文件<filename>/etc/resolv.conf</filename>, 写入以下内容:</para>

	    <programlisting>domain CS.Example.EDU
nameserver 128.32.136.9
nameserver 128.32.136.12</programlisting>

	    <indexterm><primary>nameserver</primary></indexterm>
	    <indexterm><primary>domain name</primary></indexterm>
	    <para>正如您看到的, 这些行设置了域名服务器。 当然,
	      实际的域名和IP地址取决于您的环境。</para>
	  </step>

	  <step>
	    <para>设置<username>root</username><username>toor</username>的密码(其它任何没有密码的帐号)。</para>
	  </step>

	  <step>
	    <para>重启计算机, 然后确认使用了正确的主机名。</para>
	  </step>
	</procedure>
      </sect3>

      <sect3>
	<title>创建一个SLIP连接</title>

	<indexterm>
          <primary>SLIP</primary>
          <secondary>connecting with</secondary>
        </indexterm>

	<procedure>
	  <step>
	    <para>在命令提示符之后输入 <command>slip</command> 进行拨号,
	      输入您的机器名和口令。 具体需要输入什么,
	      与您的环境密切相关。 如果使用
	      <application>Kermit</application>,
	      则可以使用类似下面的脚本:</para>

	    <programlisting># kermit setup
set modem hayes
set line /dev/modem
set speed 115200
set parity none
set flow rts/cts
set terminal bytesize 8
set file type binary
# The next macro will dial up and login
define slip dial 643-9600, input 10 =&gt;, if failure stop, -
output slip\x0d, input 10 Username:, if failure stop, -
output silvia\x0d, input 10 Password:, if failure stop, -
output ***\x0d, echo \x0aCONNECTED\x0a</programlisting>

	    <para>当然, 您还需要修改用户名和口令来满足实际需要。
	      完成这些操作之后, 只需在 <application>Kermit</application>
              提示符之后输入 <command>slip</command> 就可以连接了。</para>

	    <note>
	      <para>将密码以纯文本的形式存放在文件系统无论如何都是个 <emphasis></emphasis> 主意。
		请考虑这样做的风险。</para>
	    </note>
	  </step>

	  <step>
	    <para>在这里退出 <application>Kermit</application> (也可以用
	      <keycombo>
		<keycap>Ctrl</keycap>
		<keycap>z</keycap>
	      </keycombo> 将其挂起), 以 <username>root</username> 用户键入:</para>

	    <screen>&prompt.root; <userinput>slattach -h -c -s 115200 /dev/modem</userinput></screen>

	    <para>如果您能<command>ping</command>通路由器另一端的主机, 就是连接好了! 如果不行,
	    您可以使用<option>-a</option>选项代替
<option>-c</option>作为<command>slattach</command>的参数。</para>
	  </step>
	</procedure>
      </sect3>

      <sect3>
	<title>关闭连接</title>

	<para>按下面的步骤做:</para>

	<screen>&prompt.root; <userinput>kill -INT `cat /var/run/slattach.modem.pid`</userinput></screen>

	<para>来杀掉 <command>slattach</command>。 切记上述操作只有以
	  <username>root</username> 身份才能完成。 接下来回到
	  <command>kermit</command> (如果之前是将它挂起了,
	  则使用 <command>fg</command>) 并退出 (<keycap>q</keycap>)。</para>

	<para>在 &man.slattach.8; 联机手册中提到,
	  必须使用 <command>ifconfig sl0 down</command>
          才能将接口标记为关闭, 但和这样做似乎没有什么区别。
	  (<command>ifconfig sl0</command> 仍然报告同样的东西。)</para>

	<para>有时, 您的 modem 可能会拒绝挂断。
	  这种情况下, 只需重新启动 <command>kermit</command>
	  并再次退出它就可以了。 一般来说试二次就可以了。</para>
      </sect3>

      <sect3>
	<title>问题解答</title>

	<para>如果还不行, 尽管发邮件到 &a.net.name; 邮件列表来提问。
	  常见的问题包括:</para>

	<itemizedlist>
	  <listitem>
	    <para>执行 <command>slattach</command> 时不使用
	      <option>-c</option><option>-a</option>选项
	      (这应该不是关键的, 但有些用户报告这样做解决了问题)。</para>
	  </listitem>

	  <listitem>
	    <para>使用<option>s10</option>替换
	      <option>sl0</option> (在一些字体下很难看出不同)。</para>
	  </listitem>

	  <listitem>
	    <para>试试<command>ifconfig sl0</command>来查看您的接口状态。
	      例如, 您可以这样做:</para>

	    <screen>&prompt.root; <userinput>ifconfig sl0</userinput>
sl0: flags=10&lt;POINTOPOINT&gt;
        inet 136.152.64.181 --&gt; 136.152.64.1 netmask ffffff00</screen>
	  </listitem>

	  <listitem>
	    <para>如果在使用 &man.ping.8; 时得到了
            <errorname>no route to host</errorname> 这样的提示,
            则说明您的路由表可能有问题。 可以用 <command>netstat -r</command>
            命令来显示当前的路由:</para>

	    <screen>&prompt.root; <userinput>netstat -r</userinput>
Routing tables
Destination      Gateway            Flags     Refs     Use  IfaceMTU    Rtt    Netmasks:

(root node)
(root node)

Route Tree for Protocol Family inet:
(root node) =&gt;
default          inr-3.Example.EDU  UG          8   224515  sl0 -      -
localhost.Exampl localhost.Example. UH          5    42127  lo0 -       0.438
inr-3.Example.ED water.CS.Example.E UH          1        0  sl0 -      -
water.CS.Example localhost.Example. UGH        34 47641234  lo0 -       0.438
(root node)</screen>

	    <para>前述的例子来自于一个非常繁忙的系统。
              您系统上的这些数字会因网络活动的不同而改变。</para>

	  </listitem>
	</itemizedlist>
      </sect3>
    </sect2>

    <sect2 id="slips">
      <title>设置SLIP服务器</title>

      <indexterm>
        <primary>SLIP</primary>
        <secondary>server</secondary>
      </indexterm>

      <para>本文提供了在 FreeBSD 上设置 SLIP 服务,
	也就是如何配置您的系统, 使其能在远程 SLIP
	客户端登录时自动地开启连接的建议。</para>

      <!-- Disclaimer is not necessarily relevant
      <para> The author has written this document based
	on his experience; however, as your system and needs may be
	different, this document may not answer all of your questions, and
	the author cannot be responsible if you damage your system or lose
	data due to attempting to follow the suggestions here.</para>
      -->

      <sect3 id="slips-prereqs">
	<title>前提条件</title>
	<indexterm><primary>TCP/IP networking</primary></indexterm>
	<para>这一节技术性很强, 所以要求您有一定的背景知识。
	  本节假定您熟悉 TCP/IP 网络协议, 特别是网络和节点寻址、
	  子网掩码、 子网划分、 路由、 路由协议 (如RIP) 等知识。
	  在拨号服务器上配置 SLIP 需要这些概念性的知识。
	  如果您不熟悉它们, 请先阅读 Craig Hunt 的 <emphasis>TCP/IP 网络管理</emphasis>
	  由O'Reilly &amp; Associates, Inc. 出版 (ISBN 0-937175-82-X),
	  或 Douglas Comer 有关 TCP/IP 协议的书籍。</para>

	<indexterm><primary>modem</primary></indexterm>
	<para>此外还假定您已经配置好了您的调制解调器以及相应的系统文件,
	  以允许通过调制解调器进行登录。 如果您还没有为此配置好系统,
	  请参见 <xref
	  linkend="dialup"/> 以了解关于如何进行拨号服务的配置。
	  您可能也会想看一看 &man.sio.4; 的联机手册,
	  以了解关于串口设备驱动的进一步信息, 以及 &man.ttys.5;、
	  &man.gettytab.5;、 &man.getty.8; &amp; &man.init.8;
	  上关于怎样配置系统来接受来自调制解调器的登录请求的具体情况,
	  还有 &man.stty.1; 以了解关于设置串口参数
	  (例如 <literal>clocal</literal> 表示串口直联) 等。</para>
      </sect3>

      <sect3>
	<title>快速浏览</title>

	<para>使用FreeBSD作为SLIP服务器, 在典型配置时, 它是这样工作的:
	  一个SLIP客户拨号并以专用的login ID登录到FreeBSD SLIP服务器系统。
	  这个用户使用 <filename>/usr/sbin/sliplogin</filename>
	  作为 shell。 <command>sliplogin</command> 程序会在文件
	  <filename>/etc/sliphome/slip.hosts</filename> 中查找这个用户的项,
	  如果找到了匹配项, 就将串行线连接到一个可用的 SLIP 接口,
	  然后运行 shell 脚本 <filename>/etc/sliphome/slip.login</filename>
	  以配置 SLIP 接口。</para>

        <sect4>
	  <title>一个SLIP服务器登录的例子</title>

	  <para>例如, 如果一个SLIP用户的ID是<username>Shelmerg</username>,
         在<filename>/etc/master.passwd</filename><username>Shelmerg</username>的项如下的所示:</para>

	  <programlisting>Shelmerg:password:1964:89::0:0:Guy Helmer - SLIP:/usr/users/Shelmerg:/usr/sbin/sliplogin</programlisting>

	  <para><username>Shelmerg</username>登录时,
	    <command>sliplogin</command>在文件
	    <filename>/etc/sliphome/slip.hosts</filename>中搜索与用户ID匹配的行;如下所示:</para>

	  <programlisting>Shelmerg        dc-slip sl-helmer       0xfffffc00		  autocomp</programlisting>

	  <para><command>sliplogin</command>找到这条区配行,
	   并将串行线与另一个可用的SLIP接口连起来,
	   然后执行<filename>/etc/sliphome/slip.login</filename>脚本:</para>

	  <programlisting>/etc/sliphome/slip.login 0 19200 Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp</programlisting>

	  <para>如果一切顺利
	    <filename>/etc/sliphome/slip.login</filename> 将在
            <command>sliplogin</command> 绑定的 SLIP 接口上发出
	    <command>ifconfig</command> (前述的例子中是 SLIP 接口
	    0, 这是 <filename>slip.login</filename> 的第一个参数),
	    以设置本地 IP 地址 (<hostid>dc-slip</hostid>)、 远程 IP 地址
	    (<hostid>sl-helmer</hostid>)、 这一 SLIP
	    接口的子网掩码 (<hostid role="netmask">0xfffffc00</hostid>),
	    以及任何其他标志 (<literal>autocomp</literal>)。
	    如果发生错误, <command>sliplogin</command> 通常会通过
	    <application>syslogd</application> 的 daemon facility
	    记下有用的信息, 前者会把这些信息保存到
            <filename>/var/log/messages</filename>
	    (参见 &man.syslogd.8; 和 &man.syslog.conf.5; 以及
	    <filename>/etc/syslog.conf</filename> 的联机手册, 以了解
	    <application>syslogd</application> 在记录什么,
	    以及这些内容将被记在哪里)。</para>
	</sect4>
      </sect3>

      <sect3>
	<title>内核配置</title>

	<indexterm>
          <primary>kernel</primary>
          <secondary>configuration</secondary>
        </indexterm>

	<indexterm>
          <primary>SLIP</primary>
        </indexterm>

	<para>&os; 的默认内核 (<filename>GENERIC</filename>)
	  提供了 SLIP (&man.sl.4;) 支持; 使用定制的内核时,
	  您必须把下面的设置加入到配置文件:</para>

	<programlisting>device   sl</programlisting>

	<para>默认情况下, 您的 &os; 计算机不会转发包。
	  如果您希望将 FreeBSD SLIP 服务器作为路由器使用,
	  就需要修改 <filename>/etc/rc.conf</filename> 文件,
	  将 <literal>gateway_enable</literal> 变量设为
	  <option>YES</option>。 这样下次系统引导时就能够保持这一配置了。</para>
 
	<para>要立即应用这些配置, 可以 <username>root</username>
	  的身份运行:</para>

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

	<para>请参阅 <xref linkend="kernelconfig"/> 以了解如何配置 FreeBSD
	  内核, 并获得在重新配置内核方面的指导。</para>
      </sect3>

      <sect3>
	<title>Sliplogin配置</title>

	<para>正如先前所提到的,
	  <filename class="directory">/etc/sliphome</filename> 目录中有三个文件,
	  它们共同构成 <filename>/usr/sbin/sliplogin</filename> 的配置 (参考
	  <command>sliplogin</command> 的联机手册 &man.sliplogin.8;):
	  用于定义 SLIP 用户和相关的 IP
	  地址的 <filename>slip.hosts</filename>、
	  通常仅用于配置 SLIP 接口的 <filename>slip.login</filename>, 以及 (可选的)
	  <filename>slip.logout</filename>, 用以撤销由
	  <filename>slip.login</filename> 所执行的动作。</para>

        <sect4>
	  <title>配置 <filename>slip.hosts</filename></title>

	  <para><filename>/etc/sliphome/slip.hosts</filename>里的每行包含至少四个元素, 元素之间由空格隔开:</para>

	  <itemizedlist>
	    <listitem>
	      <para>SLIP用户的登录ID</para>
	    </listitem>

	    <listitem>
	      <para>SLIP连接的本地地址(指SLIP服务器)</para>
	    </listitem>

	    <listitem>
	      <para>SLIP连接的远程地址</para>
	    </listitem>

	    <listitem>
	      <para>网络掩网</para>
	    </listitem>
	  </itemizedlist>

	  <para>本地和远程地址可以是主机名
	    (通过文件<filename>/etc/hosts</filename>或者域名服务解析为IP地址,
	    这取决于文件<filename>/etc/nsswitch.conf</filename>
	    中的设置), 网络掩网可以是一个
	    能通过文件<filename>/etc/networks</filename>解析的名字。
	    在一个样例系统中,
	    <filename>/etc/sliphome/slip.hosts</filename>是这样的:</para>

	  <programlisting>#
# login local-addr      remote-addr     mask            opt1    opt2
#                                               (normal,compress,noicmp)
#
Shelmerg  dc-slip       sl-helmerg      0xfffffc00      autocomp</programlisting>

	  <para>在这行末尾是一或多个选项:</para>

	  <itemizedlist>
	    <listitem>
	      <para><option>normal</option> &mdash;不压缩报头
		</para>
	    </listitem>

	    <listitem>
	      <para><option>compress</option> &mdash; 压缩报头</para>
	    </listitem>

	    <listitem>
	      <para><option>autocomp</option> &mdash;如果远程端允许, 压缩报头</para>
	    </listitem>

	    <listitem>
	      <para><option>noicmp</option> &mdash;禁用ICMP数据包
		(这样就会丢弃所有的<quote>ping</quote>数据包, 不占用您的带宽)</para>
	    </listitem>
	  </itemizedlist>

  	  <indexterm><primary>SLIP</primary></indexterm>
  	  <indexterm><primary>TCP/IP networking</primary></indexterm>
	  <para>对SLIP连接的本地及远程地址的选择取决是您是准备在SLIP服务器上使用 TCP/IP
	    子网还是使用<quote>ARP代理</quote> (它并不是<quote>真正的</quote>ARP代理, 而是我们在本节用于介绍的术语)。
	    如果您不能确定选择何种方式或者如何分配地址, 请参考"前提条件"(<xref linkend="slips-prereqs"/>)里列出的TCP/IP书籍
	    或者向您的IP网络管理员请教。</para>

	  <para>如果打算为您的 SLIP 客户使用一个独立的子网,
	    就需要先从分配得到的网络号中取出一个子网号,
	    然后再在这个子网里给每个 SLIP 客户分配 IP 地址。
	    接下来, 您还需要通过 SLIP 服务器在最近的 IP
	    路由器上配置一个指向 SLIP 子网的静态路由。</para>

  	  <indexterm><primary>Ethernet</primary></indexterm>
	  <para>如果要使用 <quote>代理 ARP</quote>
	    的方式, 您还需要从 SLIP 服务器的以太子网中为每个 SLIP 客户分配IP地址,
	    还必须修改<filename>/etc/sliphome/slip.login</filename><filename>/etc/sliphome/slip.logout</filename>脚本以使用
	    &man.arp.8;来管理在 SLIP
	    服务器 ARP 表中的 <quote>代理 ARP</quote> 项。</para>
	</sect4>

	<sect4>
	  <title><filename>slip.login</filename> Configuration</title>

	  <para>典型的<filename>/etc/sliphome/slip.login</filename>
	   如下所示:</para>

	  <programlisting>#!/bin/sh -
#
#       @(#)slip.login  5.1 (Berkeley) 7/1/90

#
# generic login file for a slip line.  sliplogin invokes this with
# the parameters:
#      1        2         3        4          5         6     7-n
#   slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
/sbin/ifconfig sl$1 inet $4 $5 netmask $6</programlisting>

	  <para>这个<filename>slip.login</filename>脚本仅仅为带有相应本地及远程地址和掩码的SLIP接口执行
	    <command>ifconfig</command></para>

	  <para>如果您决定使用<quote>ARP代理</quote>
	    方式(而非为您的SLIP客户使用独立的子网), 您的<filename>/etc/sliphome/slip.login</filename>
	   应该是这样:</para>

	  <programlisting>#!/bin/sh -
#
#       @(#)slip.login  5.1 (Berkeley) 7/1/90

#
# generic login file for a slip line.  sliplogin invokes this with
# the parameters:
#      1        2         3        4          5         6     7-n
#   slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
/sbin/ifconfig sl$1 inet $4 $5 netmask $6
# Answer ARP requests for the SLIP client with our Ethernet addr
/usr/sbin/arp -s $5 00:11:22:33:44:55 pub</programlisting>

	  <para><filename>slip.login</filename>新加的行<command>arp -s
	    &#36;5 00:11:22:33:44:55 pub</command> 在 SLIP 服务器的 ARP
	   表中加入了一个表项。 这个ARP项使得每当这个以太网上的其它
	   IP 节点对 SLIP 客户端 IP 地址进行 ARP 请求时,
	   SLIP 服务器会以自已的以太网MAC地址作为回应。</para>

  	  <indexterm>
            <primary>Ethernet (以太网)</primary>
            <secondary>MAC address (MAC 地址)</secondary>
          </indexterm>

	  <para>当使用以上的例子时, 一定要将
	  以太网MAC地址 (<hostid role="mac">00:11:22:33:44:55</hostid>)
            替换成您系统网卡的MAC地址, 否则<quote>ARP代理</quote>
            将完全无法工作! 您可以查看 <command>netstat -i</command>
            输出结果以取得以太网 MAC 地址; 输出的第二行应该是这样:</para>

	  <screen>ed0   1500  &lt;Link&gt;0.2.c1.28.5f.4a         191923	0   129457     0   116</screen>

	  <para>这行表明这个系统的以太网MAC地址是<hostid role="mac">00:02:c1:28:5f:4a</hostid>
	    &mdash;<command>netstat -i</command>输出的以太网MAC地址必须改成用冒号隔开, 并且要单个十六进数前加上。
	     这是&man.arp.8;要求的格式; 参考&man.arp.8; 的联机手册以获取完整的使用方法。</para>

	  <note>
	    <para>在编写
	      <filename>/etc/sliphome/slip.login</filename><filename>/etc/sliphome/slip.logout</filename> 时, 一定要设置
	      <quote>可执行</quote> (execute) 位 (换言之, <command>chmod 755
	      /etc/sliphome/slip.login /etc/sliphome/slip.logout</command>),
	      否则 <command>sliplogin</command>将无法执行它。</para>
	  </note>
	</sect4>

	<sect4>
	  <title><filename>slip.logout</filename>配置</title>

	  <para><filename>/etc/sliphome/slip.logout</filename>并不是必需的
	  (除非您使用了<quote>ARP代理</quote>), 如果您准备创建它, 这里有一个基本的
	  <filename>slip.logout</filename> 脚本的例子:</para>

	  <programlisting>#!/bin/sh -
#
#       slip.logout

#
# logout file for a slip line.  sliplogin invokes this with
# the parameters:
#      1        2         3        4          5         6     7-n
#   slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
/sbin/ifconfig sl$1 down</programlisting>

	  <para>如果使用了 <quote>代理 ARP</quote>,
	    则可能希望 <filename>/etc/sliphome/slip.logout</filename>
	    在用户注销时自动为 SLIP 客户端删除
	    ARP 项:</para>

	  <programlisting>#!/bin/sh -
#
#       @(#)slip.logout

#
# logout file for a slip line.  sliplogin invokes this with
# the parameters:
#      1        2         3        4          5         6     7-n
#   slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
/sbin/ifconfig sl$1 down
# Quit answering ARP requests for the SLIP client
/usr/sbin/arp -d $5</programlisting>

	  <para><command>arp -d &#36;5</command> 将删除由 <quote>代理 ARP</quote>
	    <filename>slip.login</filename> 在 SLIP 客户程序登录时所生成的
	    ARP 项。</para>

	  <para>再次强调: 建立
	    <filename>/etc/sliphome/slip.logout</filename> 之后,
	    一定要设置可执行位 (也就是说, <command>chmod 755
	    /etc/sliphome/slip.logout</command>)。</para>
	</sect4>
      </sect3>

      <sect3>
	<title>路由考虑</title>
	<indexterm>
    <primary>SLIP</primary>
    <secondary>routing</secondary>
  </indexterm>
	<para>如果没有使用 <quote>代理 ARP</quote> 的方法来在您的
	  SLIP 客户机和网络的其余部分 (也可能是 Internet)
	  之间路由数据包, 您可能需要增加离您最近的默认路由器的静态路由,
	  以便通过 SLIP 服务器来在 SLIP 客户机子网上进行路由。</para>

	<sect4>
	  <title>静态路由</title>
	  <indexterm><primary>static routes</primary></indexterm>

	  <para>向您最近的默认路由添加一个静态路由可以说是很麻烦
	    (或者说是不可能, 如果您没有权限这么做)。 如果在您的组织中使用多路由器网络,
	    有些路由器 (比如 Cisco 和 Proteon 生产的) 不但要配置指向 SLIP
	    子网的路由, 而且还需要配置将哪些静态路由传给其它的路由器。
	    所以一些专家意见和问题解答对于使基于静态路由表的路由正常工作很有必要。</para>
	</sect4>
      </sect3>
    </sect2>
  </sect1>
</chapter>