Default Gateway and Proxy Servers
- A default gateway is a node in your local network that other nodes in your local network use to communicate outside, with the general internet.
- Usually, the default gateway is a router.
- However, you can make any node in your local network the default gateway, simply set the ‘default gateway’ OS level setting of the other nodes to point to the IP of this node.
- A proxy server is similar to a default gateway, but it generally only handles HTTP(S) traffic, and it generally sits outside the local network.
- So traffic goes through your default gateway, out in the general internet, and then to the proxy server.
- Proxy server can cache things, etc
- A VPN is like a proxy server, but it operates at the IP (network) layer, so you can funnel all types of traffic to it, not just HTTP traffic.
Gateway
A default gateway is a device in a local network that other devices in the same local network use to communicate with devices outside the local network. In other words, it connects a local network to the internet.
┌────────────┐
│ │ default gateway
│local node 1│ ──────────────────────┐
│ │ │ xxxxxxxx
└────────────┘ ▼ xxxxxx x x
xxx xxxxx xxxxx
┌────────────┐ ┌─────────────┐ xx xx
│ │ default gateway │ │ xx x
│local node 2│ ──────────────► │ local node 4│ ────► x internet x
│ │ │ (gateway) │ x xxxx
└────────────┘ │ │ xxxxx x
└─────────────┘ xxx xxxx xx
x xxx xxxxxx
┌────────────┐ ▲ xxxxxx
│ │ │
│local node 3│ ──────────────────────┘
│ │ default gateway
└────────────┘
The gateway device is usually a router. It uses a Network Address Translation (NAT) table to keep track of which incoming response packets map to which local nodes that sent the original request packets. It does this by mapping a unique source port number to each local node. When a response packet arrives, the router looks at the destination port number and uses the NAT table to determine which local node to forward the packet to. Click here to learn more.
You can, however, make any node (not just a router) be the default gateway. Go to the other nodes’ OS level network settings and set the default gateway to the IP address of the node you want to be the default gateway.
This is a clever way to funnel all traffic through a single node.
Note: More generally, a gateway is a node that connects two different networks. It doesn’t always have to connect a LAN with the internet. It can connect any two networks.
Proxy Server
Proxy servers are similar to a default gateway in the sense that they sit between some nodes and the internet. However, there are a few differences. First, proxy servers are designed (usually) only to handle HTTP(S) traffic, i.e. they operate at the application layer. Second, they generally sit outside the local network. It is a means to funnel all HTTP(S) traffic through a single node. This node can be used to cache web pages, responses, files, etc. It can also be used to filter out certain types of traffic, or to log all traffic. You can get pretty creative with how you use it.
│
local network │ internet
│
│
┌─────────────┐ ┌─────────┐ │ ┌──────────────┐ ┌────────────────────────┐
│ │ │ │ │ │ │ │ │
│ local nodes │ ────────────► │ gateway │ ───────┼─────────► │ proxy server │ ─────────► │ other internet servers │
│ │ HTTP │ │ │ │ │ │ │
└─────────────┘ Traffic └─────────┘ │ └──────────────┘ └────────────────────────┘
│
│
│
│
│
│
VPN
A VPN can be thought of as a Proxy Server that operates at the IP (network) layer. It essentially funnels all traffic (not just HTTP traffic) through a particular node, and this node is generally outside the local network. VPNs are generally used for privacy reasons.
That’s it, that’s all there is to it! Hope it was a fun read!