A
A
abg2013-12-18 13:59:07
linux
abg, 2013-12-18 13:59:07

How to change the IP for an application that needs this particular IP?

In general, the task is this, there is a RHEL 6.4 Server system with a pair of network interfaces combined into one through bonding-a. This system has an IP address: 10.7.7.1. Further, an application is running on this system that needs a connection to the MySQL server 10.7.7.2 on port 3306. And in fact MySQL is running on 10.7.7.3. The connection parameters are hardcoded into the application, so they cannot be changed. I heard that you can do address translation through iptables . How to make it so that when an application accesses 10.7.7.2:3306 iptables intercepts it and sends a request to 10.7.7.3:3306, and receives a response back and feeds it to the application?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alz, 2013-12-18
@abg

Try iptables -t nat -A OUTPUT -d 10.7.7.2 --dport 3306 -j DNAT --to-destination 10.7.7.3

Z
zeleniy87, 2013-12-18
@zeleniy87

Isn't it easier to make an alias on the interface?
sudo ifconfig eth0:0 10.7.7.3 netmask 255.255.255.0 up

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question