Analytic

Thursday, October 24, 2013

QMail Changing send IP

The default IP for outgoing connections can be set using the "ip" utility. Check how routing is configured on the server:

assume we have two network interfaces vnet0:0 (192.168.175.100)  and vnet0:1 (192.168.175.200) and 192.168.175.1 is gateway:

[root@server]#/sbin/ip route

192.168.175.0/24 dev venet0  scope host
169.254.0.0/16 dev venet0  scope link
default via 199.168.175.1 dev venet0



If no "src" is listed in the "ip" output for the default route, the main IP on the interface is used for outgoing connections.

To change Plesk default Mail IP address, check ifconfig on the server first as :


lo        Link encap:Lokale Schleife 
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:898825 errors:0 dropped:0 overruns:0 frame:0
          TX packets:898825 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 Sendewarteschlangenlänge:0
          RX bytes:2333074597 (2224.9 Mb)  TX bytes:2333074597 (2224.9 Mb)

venet0    Link encap:UNSPEC  Hardware Adresse 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet Adresse:127.0.0.1  P-z-P:127.0.0.1  Bcast:0.0.0.0  Maske:255.255.255.255
          UP BROADCAST PUNKTZUPUNKT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:69429506 errors:0 dropped:0 overruns:0 frame:0
          TX packets:109230137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 Sendewarteschlangenlänge:0
          RX bytes:19231956377 (18341.0 Mb)  TX bytes:136258969119 (129946.6 Mb)

venet0:0  Link encap:UNSPEC  Hardware Adresse 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet Adresse:192.168.175.100  P-z-P:
92.168.175.100  Bcast:0.0.0.0  Maske:255.255.255.255
          UP BROADCAST PUNKTZUPUNKT RUNNING NOARP  MTU:1500  Metric:1

venet0:1  Link encap:UNSPEC  Hardware Adresse 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet Adresse:
192.168.175.200  P-z-P:
92.168.175.200  Bcast:0.0.0.0  Maske:255.255.255.255
          UP BROADCAST PUNKTZUPUNKT RUNNING NOARP  MTU:1500  Metric:1



Change the mail IP address through following command as :

[root@server]#/sbin/ip route change default via 192.168.175.1 dev venet0:1 src 192.168.175.200


now verify the mail IP address :

[root@server]#/sbin/ip route

192.168.175.0/24 dev venet0  scope host
169.254.0.0/16 dev venet0  scope link
default via 192.168.175.1 dev venet0  src192.168.175.200



If "ip route" command says nothing about gateway or gateway is 0.0.0.0, for example like this one:

[root@server]#/sbin/ip route

127.0.0.0/8 dev lo  scope link
default dev venet0  scope link 



you can use this command:

[root@server]#/sbin/ip route change default via 192.168.175.100 dev venet0 src 192.168.175.200