How to run application in Linux from the second IP address?

Linux has two network addresses on one interface and By default, all programs run through the IP, but I need to run the program snmpwalk to connectivity to the router with address Routes cannot be changed because other programs may stop working.
Question - how to do it?
April 19th 20 at 12:36
4 answers
April 19th 20 at 12:38
I need to run the program snmpwalk to connectivity to the router with address

I think that here it should help: echo clientaddr >> ~/.snmp/snmp.conf
In the General case, there is no single recipe: the app itself should do the bind to the socket from which it sends requests, each application does it differently (or not at all).
April 19th 20 at 12:40
linux network namespaces
April 19th 20 at 12:42
the question is not read @ immediately respond ? - vita_Parker69 commented on April 19th 20 at 12:45
April 19th 20 at 12:44
Advanced program written by clever programmers have the key to select IP address. Especially open source, if someone needed, he writes, and with the consent of the author adds changes to the official source.

If the program doesn't do that - you can run Virt.the machine (or full, or something like a FreeBSD Jail) so that the program running inside the virtual world.the machine could use only the correct IP address.

And finally, you can organize NAT to force the replacement of outgoing IP addresses. The problem is how to separate the desired traffic to wrap it in a NAT machine - it is necessary to dig separately. Perhaps it is possible to allocate traffic on TCP/UDP port. And you can enable NAT only for the duration of the work program.

Find more questions by tags Network administrationSNMPLinux