0

I have a network which has for example the subnet 172.20.1.0/24. On this, I have one embedded device that tries to access http://192.168.1.1, which is hardcoded. Without making physical changes to the network I would like that device to get a response.

What I tried was to add a static route on that device

$ route add -host 192.168.1.1 dev eth0
$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.20.1.0      *               255.255.255.0   U     0      0        0 eth0
192.168.1.1     *               255.255.255.255 UH    0      0        0 eth0

and then configure one PC on the network to additionally have that static IP address. Now, from my device I could ping it, but unfortunately only if I specify the interface explicitly:

ping 192.168.1.1          # doesnt work
ping -I eth0 192.168.1.1  # works

I could also still not access a webserver on that PC. How can I additionally make that IP address accessible without for example introducing a router?

3
  • What exactly generates the IP addresses in your LAN ?
    – Overmind
    Jan 27, 2020 at 13:26
  • What system does your device use? Or what interfaces does it have? (something like the output of ifconfig. If it works with the -I eth0 you have almost solved it, you probably only need to set an additional route. Jan 27, 2020 at 13:35
  • 1
    This seems to be an en.wikipedia.org/wiki/XY_problem I would search how to configure/reconfigure the equipment I have to use the network configuration I have, instead of complicating it. Jan 27, 2020 at 13:41

1 Answer 1

0

You need to add an IP alias 192.168.1.1/24 to the same interface where 172.20.1.0/24 is configured. The kernel will add a directly connected route automatically. Then you need to configure a web server like nginx, apache, lightttpd to be able to server web pages on http://192.168.1.1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .