P
P
p_yakovlev2022-02-24 01:12:24
linux
p_yakovlev, 2022-02-24 01:12:24

Routing 2 eth with redirect?

Routing question.
I'm zero on Linux.
I do not understand how to write correctly, what to do.

Essence:

There is a server which has 2 eth.
eth1 main, ip 192.168.0.2
eth2 data channel, ip 78.78.78.3

It is necessary to somehow make it so that when the server from the main eth1 sends a request to ip: 79.79.79.9,
the request comes from eth2 and the sender's ip is 78.78.78.3

How can this be written in ip route add?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shurshur, 2022-02-24
@shurshur

The server does not send "from the main eth1". The interface to send is chosen during the routing process, not before.

ip route add 79.79.79.9 via шлюз_в_сети_где_адрес_78.78.78.3

This will change at runtime, after a reboot / reconnection to the network, the route will fail and it will need to be rewritten. To get up automatically, you need to look at which network management mechanism is used (ifupdown/netplan/network-manager/network-scripts/dhcp client/etc/etc), and decide depending on.

D
Drno, 2022-02-24
@Drno

marking traffic, then NAT to the desired gateway with this marking
is not a typical task for a person who does not rummage in Linux and routing in principle. Can you hire an admin? because if you were an admin, you would at least understand how traffic flows

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question