Internet inteface switch

Stefan Bruda yellowdog-general@lists.terrasoftsolutions.com
Sun Jun 1 12:05:00 2003


Hi.

At 19:17 +0200 on 2003-6-1 Thomas wrote:
 >
 > This is my interface configuration and pinging over both interfaces work
 > fine.

It is not clear to me, but I will assume that the box you are talking
about is between others the router for some other machines, and that
those machines connect to eth0 and/or eth1 whilst the router should
use ppp0 for connections to the outside world.

 > How to tell the system to use ppp0 to connect to the internet? Do I have
 > to setup a router? Do I have to setup IP Masquerading?

Assuming the above scenario, yes, you need masquerading on the router.

As for the connection to the outside world through ppp0, this is
accomplished by default by the negociating phase of the PPP session.
It appears from your post that it doesn't, which means that, when
brought up, eth0 or eth1 or both insist in defining their own default
routes.

The first idea that comes to mind to remedy this situation is through
shell commands.  Try this:

On the router, shut down ethX interfaces (ifconfig ethX down).  You
should be able then to ping outside world machines without providing
the interface (e.g., ping 213.148.130.10).

Bring eth0 back up.  Let's say you use the same IP address
(192.168.0.201) for your router on the local network.  Do then

    ifconfig eth0 192.168.0.201

and then say that the route to your home subnet should go through eth0
by doing:

    route add -net 192.168.0.0 netmask 255.255.255.0 eth0

On the other machines you would do:

    route add -net 192.168.0.0 netmask 255.255.255.0 eth0
    route add default gw 192.168.0.201 eth0

(assuming they connect through eth0, change as appropriate).  You will
have then to enable IP forwarding on the router and set up the
iptables/ipchains (as appropriate) firewall.  See the masquerading
howto (http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/index.html), and
especially Section 3 for details.

Hope this helps.  If more information is needed, contact me off list
or better yet take a look at the Net howto
(http://www.tldp.org/HOWTO/Net-HOWTO/index.html) which explain things
in quite a satisfactory manner.

Stefan

-- 
If it was so, it might be; and if it were so, it would be; but as
it isn't, it ain't. That's logic.
    --Lewis Carroll, Through the Looking-Glass