D
D
Digraz2019-10-10 10:35:56
linux
Digraz, 2019-10-10 10:35:56

Nftables or iproute2 (traffic forwarding how?

I'm trying to solve a problem. With me: ubuntu 18.04, nginx 1.14 with php-fpm 7.2, nftables 0.8.2/iproute2.
About the problem:
there are two virtual network cards implemented using proxmox 5.2 with different IP addresses (gray and white with a loopback), a php script polls a remote server via UDP, requests are sent from a gray address waiting for a response. The answer from the remote server does not come (a feature of the network, it will come if you send it from white (probably)).
netstat -anoptu 
udp 0 0 192.168.1.200:51442 176.12.33.34:7066 ESTABLISHED 821/php off (0.00/0/0)
udp 0 0 192.168.1.200:42282 176.12.33.34:706OFF php ESTABLISHED6 ( 
0.00
2: ens18: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether ce:f9:8c:4e:46:48 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.200/24 ​​brd 192.168.1.255 scope global ens18
valid_lft forever preferred_lft forever
inet6 fe80::ccf9:8cff:fe4e:4648/64 scope link
valid_lft forever preferred_lft forever
3: ens19: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether c6:b2:8f:4b :fb:ac brd ff:ff:ff:ff:ff
inet 176.12.33.33/32 scope global ens19
valid_lft forever preferred_lft forever
inet6 fe80::c4b2:8fff:fe4b:fbac/64 scope link
valid_lft forever preferred_lft forever 
ip route
default via 192.168.1.1 dev ens18 proto static
192.168.1.0/24 dev ens18 proto kernel scope link src 192.168.1.200 
About
the task: use nftables or iproute2 to redirect the traffic of a specific user (which runs php-fpm) from a gray address on white.
How to achieve results?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2019-10-10
@Digraz

Change default gateway to gateway from the white subnet. Then all packages will go outside. And what needs to be sent inside can be redirected by static routes.
By the way, in ip route you have nothing at all about the gateway from the white subnet. You either cut off the output, or your network card settings with a white address are incorrect and there is no gateway in them.
The second option is to mark the traffic you need in iptables and send the marked traffic to iproute2, which can work with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question