PPP HOWTO ¤¤Ä¶ª© : «Ø¥ß³sµ²¤§«á - /etc/ppp/ip-up «ü¥O½Z
Previous: ¨Ï¥Î PPP ³sµ²¨â­Óºô¸ô
Next: ¨Ï¥Î /etc/ppp/ip-down

23. «Ø¥ß³sµ²¤§«á - /etc/ppp/ip-up «ü¥O½Z

¤@¥¹ PPP ³sµ²«Ø¥ß«á¡A pppd ·|§ä´M /etc/ppp/ip-up «ü¥O½Z¡D ¦pªG³o­Ó«ü¥O½Z¦s¦b¨Ã¥B¥i¥H°õ¦æªº¸Ü¡A¨º»ò PPP ¦øªAµ{¦¡´N·|°õ¦æ³o­Ó«ü¥O½Z¡D ³o¤¹³\§A¦Û°Ê°õ¦æ¥ô¦ó¥i¯à¦³¥²­nªº¯S®í»¼°e¸ô®|«ü¥O¤Î¥ô¦ó§A·Q¦b¨C¦¸ PPP ³sµ²±Ò°Ê®É°õ¦æªº°Ê§@¡D

³o¤£¹L´N¬O¤@¯ë´¶³qªº shell «ü¥O½Z¡A¥i¥H°µ¥ô¦ó«ü¥O½Z¯à°µªº¨Æ(¤]´N¬O¡A¥ô¦ó§A·Q°µªº¨Æ)¡D

¨Ò¦p¡A§A¥i¯à·Q­n sendmail »°§Ö³B²z¦b¶l¥ó¦î¦C¤¤µ¥«Ý¥~°eªº°T®§¡D

Ãþ¦ü¦a¡A§A¥i¥H¦b ip-up ¸Ì´¡¤J¤@¨Ç«ü¥O¨ú±o¡]¨Ï¥Î POP¡^¦b§Aªº ISP ¨ºÃäµ¥µÛ§Aªº¥ô¦ó¹q¤l¶l¥ó¡D

¤£¹L¦b /etc/ppp/ip-up ¤]¦³¨Ç­­¨î:-

23.1. ¯S®í»¼°e¸ô®|

¦pªG§A³sµ²ªº¬O¨â­Ó°Ï°ìºô¸ô¡A§A±N±o³]¥ß¤@­Ó¨ì '¥~­±ªº' °Ï°ìºô¸ôªº«ü©w»¼°e¸ô®|¡D ³o¥i¥H«Ü®e©öªº¨Ï¥Î /etc/ppp/ip-up «ü¥O½Z¹F¦¨¡D°ß¤@ªº§xÃøµo¥Í¦b§Aªº¾÷¾¹¦³¦h­Ó PPP ³sµ²®É¡D

³o¬O¦]¬° /etc/ppp/ip-up ³o­Ó«ü¥O½Z¬O¥Ñ¨C¤@­Ó°_°Êªº ppp ³s½u©Ò°õ¦æªº¡A©Ò¥H§A±o­n¤p¤ß¦a¬°¨C¤@­Ó°_°Êªº³sµ²°õ¦æ¥¿½Tªº»¼°e«ü¥O!

23.2. ³B²z¹q¤l¶l¥ó¦î¦C

·í¨â­Ó°Ï°ìºô¸ôªº³sµ²«Ø¥ß¤§«á¡A§A¥i¯à·Q­n½T©w©ñ¦b¦î¦C¤¤ªº¹q¤l¶l¥ó³Q²M¥X - °e¨ì¥¦ªº¥Øªº¦a¡D ³o¥i¥H¥Î¾A·íªº©I¥s sendmail ¨Ó¹F¦¨¡D

