[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SOLVED: eth0 and ppp0: how to setup routing?



Your assumption was right. My main mistake was to think that "rout add
default" means as much as "everything should go here", where in fact it
means "everything not already going elsewhere should go here", and
"elsewhere" is defined by any "route add -net" lines. The solution I
chose was to restore the "GATEWAY=" line, copy the script, comment out
the last two lines in the copy, rename the first script to
"network.office" and the second script to "network.home". I let a
symbolic link "network" point to whichever script I need. To me, this
is sufficiently "plug&play" since I do not expect to need the modem when
I'm at the office.

By the way: I should have read the NET-3-HOWTO first. I like to thank
the people who answered my question!

Ruud. 

Helge Hafting wrote:
> 
> In <[🔎] 35D3F708.2781E494@ipo.tue.nl>, on 08/14/98
>    at 10:36 AM, Ruud Janssen <janssen@ipo.tue.nl> said:
> 
> >Hi,
> 
> >I have both a 3COM Etherlink III (device eth0) and a standard 28.8K
> >modem (device ppp0). I used the Etherlink III (connected to the network
> >at the office) to download and install Debian Hamm. This goes really
> >fast, so I want to keep the network setup I made during the install for
> >major upgrades of Debian in the future.
> 
> >At home I can only use the modem. I used pppconfig to setup dialup PPP,
> >but I've run into this problem: pppd will not replace the existing
> >default route. I checked the PPP-HOWTO, which tells me that the default
> >route is already pointing at the eth0 device. A "route add default..."
> >command in the system's startup scripts is responsible for this. I found
> >this command in /etc/init.d/network:
> 
> >#! /bin/sh
> >ifconfig lo 127.0.0.1
> >route add -net 127.0.0.0
> >IPADDR=[deleted]
> >NETMASK=255.255.255.0
> >NETWORK=[deleted]
> >BROADCAST=[deleted]
> >GATEWAY=[deleted]
> >ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST} route
> >add -net ${NETWORK}
> >[ "${GATEWAY}" ] && route add default gw ${GATEWAY} metric 1
> 
> >My primitive solution was to comment out the GATEWAY= line.
> 
> >This works, but only partially. I am able to connect to hosts using
> >ppp0, but I can only connect to hosts which are *not* part of the domain
> >at the office. It seems that routing to these hosts is still going
> >through the eth0 device.
> 
> >I really want to be able to connect to hosts at the office using ppp0,
> >since I often transfer files between home and the office. Can anyone
> >tell me how to solve this situation, preferably in such a way that the
> >eth0 configuration is still intact (to retain a "plug&play" ethernet
> >connection when I'm at the office)?
> 
> >Thank you,
> 
> >Ruud Janssen
> 
> I believe the "route add -net ${NETWORK}" command set up your office route
> explicitly. (The numbers in NETWORK match your office net, doesn't it?)
> 
> If my assumption is correct then you need to comment out that line too.
> If that doesn't help, try "ifconfig eth0 down" This turns off the
> ethernet.  (Do a "ifconfig eth0 up" to restore it.)  An explicit "route"
> command may not be necessary, linux may be "smart" enough to know where to
> send packets based on the eth0 device's IP-address.  This is solved by
> turning the interface off.  If that doesn't help, try commenting out the
> line or "misconfigure" it to an address on a non-existing  network such as
> 0.0.0.0
> 
> For painless switching consider making two separate scripts.
> One for home use - this will set the default route through ppp0, and also
> delete the routes to the ethernet.
> 
> The office script should do the reverse, set up routes for the eth0 device
> and delete any routes to ppp0
> 
> These scripts will can then be used for switching back and forth between
> the interfaces without booting.  Let the system startup script run the
> home script (assuming that you usually are located at home.)
> 
> Existing routes may be deleted by the command "route delete ...." or
> similiar. See the man pages for details on the route and ifconfig command
> syntax.
> 
> Helge Hafting
> 
> --
> -----------------------------------------------------------
> helge.hafting@daldata.no
> -----------------------------------------------------------

-- 
-------------------------------------------------------
  Ruud Janssen

  IPO, Center for Research on User-System Interaction
  Eindhoven University of Technology
  P.O. Box 513
  5600 MB Eindhoven
  The Netherlands

  Tel: +31 40 247 5206
  Fax: +31 40 243 1930

  mailto:janssen@ipo.tue.nl
  http://www.tue.nl/ipo/
-------------------------------------------------------


Reply to: