NetBSD-Users archive

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

Re: Routing ppp (Was: Getty on USB serial port)



On Sat, Sep 16, 2017 at 02:28:00PM -0400, William D. Jones wrote:

> However, while researching how Point-to-Point Protocol works (ppp) I
> realized that ppp is a layer 2 protocol, like Ethernet (incompatible).
> Furthermore, ppp has no concept of a gateway or `defaultroute`, b/c the
> protocol itself, well, only connects two devices. There's no way to contact
> the gateway like w/ Ethernet b/c there's no way to encapsulate an alternate
> identifier for the remote device like there is w/ Ethernet (MAC address).

PPP is layer2 and tunnels layer 3 (IP). The defaultroute option makes it
configure a layer 3 default route.


> It makes sense to require a `defaultroute`/routing table entry to talk to
> external devices. However, when I run `tcpdump -i ppp0`, in response to
> `ping 192.168.1.1` on my Pi, I get the following output. NetBSD is
> attempting to contact the remote host directly, as it would with Ethernet.
>
> ```
> 01:32:38.602356 IP: IP 192.168.1.165 > 192.168.1.1: ICMP echo request, id
> 11861, seq 152, length 64
>
> 01:32:39.603053 IP: IP 192.168.1.165 > 192.168.1.1: ICMP echo request, id
> 11861, seq 153, length 64

This only shows layer 3 information, the packet includes the layer 3
source and destination addresses that do not change.

On ethernet, the packet would be sent to the layer 2 address of the
gateway. On ppp, there is no explicit layer 2 address as their is
only a single peer to sent the packet to.


> This suggests to me that NetBSD is trying to embed information like a MAC
> address to get the gateway (my Beagleboard running pppd) to forward the
> packet to the next location on my local network instead of using the
> gateway's IP address.

Sort of, except for PPP you don't need a "MAC address", any packet
sent through the point-to-point link will reach the one and only peer.


> Is there a rationale for NetBSD trying to access the
> dev this way? If so, why does NetBSD think it can reach the remote device
> (in other words, use the route I provided) using ppp at all?

Any system using TCP/IP will do that. On layer 3 it decides what interface
to use to send a packet, chosing the most specific route:

> Internet:
> Destination        Gateway            Flags    Refs      Use    Mtu
> Interface
> default            192.168.1.164      UGS         -        -      -  ppp0
> 127/8              127.0.0.1          UGRS        -        -  33180  lo0
> 127.0.0.1          lo0                UHl         -        -  33180  lo0
> 192.168.1.164      192.168.1.165      UH          -        -      -  ppp0
> 192.168.1.165      ppp0               UHl         -        -      -  lo0

With that table, packets sent to 192.168.1.1 have to use the default
route via ppp0, while e.g. packets sent to 127.1.2.3 or 192.168.1.165
are sent via lo0.



Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index