Cron Jobs with different IPs linked to the user

Hello!

enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

link/ether xx:xx:xx:xx:xx:17 brd ff:ff:ff:ff:ff:ff

inet 192.168.1.4/24 brd 192.168.1.255 scope global noprefixroute enp4s0

inet 192.168.1.100/24 brd 192.168.1.255 scope global secondary enp4s0

I have 2 white external IPs, 2 websites, two virtual servers are already working with different external IPs

enp4s0 - 192.168.1.4 - external – 1.1.1.1

enp4s0:0 - 192.168.1.100 - external – 2.2.2.2

I run Cron Jobs from any user, for example:

exec( ‘curl http://ipecho.net/plain; echo’ );

I get the same external ip 1.1.1.1 with different users

Is it possible to have different external IPs when running Cron Jobs from a virtual server user?

That’s not a Virtualmin question. That’s a routing question, and one I don’t have a simple answer for; it’s very unusual to route based on user.

The network layer doesn’t have the information you’d need to route based on user; packets in IP don’t have a “user” field. But, you may be able to do it with namespaces? sockets - How to use Linux Network Namespaces for per processes routing? - Stack Overflow

But, I think you probably want to solve your problem (whatever problem it is you’re trying to solve with these cronjobs) via some other method.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.