The first address(192.168.0.154, mask: 255.255.255.0 gateway: 192.168.0.1) for the Internet.
The second address(192.168.50.2, mask: 255.255.255.240 gateway: 192.168.50.1) for VPN mail.
I register an additional ip address, mask and gateway, the Internet works fine, but packets destined for VPN mail are sent from 192.168.0.154 to 192.168.0.1.Separately, everything works fine.
  • Enormous Police, windows 7/10 – Madden Turtle Jul 5 '19 at 16:23

2 Answers 2

in one system there can be only one interface with the gateway, the rest is additional addresses without a gateway and using routes.
  • Ie do two jobs at once will not work? more specifically you can? – Madden Turtle Jul 5 '19 at 15:54
  • Since when is it impossible to hang different addresses with different gateways on one network interface?
    You just need to configure routs for addresses and say that traffic to certain networks is allowed through the specified address.
    – Grimy31 Jul 5 '19 at 15:59
  • [[Mysterion]],>traffic to certain networks is allowed through the specified address.
    How to do it ?
    – Madden Turtle Jul 5 '19 at 16:02
  • [[Firess]], in linux, in my opinion, something like this:
    ip route add 192.168.1.0/24 via 192.168.50.1 dev eth1

    Subnet his substitute only necessary.
    – Grimy31 Jul 5 '19 at 16:37
  • [[generalx]]
    on one system there can be only one interface with a gateway

    Not exactly.
    There can be at least one hundred interfaces with gateways in one system.
    But the default gateway is always the same.

    Ie, traffic goes to the gateway that is clearly specified in the route.You can specify any gateway.
    And if all of a sudden there is no explicitly specified route for traffic - it goes to the default gateway(default gateway) - it’s certainly one such.
    – Blissful Crystal Jul 5 '19 at 16:46
  • [[Mysterion]], and how can you tell on Windows? – Madden Turtle Jul 5 '19 at 16:47
  • [[Firess]], when I had to wrap traffic to certain addresses via VPN on Windows, I did this:
    route -p add 1.1.1.1 2.2.2.2
    2.2.2.2 is the address of the VPN gateway in Windows
    1.1.1.1 - the address to which the traffic goes
    – Grimy31 Jul 5 '19 at 17:17
See the multihome network setup for your system.You didn’t mention any tags in the question for what network equipment you are doing.
LARTC(Linux Advanced Routing&Traffic Control) if we are talking about linux.