I'm new to networking and I just learned Cisco router's static routing. I know that ip route 0.0.0.0 0.0.0.0 f0/0 192.168.xxx.xxx
states that all packets should be forwarded to 192.168.xxx.xxx
. Can I use this rule to to specify 192.168.xxx.xxx
as my default proxy server? My classmate says I'm mixing networking layer and application layer, which I don't believe is true.
3 Answers
If you enter this configuration, here's what will happen:
Your router will use ARP to find the MAC address for 192.168.xxx.xxx. Whenever your router wants to send an IP packet to anywhere (that it doesn't have a more specific route for), it will send it to that MAC address. The device whose IP address is 192.168.xxx.xxx is now responsible for getting that packet to its destination.
This is not the same as an HTTP proxy. Yes, it's a similar concept, but HTTP proxies are at the HTTP (application) layer, and this is routing happening at the network layer. They are also designed for different purposes - while HTTP proxies are designed to mess with HTTP traffic, routes are just designed to get packets to their destination.
It is possible to set up a computer as a router that intercepts traffic, but you will run into one major problem: it can't send the traffic to the Internet when it's done with it. When it edits the packet and sends the edited packet back to the router, the router will just send the packet back to it, because the router legitimately believes that that is the right direction for packets to go to get to the Internet. For this reason, if you did want to use a system like this to intercept traffic, you need to have some kind of separation between the "local" and "Internet" traffic. The most straightforward way would be to put the "proxy" in between the "main" router and the Internet, with two separate interfaces.
You are mixing layers. A gateway routes IP traffic, a proxy works for HTTP(S) traffic (which is payload in IP packets). So unless your proxy server does both and also routes IP packets, you're breaking things by setting the gateway to your proxy server.
Can I use this rule to to specify 192.168.xxx.xxx as my default proxy server?
No. A proxy is specified for an application-layer protocol (esp. HTTP/S). A default route points to a network-layer gateway.
You need to be able to route to your proxy (which could be on the other side of the world). The config to use that proxy is either within the application (browser) or global in the operating system. Note that proxies, host configurations and anything else above the transport layer is explicitly off-topic here.
ip route 0.0.0.0 0.0.0.0 f0/0 192.168.xxx.xxx
states that all packets should be forwarded to192.168.xxx.xxx
." That is not strictly true. That is the default route that does not come into play unless there is no other more-specific route to a specific destination. It is a failsafe route, not routing all traffic.