Hope this is the proper place to post this.
So I setup my openvpn server using openvpn-install and it was fairly easy. The only issue I am having is that I want to set the outgoing IP to a specific IP. The script sets up an file called add-openvpn-rules.sh which creates the following entries for my server:
#!/bin/sh
iptables -t nat -I POSTROUTING 1 -s 10.8.0.0/24 -o enp6s0f0 -j MASQUERADE
iptables -I INPUT 1 -i tun0 -j ACCEPT
iptables -I FORWARD 1 -i enp6s0f0 -o tun0 -j ACCEPT
iptables -I FORWARD 1 -i tun0 -o enp6s0f0 -j ACCEPT
iptables -I INPUT 1 -i enp6s0f0 -p tcp --dport 58385 -j ACCEPT
The problem is that it forces the use of the main IP address of the server and I would like to specify a specific address. Can anyone help to modify the above entries to specify the IP. Let's say the IP is 57.65.23.56 (Not the real IP) for instance.
By the way, I have already tried settings the interface value to the actual interface of the IP in question, but that does not work at all. I tried:
#!/bin/sh
iptables -t nat -I POSTROUTING 1 -s 10.8.0.0/24 -o enp6s0f0:iw2 -j MASQUERADE
iptables -I INPUT 1 -i tun0 -j ACCEPT
iptables -I FORWARD 1 -i enp6s0f0:iw2 -o tun0 -j ACCEPT
iptables -I FORWARD 1 -i tun0 -o enp6s0f0:iw2 -j ACCEPT
iptables -I INPUT 1 -i enp6s0f0:iw2 -p tcp --dport 58385 -j ACCEPT
Thanks in advance.