¦b pppd ¶Ç»¼µ¹«ü¥O½Zªº¯S©w°Ñ¼Æ¤W¨Ï¥Î bash ªº `case' ±Ô­z¨Ó§¹¦¨³o­Ó¤u§@¡D ¨Ò¦p¡A³o¬O§Ú¥Î¨Ó³B²z§Ú­Ìªº¼s°ìºô¸ô³sµ²¤Î³q©¹§Ú®a¤A¤Óºô¸ôªº¡]¤]¬O¥Ñ¬Û¦Pªº PPP ¦øªA¾¹³B²z¡ /etc/ppp/ip-up «ü¥O½Z¡D

23.3. ¤@­Ó /etc/ppp/ip-up «ü¥O½Zªº¨Ò¤l

¤U­±ªº¨Ò¤l´£¨Ñ¤£¦Pªº¨Ï¥Î½d¨Ò¡D


#!/bin/bash
#
# Script which handles the routing issues as necessary for pppd
# Only the link to Newman requires this handling.
#
# When the ppp link comes up, this script is called with the following
# parameters
#       $1      the interface name used by pppd (e.g. ppp3)
#       $2      the tty device name
#       $3      the tty device speed
#       $4      the local IP address for the interface
#       $5      the remote IP address
#       $6      the parameter specified by the 'ipparam' option to pppd
#
case "$5" in
# Handle the routing to the Newman Campus server
        202.12.126.1)
                /sbin/route add -net 202.12.126.0 gw 202.12.126.1
# and flush the mail queue to get their email there asap!
		/usr/sbin/sendmail -q &
                ;;
	139.130.177.2)
# Our Internet link
# When the link comes up, start the time server and synchronise to the world
# provided it is not already running
                if [ ! -f /var/lock/subsys/xntpd ]; then
                        /etc/rc.d/init.d/xntpd.init start &
                fi
# Start the news server (if not already running)
                if [ ! -f /var/lock/subsys/news ]; then
                        /etc/rc.d/init.d/news start &
                fi
                ;;
	203.18.8.104)
# Get the email down to my home machine as soon as the link comes up
# No routing is required as my home Ethernet is handled by IP
# masquerade and proxyarp routing.
		/usr/sbin/sendmail -q &
		;;
        *)
esac
exit 0

°_°Ê³q©¹§Ú­Ì Newman ®Õ¶éªº ppp ³sµ²¥H¤Î³o­Ó«ü¥O½Zªºµ²ªG¡A§Ú­Ì³Ì«á±o¨ì¤U­±³o­Ó»¼°eªí®æ°O¿ý¡]³o¥x¾÷¾¹¤]¬O§Ú­Ì³q±`¥Îªº PPP ¦øªA¾¹¨Ã¥B³B²z§Ú­Ìªººô»Úºô¸ô³sµ²¡^¡D §Ú¤w¸g¦b³o­Ó¿é¥X¸Ì¥[¤J¤@¨Çµù¸Ñ¥H¸ÑÄÀ¨C­Ó¶µ¥Ø¬O¤°»ò:


[root@kepler /root]# route -n
Kernel routing table
Destination     Gateway         Genmask         Flags MSS    Window Use Iface
# the HOST route to our remote internet gateway
139.130.177.2   *               255.255.255.255 UH    1500   0      134 ppp4
# the HOST route to our Newman campus server
202.12.126.1    *               255.255.255.255 UH    1500   0       82 ppp5
# the HOST route to my home ethernet
203.18.8.104    *               255.255.255.255 UH    1500   0       74 ppp3
# two of our general dial up PPP lines
203.18.8.64     *               255.255.255.255 UH    552    0        0 ppp2
203.18.8.62     *               255.255.255.255 UH    552    0        1 ppp1
# the specific network route to the Newman campus LAN
202.12.126.0    202.12.126.1    255.255.255.0   UG    1500   0        0 ppp5
# the route to our local Ethernet (super-netting two adjacent C classes)
203.18.8.0      *               255.255.254.0   U     1500   0     1683 eth0
# the route to the loop back device
127.0.0.0       *               255.0.0.0       U     3584   0      483 lo
# the default route to the Internet
default         139.130.177.2   *               UG    1500   0     3633 ppp4

23.4. ³B²z¹q¤l¶l¥ó

¤W¤@¸`´£¤Î¦p¦ó³B²z¥~°eªº¶l¥ó ¡Ð ¤@¥¹³s½u«Ø¥ß¤§«á²³æ¦aÂǥѲM¥X¶l¥ó¦î¦C¹F¦¨¡D

¦pªG§A°õ¦æ³s©¹¼s°ìºô¸ôªº³sµ²¡A§A¥i¥H¸ò»·ºÝ°Ï°ìºô¸ôªººô¸ôºÞ²zªÌ¨ó½Õ½Ð¥¦­Ì°õ¦æ§¹¥þ¬Û¦Pªº°Ê§@¡D ¨Ò¦p¡A¦b§Ú­Ìªº¼s°ìºô¸ô³sµ²¤¤ Newman ®Õ¶é¨º¤@ºÝªº /etc/ppp/ip-up «ü¥O½Z¬Ý°_¨Ó¹³:


#!/bin/bash
#
# Script which handles the routing issues as necessary for pppd
# Only the link to Hedland requires this handling.
#
# When the ppp link comes up, this script is called with the following
# parameters
#       $1      the interface name used by pppd (e.g. ppp3)
#       $2      the tty device name
#       $3      the tty device speed
#       $4      the local IP address for the interface
#       $5      the remote IP address
#       $6      the parameter specified by the 'ipparam' option to pppd
#
case "$5" in
        203.18.8.4)
                /usr/sbin/sendmail -q
                ;;
        *)
esac
exit 0

µM¦Ó¦pªG§A¥u¯à¨Ï¥Î°ÊºA IP ¸¹½X¤è¦¡ªº PPP ³s½u³s©¹§Aªº ISP¡A§A±o±q¦b§A ISP ¾÷¾¹¤Wªº±b¸¹¨ú±o§Aªº¹q¤l¶l¥ó¡D ³o³q±`¬O¨Ï¥Î POP(Post Office Protocol)¨ó©w¨Ó¹F¦¨ªº¡D¥i¥H¨Ï¥Î `popclient' µ{¦¡³B²z³o­Óµ{§Ç ¡Ð ¦Ó ip-up «ü¥O½Z¤]¥i¥H¬°§A¦Û°Ê¤Æ³o­Óµ{§Ç¡D

²³æ¦a«Ø¥ß¤@­Ó /etc/ppp/ip-up «ü¥O½Z¡A¨ä¤¤¥]§t¦³°_°Ê popclient µ{¦¡ªº¾A·í«ü¥O¡D ¦b§Ú°õ¦æ Red Hat Linux ªº½¥¤W«¬¹q¸£¤W¡]¥ô¦ó®È¦æ®É§Ú³£±aµÛ¥¦¡^¬O³o¼Ëªº


popclient -3 -c -u hartr -p <password> kepler.hedland.edu.au |formail -s procmail

§A¥i¥H¨Ï¥Î slurp ©Î¨ä¥¦³nÅé¥H¬Û¦Pªº¤è¦¡¨ú±oºô¸ô·s»D¡A¥H¤Î½Ñ¦p¦¹ÃþªºªA°È¡D °O±o¡Aip-up ³o­Ó«ü¥O½Z¥u¬O­Ó¼Ð·Çªº bash «ü¥O½Z¦]¦¹¥i¥H¥Î¨Ó¦Û°Ê¤Æ·í¨C¦¸¾A·íªº PPP ³sµ²«Ø¥ß®É»Ý­n§¹¦¨ªº¥ô¦ó¥\¯à¡D


PPP HOWTO ¤¤Ä¶ª© : «Ø¥ß³sµ²¤§«á - /etc/ppp/ip-up «ü¥O½Z
Previous: ¨Ï¥Î PPP ³sµ²¨â­Óºô¸ô
Next: ¨Ï¥Î /etc/ppp/ip-down