>On Wed, Dec 16, 1998 at 01:19:41PM -0800, Ian Eure wrote: >> Ok. Let's say I have a linux box on an ethernet. It's ip is >> 192.168.111.55. The router on the ethernet is 192.168.111.1. Let's say I >> have a web server on 192.168.111.55, accessible from outside my local >> network.
I'm assuming that you know that 192.168.*.* isn't supposed to be accessible from outside of anything. Hopefully, you're just using these addresses for the sake of illustration. >> Let's further say that I set up ppp the way you described, with... 192.168.111.0/24 -> eth0 0.0.0.0 -> ppp0 okay... gotcha... >> What happens when a request >> for a web page comes in? Does the page get sent back from the ethernet >> interface, with the ip 192.168.111.55, or through the ppp0 interface >> with the dynamic address of the dialup? I'm assuming you're asking about the request coming in from over the ppp link, right? >From what I have been able to figure out, Linux cares very little about what interface a packet came in through or what the IP's of that interface are. It seems to only care that it now has a packet that it has to do something with. If the destination address matches an address of one of its own interfaces, it seems to keep it. (In other words, if you have two interfaces like eth0 and eth1... and you get a packet through eth0 that is addressed to eth1's IP address, Linux will keep it anyway. What this means is that you could *probably* do the same thing as IP aliasing by creating a bunch of loopback interfaces... and then just do a little trickery with the arp command.... but I digress...). If Linux does *not* have an interface with an IP that matches the destination of the packet (and probably also depending upon whether you have some kernel options installed... like IP forwarding or something), Linux will look through the routing tables to see where to send it. When looking through the tables to see where to send it, it will go with the closest match. Usually, "closest match" is pronounced "longest subnet mask". :) The default route is the worst match. In the case you mention, you've got 192.168.111.0/24 routing to your eth0, and the default goes to your ppp0. If the linux box sees a packet come in on ppp0 destined for, say, 192.168.111.55, the closest match is the one for your eth0, so that's where it's going to go. The only time your Linux box should bounce stuff right back through the ppp0 is if it gets a packet addressed to something other than 192.168.111.*. In that case, packets would be being sent to and fro across the ppp link for no reason... just eating bandwidth... which could be a fun prank to pull on a friend if you could figure out how to pull it off. :) - Joe