We know the host needs to be within the same subnet as its gateway for the routing. However in PPPoE, the public IP has a 255.255.255.255 subnet mask, it means that the IP is not in the same subnet as the gateway. I wonder how the host passes the packet to the gateway in this case? Many thanks!
-
Thanks guys. Say after the pppoe is established. My public ip is 31.54.35.62, the public default gateway is 172.16.10.3, I want to ping another public ip address 5.8.2.3, what is the data flow? 31.54.35.62 -> 172.16.10.3 -> ... ->5.8.2.3 -> ... -.172.16.10.3 -> 31.54.35.62?– Anning WuwangSep 8, 2021 at 21:52
-
Need to correct myself... 172.16.10.3 is not a public IP, it's in IANA private range, and private ranges cannot be visible to the Internet. There is no way packet could go directly from 172.x.x.x to 31.x.x.x; there's a NAT in between. Data flow from device to device is your workstation -> your gateway (router/modem) -> ISP PPPoE box -> some routers -> target; and back in the reverse order.– Peregrino69Sep 8, 2021 at 23:19
3 Answers
PPP generally establishes a point-to-point link (or session), with exactly two link partners. Everything one of them sends the other receives, no matter what addresses are used on top of the PPP level.
Since Ethernet requires valid MAC addressing (on the data link layer), PPPoE establishes a PPP session over Ethernet, ie. between two link partners. That PPPoE session is entirely independent from anything else that might be running on the Ethernet network - especially 'normal' IPv4 over Ethernet using ARP.
As to routing, the default route can simply point to the PPP interface, indicating that all packets are simply sent out of that interface. The default gateway is 'the next hop beyond'.
On Ethernet, the distinction (or multiplexing) is done using dedicated EtherType values for PPPoE (0x8863
/0x8864
) instead of IPv4's 0x0800
. That way, the network stack doesn't pass the frames to the IP stack but to the PPPoE driver (which in turn may or may not pass extracted PPP frames to the IP stack or any other supported L3 stack).
Because it's POINT-TO-POINT. Traffic only has one place to go... the other side of the link. /32 routes are added to the route table indicating what is on the other side. One could also just use an interface route. (But a lot of host OSes have trouble with those. And it leads to confusion when people don't understand this.)
-
3For the record, p-t-p links don't have to have addresses. I've setup many T1's as unnumbered interfaces. (internally, Cisco does assign them a number, but that's an artifact of how IOS does (did?) things.)– RickySep 8, 2021 at 19:07
-
2
I'm not sure if I understand your question.
255.255.255.255 translates to "This device, and only this device". Or maybe "this interface" is a better expression. It's not part of any network, so it has no gateway. The IP isn't "public" either in the sense that you could reach it from the inertnets, it's exclusively used in a closed peer-to-peer circuit like DSL.
Let's say your ISP:s "public" address is 192.51.100.1/32 (255.255.255.255). They don't provide you an address range, they provide you a single IP address, let's say 192.0.2.25. I don't have a PPPoE line, so I can't check, but logic says this is also a /32 address - there's really no reason for it not to be. That address would be assigned to the modem's PPPoE interface.
Your modem provides internal IP addressing in the range of 192.168.0.0/24 and reserves 192.168.0.1 for itself to be provided as a default gateway. Any traffic your PC wants to send to the internyet it will send to the modem. The modem NATs the traffic, so the ISP only receives traffic originating from a single host, 192.0.2.25.
Whether your modem has a default route to 192.51.100.1 or if 192.51.100.1 is assigned as a default gateway doesn't change how it forwards the traffic. Anything destined outside of 192.168.0.0/24 will be sent to 192.51.100.1. The ISPs router likely does have a routing table entry; "send all traffic to 192.0.2.25 directly to it" - it knows the host is reachable through the PPPoE link.
So the only place where "gateway" enters the picture in any meaningful sense is your home network.
I hope this helps a bit. I admit I'm not an expert on PPPoE, so I can only try to explain this on conceptual level as I understand it. I'm sure more knowledgeable members of the community will point out my mistakes :-)