~~SBC Network?~~ NAT nightmares

To see if your device is using Network Address Translation (NAT), find its IPv4 address. If that IP falls within one of these ranges it means you have a private IP and most likely using NAT within your local network (your router is assigning the IP via DHCP). Using an Ethernet switch inside your local network doesn’t really affect the private vs. public status. A switch just tells the router to send more private IP’s to the devices connected to the switch via Ethernet cable (Cat5e, Cat6, etc.), just like a WiFi router will
send more IP’s to devices on your local network using WiFi.

If it’s outside these ranges you probably have a public IP and not using NAT within your local network (your ISP might be using DHCP to assign your public IP though).

10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

1 Like

Using ifconfig inet was my public ip, as in the same as whatismyip.@VaCrunch

Will dig deeper tomorrow.

Using whatismyipaddress.com will only give you the public address your router is using. You have to use a different method to discover the private IP address your device is using.


So how do you find it? In Windows it requires the command prompt. Search for “cmd” (without the quotes) using Windows search. Click to get the Command Line. In the resulting pop-up box, type “ipconfig” (no quote marks) then Return/Enter.


If your device is using WiFi to get on the Internet usually you just click on Properties or the little “i” next to your WiFi name (in Settings for a phone) to find the IP address.

Yep, as long as the laptop has different IP address to the router and is one of the public IP addresses allocated to you. You have 5 Public IP addresses from memory

You supply a fixed IP address (one of the 5 public) to the Laptop then you can be sure its using the public IP address.

Not yet this is still my old line, it gets upgraded on Friday.

This is something I did before (long ago) when I couldn’t connect to a test, and using this setup pictured a few post higher I could.

But I dont really understand what is happening.

The laptop and the router have the same IP, but the laptop is not using the router.

@VaCrunch the switch is before the router are you saying they still communicate?

When you get your new router with the 5-public-IP order it might send out each of the 5 public IP’s you ordered automatically using a special version of DHCP internally, so if each of your devices is set to “Get an IP Address Automatically”, which is usually the case, the first five will get one of your public IP’s. Interested to see what happens when you connect a sixth device. Will it then get a private IP or no IP, thus preventing Internet access on that device?

1 Like

Is the router not connected to the switch also? If your external Ethernet cable (the one coming out of the wall and then usually to the router) is connected directly to the switch but the switch is not connected to the router then I can see how your laptop is getting a public IP, it’s coming from your ISP. If your router is also connected to the switch try disconnecting it and see if your laptop still gets a public IP.

1 Like

Yes, the line that enters the house that would ordinarily go to the router instead goes to the switch, from the switch I now have 2 lines one to the router and the other to the laptop.

The laptop and the router recieve the same public IP.

Will unplug the router tomorrow.

Then 2 devices cannot have the same IP address on the one local network at the same time.

Yes, so what do you think is happening there?

If you discovered the laptop’s IP address via whatismyipaddress.com it is simply giving you the router’s address. Run ipconfig from a command prompt on the laptop. What does that show as the IP address?

1 Like

It is linux so I ran ifconfig, enp4s0 inet was my Public IP.
This is where I would ordinarily see my local 192.xx.xx

Try

hostname -I (That’s a capital “i” not a lower-case “L”)

or

ip addr

or just

ifconfig

with nothing else

1 Like

Could also be that your ISP has already assigned some public IP’s for you and your current router is only giving out one. But, as @neo says, your network should reject a device that is trying to use an IP that is already being used by another device on your network.

1 Like

Will do, I’ll let you know in the morning. Thanks for the hand holding!

Hmhmm - don’t switches route via Mac addresses…?

So same IPs might just cause trouble when the two devices want to communicate with each other …?

…just a random thought… Very strange things going on…

1 Like

They don’t technically “route” but just know which port has which MAC address attached and switch data between ports.

The real problem is that if there is 2 devices at the same IP address then both are responding to the initial incoming packets. The ISP will use the MAC address of one of the devices to send packets to and the other should be ignored. But if the first packet sent to the devices has both devices respond then the ISP gateway router/switch will have to decide which to use as it learns the MAC address at the client end.

Generally devices will see another device respond to the same (initial) packet(s) and either complain or pretend they are the rightful device.

Now some switches also know IP addresses (ie managed switches) and it depends on the model/software as what happens from there.

6 Likes

Same IP addresses = wrong configuration
Different HW (switches, routers) react to it differently and sometimes it configurable:

  1. It can be strict = block both conflicting entities
  2. It block the one who appeared second. This sounds best, but different switches/router can see first different node with the same IP and block the other one and you end up with chaos.
  3. Home HW will try to compensate for the configuration error, in that case two device with same IP cannot comunicate with each other, but mostly can comunicate with others. It also brings chaos.

Technically, there are some specific cases (that make sense only in in big networks) where you can put same IP on more machines and it is not wrong configuration. It is uses it to loadbance or minimize latency, but it is nothing for normal users. You really have to know what you are doing and why.

3 Likes

Thanks for all the responses.

I don’t know that me playing with this any longer is needed.

All I can say is everything appeared to work perfectly fine.

Seeing as I have a far more orthodox solution in the mail it is just fun and games.
Unless anyone has burning questions to satisfy their own curiosity, in which case I am happy to set it up again and play along.

1 Like

Be careful exposing a laptop on a public IP.

The reason is public IPs are constantly getting attacked by bots probing all ports and trying to get in. Especially they probe for ssh common accounts and passwords and http(s) common software and known vulnerabilities, passwords.

For this reason, any device I expose to public internet I typically lockdown tight by ensuring that a firewall (ufw) is running with initially all ports except ssh (22) closed. For ssh I setup pubkey login for an account with sudo access and then I disable ssh password logins. Also I install fail2ban to monitor ssh and possibly mail, http logs and auto ban offenders.

11 Likes