old-www/HOWTO/PPP-HOWTO/ip-up.html

242 lines
3.9 KiB
HTML

<HTML
><HEAD
><TITLE
>After the link comes up - the /etc/ppp/ip-up script</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.52"><LINK
REL="HOME"
TITLE="Linux PPP HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Network security"
HREF="x1418.html"><LINK
REL="NEXT"
TITLE="Handling email queues"
HREF="x1448.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><A
HREF="http://www.linuxports.com/howto/ppp"
TARGET="_top"
>Linux PPP HOWTO</A
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x1418.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x1448.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="IP-UP"
>Chapter 25. After the link comes up - the <TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
> script</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>25.1. <A
HREF="ip-up.html#AEN1442"
>Special routing</A
></DT
><DT
>25.2. <A
HREF="x1448.html"
>Handling email queues</A
></DT
><DT
>25.3. <A
HREF="x1455.html"
>A sample <TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
> script</A
></DT
><DT
>25.4. <A
HREF="x1464.html"
>Handling email</A
></DT
></DL
></DIV
><P
>Once the PPP link is established, pppd looks for
<TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
>. If this script exists and is executable, the
PPP daemon executes the script. This allows you to automate any special
routing commands that may be necessary and any other actions that you
want to occur every time the PPP link is activated.</P
><P
>This is just a shell script and can do anything that a shell script can
do (i.e. virtually anything you want).</P
><P
>For example, you can get sendmail to dispatch any waiting outbound
messages in the mail queue.</P
><P
>Similarly, you can insert the commands into ip-up to collect (using pop)
any email waiting for you at your ISP.</P
><P
>There are restrictions on <TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
>:-</P
><P
>&#13;<P
></P
><UL
><LI
><P
>It runs in a deliberately restricted environment to enhance
security. This means you must give a full path to binaries etc.</P
></LI
><LI
><P
>Technically, <TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
> is a <I
CLASS="EMPHASIS"
>program</I
> not a
script. This means it can be directly executed - and hence it requires
the standard file magic (<TT
CLASS="LITERAL"
>#!/bin/bash</TT
>) at the start of the first line and must be
readable and executable by root.</P
></LI
></UL
>&#13;</P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1442"
>25.1. Special routing</A
></H1
><P
>If you are linking two LANs, you will need to set up specific routes
to the 'foreign' LANs. This is easily done using the <TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
>
script. The only difficulty arises if your machine handles multiple PPP
links.</P
><P
>This is because the <TT
CLASS="LITERAL"
>/etc/ppp/ip-up</TT
> is executed for EVERY ppp
connection that comes up, so you need to carefully execute the correct
routing commands for the particular link that comes up - and not when
any other link comes up!</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x1418.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x1448.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Network security</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Handling email queues</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>