0

How do clients connected to a LAN network with a NAT router connecting the network to the internet, identify the NAT router and hence know where to send their traffic for the wider internet.

If this is OS dependent then I am particularly interested in Windows 7 and iOS 8

I have already researched Default Gateway however this doesn't seem to work.

Bonus question: How do I manually override this so that all traffic goes through a different router?

Many thanks in advance for any help!

  • You are on the right path. Default gateway it is. The client usually only know default gateway within their own network. Beyond that router, you'd have to see the router as a client for the wider network (the ISP) and the router will have a default gateway of somewhere on the ISP. And any communication past that is ... a whole lecture / lesson on how internet works. – Darius May 15 '15 at 10:13
  • This is what I suspected, thanks for clearing it up for me. However, when I change the Default Gateway in Windows 7 for example, all the traffic still goes through the NAT router not the new Setting, even after reconnecting to the network. Do you have any idea why this would be? – o.comp May 15 '15 at 10:17
  • Is the default gateway still within the same LAN, or an IP address outside the LAN? If it is outside the LAN IP range (ip/subnet combination) then it will go through the existing gateway, to try to reach that new one, or even fail altogether. Also you mention "reconnecting" the network, after reconnection, does the network shows that it has the new gateway? (For windows, do ipconfig /all, for linux, ifconfig) – Darius May 15 '15 at 10:19
  • The NAT router is at 192.168.1.1 and the new default gateway is a Raspberry Pi running a transparent proxy at 192.168.1.99. Both in the same subnet. – o.comp May 15 '15 at 10:22
  • With the new setting (DG=192.168.1.99) all the traffic still goes direct through the NAT Router – o.comp May 15 '15 at 10:24
1

I can think of a few things you can try:

1) On the client machine make sure there is only one default gateway by opening a command prompt and doing "ipconfig /all"... look for the DG and make sure it says x.x.1.99 Make sure you can browse the internet fine, then unplug the raspberry pi and see if you can still browse the internet. If you can't, then traffic is definitely flowing through the proxy despite it not logging.

2) Maybe you have two connections on your client machine, like wifi and wired. When you set the Default Gateway, you want to make sure you have only one enabled and that it's the one that has the DG set properly.

3) If none of that solves your issue, open a command prompt and type "route print" and post it here.

  • Interestingly the 'route print' showed the DG as being the original 192.168.1.1 despite the settings change, I will try this change when I get back in the morning. Many thanks. – o.comp May 15 '15 at 18:18
  • You're welcome. You can also thank me by upvoting or accepting the answer. ;) – madamission May 19 '15 at 23:03
0

Simply.

In this case all your traffic(Hosts Traffic) is being forwarded to the ROUTER by the proxy server.

Packet Forwarding

0

How do clients connected to a LAN network with a NAT router connecting the network to the internet, identify the NAT router

Typically this information is received during DHCP. DHCP works by broadcasts so it doesn't depend on knowing the IP address of any server to work (consequently, things like rogue DHCP servers can be a problem.)

DHCP can hand out many types of information for hosts to use, one of those is obviously the IP address, and the "router" or default gateway is another. Also typically handed out is the IP address of a DNS server or two.

and hence know where to send their traffic for the wider internet.

The typical way a computer's TCP/IP stack works is this:

  • Does the IP address of this outgoing packet fall within the subnet mask of any network interfaces?
    • If so, send it out of that network interface to that IP directly (no router involved).
  • Otherwise, send the packet to the default gateway.

If your network interface's IP is set to 192.168.55.8, and its subnet mask is 255.255.255.0, then if your system wants to send traffic to any IP from 192.168.55.1 to 192.168.55.254, it will send it to that IP directly out of that NIC.

If you had a second network interface whose IP was 192.168.72.8 and its subnet mask was 255.255.255.0, then if your system wants to send traffic to any IP from 192.168.72.1 to 192.168.72.254, it will send it to that IP directly out of the second NIC.

If the destination IP range doesn't fall within any NIC's subnet ranges, it will send the packet to the default gateway (not changing the destination IP), which is expected to be a router that will resend the packet to the final destination or one hop closer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.