?? the network.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0066)http://www.geocities.com/marco_corvi/games/lkpe/socket/network.htm -->
<HTML><HEAD><TITLE>The Network layer</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK
href="The Network_file/style.css" rel=stylesheet>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<H2>Networking</H2>
<P>
<DIV>References:<BR>G. Herrin, <I>Linux IP Networking</I>, 2000, available on <A
href="http://www.kernelnewbies.org/"
target=_top>http://www.kernelnewbies.org/</A><BR>
<P></P></DIV>
<DIV>This section summarizes the network configuration of a Linux system. In
order to configure the networking one need to set up a few scripts and files,
besides having the proper support compiled in the kernel or as module (but this
is ususally the case). </DIV>
<DIV>An isolated host usually has only the <I>loopback</I> interface (IP
127.0.0.1), and can have a temporary </I>ppp</I> interface when it dials up
</DIV><BR clear=all><IMG height=520 src="The Network_file/ifconfig.gif"
width=400> <BR clear=all>
<P><BR clear=all>
<DIV><B>ppp connection</B><BR>To set up a <I>ppp</I> connection start the pppd
daemon with the "connect" option and a suitable chat script; for example, <BR><PRE> /usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/chat-isp ' \
user marco_corvi@geocities.com -d -detach &
</PRE><BR>The pppd deamon is passed the the command "connect" which takes the
script to execute for the connection. The option "-detach" tells the deamon to
go in background. The command "user" sets the username used for authenticating
with the peer. The options of "chat" specify the verbose mode, and the chat file
to use. This file must contain the information to dial up your ISP with your
modem. For example, I have <BR><PRE> ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
ABORT "BUSY"
ECHO OFF
SAY "Dialing your ISP ... \n"
"" "at"
OK "atz1"
OK "atdt<ISP_NUMBER>"
TIMEOUT 60
SAY "Waiting up to one minute ... \n"
ECHO ON
CONNECT ""
</PRE><BR>The The interface will have the name of the pidfile /var/run/ppp*.pid
which contains the pid of the deamon. The interface configuration can be seen
with the command <BR><PRE> /sbin/ifconfig ppp_interface
</PRE><BR>The pppd deamon executes a few additional scripts:
<UL>
<LI>/etc/ppp/ip-up, invokes ifconfig to add the ppp interface to the network.
Your custom commands should be added into /etc/ppp/ip-up.local.
<LI>/etc/ppp/ip-down, calls ifconfig to remove the ppp interface from the
network. Again, /etc/ppp/ip-down.local is the place for custom commands. For
example i have a script that writes data for the statistics of the connection
to a log-file. </LI></UL>
<P>Finally pppd uses an configuration file, /etc/ppp/options, which specifies
all the other options. Here is an example, <BR><PRE># /etc/ppp/options
#
/dev/cua1 # device (should try /dev/ttyS1)
# /dev/modem
57600 # speed (try 115200 !!!)
debug # debugging messages
lock # lock the device
modem # use modem control lines (CD): this is the default
# local # do not use modem contro lines (ignore CD)
hide-password # do not show password in syslog
logfile /etc/ppp/ppp.log # logfile for stat purposes
# record /etc/ppp/ppp.rec # record file for pppdump (must try)
crtscts # hw flow control
defaultroute # `route add default`
noipdefault # () disable local ip from hostname: peer must supply it
# see local_ip_address:remote_ip_address option
# usepeerdns # use if the provider does not supply DNS
# see /etc/resolv.conf
# allow-ip * # allow any ip_addr for the peer (w/o authentication)
asyncmap 0 # () no obsolete byte escaping
# mtu 552 # (can leave it disabled)
# mru 552 # (can leave it disabled: default 1500)
idle 180 # disconnect if we do not do anything for three minutes
deflate 15,15 # request peer deflate compresion (value range 8-15)
# must have kernel module for BSD compression
bsdcomp 15,15 # request peer bsd compression (value range 9-15, 15 max)
# pppd second choice (see man pppd)
# must have kernel module for BSD compression
predictor1 # request peer predictor-1 compression
# no effect unless kernel module supported
vj-max-slots 16 # number of VJ TCP/IP header compression slots (max 16)
</PRE>
<P>Last the /etc/ppp/pap-secrets file should contain your login data (so it
should be readable only by root), <BR><PRE>
# Secrets for authentication using PAP
# client server secret IP addresses
marco_corvi@geocities.com * my_password
</PRE><BR>
<P>To terminate the connection send a SIGHUP to the pppd deamon, <BR><PRE> kill -HUP ppd_pid
</PRE></DIV>
<P><B>Exercise</B><BR>
<DIV>[to do] </DIV>
<P><BR clear=all><FONT size=-1>Marco Corvi - 2003</FONT> <!-- text below generated by server. PLEASE REMOVE --></OBJECT></LAYER>
<DIV></DIV></SPAN></STYLE></NOSCRIPT></TABLE></SCRIPT></APPLET>
<SCRIPT
language=JavaScript>var PUpage="76001084"; var PUprop="geocities"; </SCRIPT>
<SCRIPT language=JavaScript src="The Network_file/pu5geo.js"></SCRIPT>
<SCRIPT language=JavaScript src="The Network_file/ygIELib9.js"></SCRIPT>
<SCRIPT language=JavaScript>var yviContents='http://us.toto.geo.yahoo.com/toto?s=76001084&l=NE&b=1&t=1057746969';yviR='us';yfiEA(0);</SCRIPT>
<SCRIPT language=JavaScript src="The Network_file/mc.js"></SCRIPT>
<SCRIPT language=JavaScript src="The Network_file/geov2.js"></SCRIPT>
<SCRIPT language=javascript>geovisit();</SCRIPT>
<NOSCRIPT><IMG height=1 alt=setstats src="The Network_file/visit.gif" width=1
border=0></NOSCRIPT> <IMG height=1 alt=1 src="The Network_file/serv.gif"
width=1> <!-- w42.geo.scd.yahoo.com compressed/chunked Wed Jul 9 03:36:09 PDT 2003 --></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -