Score:0

Sendmail: force envelope IP address to IP address in my domain

us flag

My mail server (sendmail) has a bridged DSL connection running PPPoE to the outside world.
The network interface is initially assigned an IP address for my domain, but when PPPoE starts the IP address is forced to one from my ISP which is not in my domain, and I have no control over it or its reverse-dns.

This IP addr is the one which appears in the envelope for outgoing mail; e.g., outgoing mail is received with a header that looks like:

from mailhost.my-domain.com ([56.99.126.37]) by ...

Is there any way to have sendmail use the "real" IP of the host instead of the 56.99.126.37 assigned by my ISP to the interface? MASQUERADE_AS affects the domain name, but I don't see a way to force the IP address. Is that set at the IP level below sendmail and out of sendmail's control?

I have an SPF record which includes +ip4:56.99.126.37 so mostly this is not a problem, but att and abusix.com still complain because a reverse dns doesn't map to my domain.

The routing table, after modification when PPPoE starts, looks like:

Destination        Gateway            Flags     Netif Expire
default            59.41.70.25        US         tun0
56.99.126.37       link#4             UHS         lo0
56.99.131.56/29    link#1             U           xl0
56.99.131.57       link#1             UHS         lo0
59.41.70.25        link#4             UHS        tun0
127.0.0.1          link#3             UH          lo0
192.168.0.0/25     link#2             U          fxp0
192.168.0.1        link#2             UHS         lo0

The desired IP, and the original default route, were for 56.99.131.57 out xl0. ifconfig tun0 looks like:

tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1492
        options=80000<LINKSTATE>
        inet 56.99.126.37 --> 59.41.70.25 netmask 0xffffffff
        groups: tun
Score:0
fr flag

I would have a look at CLIENT_OPTIONS m4 macro and Addr key. It may allow you to specify outgoing address used.

If that fails you can try to install default route using src ENCAP_IP (man ip-route). This is of course assuming Linux, I cannot help with other Unixes.

Gary Aitken avatar
us flag
thanks, unfortunately CLIENT_OPTIONS didn't work. My server is running fbsd but I'm having trouble understanding what you're envisioning doing with a new / different default route. The existing routing table after PPPoE tunneling starts has been added to the original question, if that helps.
fr flag
Linux allows you to specify which source address is used in outgoing packets when kernel selects specific route when initiating a connection, this is the `src` parameter in `ip route`. I cannot help you with freebsd.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.