0

I have some knowledge of networking but not much, so I appreciate knowing from the experts.

modified part I have 10 devices(PLCs) with the same IP address "192.168.42.2" that I want to connect to one router(192.168.47.1). This network(2) has no internet connection and to have access to systems I have to change the IP address of my PC to connect to the gateway of network2. I have set the VLAN port of the network2 to be able to connect to the network1 with the gateway IP "192.168.1.1". In the network1 I have internet access. But the problem is that just one host can be connected to this router with its IP. Another host with the same IP can not be connected to the Lan port of this router(I thought maybe there are ways that I do not know). Then I thought of using the MAC address as a unique identifier. But I could not use this technique. I converted the LAN to VLAN but again the same issue, I realized that the second host with the IP (192.168.47.2) can not be accepted by the same router, whether it is connected to LAN or VLAN. end of modified part

The router here is used to expand another Network "192.168.1.1" and make the connection between the two networks (1 and 2). For this purpose in the setting of the router, one Ethernet port is configured as Vlan with the IP address of "192.168.1.2".

My problem is :

  1. Is it possible to have the same IP address for systems and just reach them with a different port number from Network1? example;

    telnet 192.168.1.2:21 telnet 192.168.1.2:23 ping 192.168.1.2

  2. If this plan does not work, would it be possible to recommend other solutions? enter image description here

2
  • 3
    the very purpose of the IP address is to identify a specific host within a network. You should not have the same IP address on different devices. The solution is obvious: change the IP address on the devices and put an unique one on each ( can be handled by DHCP). What are those devices?
    – JFL
    Commented Sep 27, 2022 at 10:58
  • 1
    IP requires each device have a unique ID. If that is not possible, you ,must put each in a different network and use NAT so that each has a different outside IP address.
    – Ron Maupin
    Commented Sep 27, 2022 at 12:19

2 Answers 2

4

Is it possible to have the same IP address for systems and just reach them with a different port number from Network1? example: ping 192.168.1.2:21 ping 192.168.1.2:23

No. IP addresses identify individual hosts. Also, Ping (ICMP echo) operates at layer 3, so it has no concept of ports (a layer 4 address).

If this plan does not work, would it be possible to recommend other solutions?

The simplest answer would be to re-address your devices so that they have unique addresses. If that is not possible, there may be other (more complicated/expensive) options, depending on your exact requirements.

8
  • Thank you, yes I have tried and as you and others mentioned, my router could find one host with that IP. I was thinking maybe using a MAC address might help, but did not. Also, I wanted to know if there are ways to learn them. The only way that I can refer to is to use a router for each Host.
    – Farz
    Commented Sep 27, 2022 at 13:06
  • 2
    @Farz What you try is connect a single device, connect to it using its IP, access the management interface, change the IP address to a unique one. Connect the next one and repeat.
    – JFL
    Commented Sep 27, 2022 at 15:30
  • 1
    @Farz It’s not really that common, but you were on the right track for a “hack” to make it work with setting MAC addresses statically. Essentially, if you created a static ARP entry on your switch/router so it knew which host you actively wanted to forward traffic to (ignoring all of the other hosts that were trying to ARP for the same address), and the host you were connecting from was on the same VLAN as the host you’re attempting to connect to, it would work.
    – Jesse P.
    Commented Sep 28, 2022 at 12:51
  • 3
    @Farz, it would be really helpful if you edited you question to describe exactly what you're trying to do -- and why. then we can give you some practical solutions.
    – Ron Trunk
    Commented Sep 28, 2022 at 12:59
  • 2
    "Searching for a solution to reduce the costs". Using dirty hacks will considerably increase the total cost in the long term. You have to figure the TCO - Total cost of ownership. In this regard doing things properly will always win, even if the initial setup cost is higher.
    – JFL
    Commented Sep 29, 2022 at 13:23
1

Is it possible?

That rather depends on the capabilities of the device you have labeled "router". It's certainly possible if the router is a linux box, I suspect it's possible with some of the higher end products from your favourite vendor of overpriced network gear. It's almost certainly not possible on a typical soho router running it's default firmware.

Is it a good idea? probably not

Is it beyond your skill level to implement? probably


Conceptually the easiest way to do it is with two layers of NAT, the first layer of NAT breaks out the incoming port numbers to a bunch of IP addresses. The second layer of NAT then maps the addresses for each device.

The question then is how to implement this? you could have a seperate NAT box for each PLC, but that would likely defeat the object of the excercise. So we want to get it down to a smaller number of boxes.

Personally I would implement this using a linux box as the router, i'm sure there are other soloutions but Linux is what I would.

First we need to get each PLC connected back to a seperate logical interface on the Linux box. There are two approaches here. The first is simply to build a linux box with lots of ethernet ports. You can get four ports on a PCIe card, but slightly complicating factors most 4 port PCIe cards are x4 rather than x1, so you have to pick your motherboard carefully if you want to stack lots of them.

Another option is to use a VLAN-supporting switch, put each device in it's own VLAN and then run a VLAN trunk back to the linux box.

Yet another option is that you can find some switches that run Linux.

Within the Linux box bridge each PLCs connection (either physical port or VLAN) back to a separate network namespace. The NAT engine in the primary network namespace is then used to take the incoming traffic and NAT it to the secondary network namespaces which then NAT it a second time and pass it out to the devices.

Conceptually this isn't too complex, but I've found network namespaces can be a PITA to debug, at my personal skill level I'd expect a day or so of head scratching and swearing to get this working. For someone who doesn't have a REALLY good understanding of how networks work it would likely be rather more difficult.

2
  • Linux servers are off-topic here. You should refer to Server Fault for a business network using Linux servers as routers.
    – Ron Maupin
    Commented Sep 30, 2022 at 21:24
  • Thank you, Peter. I try to evaluate your approach. Although I don't know much about networking, I am very good at taking the time to explore, study, and evaluate new strategies.
    – Farz
    Commented Jan 19, 2023 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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