Computer Tips - How does a packet know how to get to the internet?

Date: 2016feb25 OS: Linux Level: beginner Q. How does a packet know how to get to the internet? A. You can list the routing table with the route command:
route
Example output:
Destination Gateway Genmask Flags Metric Ref Use Iface default my-router 0.0.0.0 UG 100 0 0 enp2s0 192.168.50.0 0.0.0.0 255.255.255.0 U 100 0 0 enp2s0
Or without resoluving the IP-addesses:
route -n
Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.50.1 0.0.0.0 UG 100 0 0 enp2s0 192.168.50.0 0.0.0.0 255.255.255.0 U 100 0 0 enp2s0