One computer with two ethernet network cards, that needs one to connect to internet and the other to one IP address on a LAN

9,503

To summarise, your computer has the following network interfaces:

  • "To Internet"
    • 192.168.0.169/24, Gateway: 192.168.0.1 (aka default route)
  • "Internal" / "To Control System"
    • 172.17.13.11/24, Gateway: 172.17.13.1

With these connections established, you'll end up with two gateways, and I'm not sure how Windows will handle this... You may find:

  • That you intermittently have access to the internal network or to the internet (possibly swapping after a reboot)
  • That you only have access to the internal network
  • That you only have access to the internet

I'd suggest that your "Internal" network doesn't have a gateway configured, and you instead set up an explicit route so that you can access your "control system" at 172.18.4.4, via this router. Get a privileged command prompt and type the following:

route -p add 172.18.4.4/32 172.17.13.1

If you need access to other hosts (or to the whole subnet, possibly 172.18.4.0/24), then either run the command again for each host, or run the following for access to the full /24 subnet:

route -p add 172.18.4.0/24 172.17.13.1

NOTE: You didn't provide details on the subnet that the 172.18.4.4 host is on, and I've presumed it's a /24 subnet.


Routes can be viewed with:

route print

Routes can be removed with:

route delete 172.18.4.0/24
Share:
9,503
Shane Séguin
Author by

Shane Séguin

Updated on September 18, 2022

Comments

  • Shane Séguin
    Shane Séguin over 1 year

    We are trying to setup a computer to have remote access via internet (TeamViewer) and also have access to a small LAN, that connects to some control systems.

    Essentially here is the setup.

    Desktop running Windows 10 Professional. It has two network cards. One connects to the Internet only. The other to the LAN (the computer is set with a static IP address in Windows). When only one is connected, you can get either the internet or the LAN but when both are connected, neither connection seems to work.

    The internet connection is DHCP and provides the computer with an IP when it connects.Currently this is what is being assigned when I open a command prompt and type ipconfig:

    IPv4 Address. . . . . . . . . . . : 192.168.0.169
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . . . . : 192.168.0.1
    

    The other network LAN needs manual configuration, and the computer should have the following details (which I was provided and have set in windows)

    • IP: 172.17.13.11
    • Gateway: 172.17.13.1
    • Mask : 255.255.255.0

    This computer using the LAN needs to connect only to the following IP to do what needs to be done : 172.18.4.4

    Again these details above work fine when only the LAN is connected to the computer. But when we connect the wire for the Internet to the other network card, we don't have either connection.

    Any ideas how we can get things to work?

    Thank you for your help.

    • Attie
      Attie almost 4 years
      May I ask what "some control systems" refers to? Should you be getting a professional do this?
    • Attie
      Attie almost 4 years
      172.18.4.4 is not on the 172.17.13.0/24 subnet, so is likely accessed via the router at 172.17.13.1... you'll probably need to setup a route specifically for this host or subnet, otherwise it will probably be attempting to route the traffic out onto the internet.
    • Shane Séguin
      Shane Séguin almost 4 years
      Attie: It is a control system that controls lights, windows, stuff like that. The scenario is that we want to be able to control it remotely, as the system is not accessible via the internet on its own. So we are setting up a dedicated computer with internet that has physical connection to the LAN network that this stuff is connected to, and will then use TeamViewer to login to run the control software remotely to adjust as required.
    • Shane Séguin
      Shane Séguin almost 4 years
      Could you explain your solution with a bit more detail. I have been reading about setting up routes and I think I understand the concept of what it does but still can't figure out how it is to be done.
    • Attie
      Attie almost 4 years
      From the details you've provided, it looks like your "internet connection" is using a private network range, which is odd... You shouldn't be connecting a Windows PC directly to the internet any, so that's probably a good thing...
  • DavidPostill
    DavidPostill almost 4 years
    Comments are not for extended discussion; this conversation has been moved to chat.