This question has been asked on the net before but the answers are simply not convincing or even accurate. I get the following output for ifconfig for the ppp0 device (of course, x, y, a, b are integers).
ppp0 Link encap:Point-to-Point Protocol
inet addr:x.y.172.234 P-t-P:a.b.145.65 Mask:255.255.255.255
PLEASE CORRECT ME IF THE FOLLOWING UNDERSTANDING IS WRONG I am trying to understand the theory behind it. x.y.172.234 is the public Internet address of the machine. So, all packets leaving the machine will have this as the SRC IP.
And my reading tells me that the a.b.145.65 is the default gateway address. So, all packets will unconditionally be sent out to be routed via this address (other than loopbacks).
But there is one device. Is it assigned multiple addresses? If so, how? Do I need to read on the PPPoE protocol to understand this?
If I connect a switch to this machine with a eth0 port and want to use this machine as a firewall using IPTables, then for machines on the internal LAN, what will be the default gateway address? the IP address assigned on Eth0? And then packets coming on Eth0 are then NATed and if not for the firewall are sent to which address? the a.b... address or the x.y..... address? Kind of gets confusing here.
Any clarification will be appreciated.
Thanks