NAT masquerade to specific external IP


#1

Dear VyOS Users,

i have multiple IPv4 addresses on my external interface (eth0 in this case). I have successfully setup NAT masquerading of the internal RFC1918 /24 subnet.
Outgoing flows now contain the first external IPv4 address of the external interface as source address (or maybe random?).

For a specifc application i need a specific internal host (specific internal IPv4 Address) to be mapped to a specific external IP Address.
I tried to do this by adding a additional source NAT rule (rule 60) like so :

rule 60 {
description “NAT internal .100 Traffic to external .100”
outbound-interface eth0
source {
address 192.168.100.100/32
}
translation {
address 80.100.100.200
}
}
rule 100 {
description “NAT masquerade INSIDE”
outbound-interface eth0
source {
address 192.168.100.0/24
}
translation {
address masquerade
}
}

However, this does not seem to work. I can see outgoing traffic from internal .100 going out with external 80.100.100.200 address, however no answer is coming back.

Please let me know how to achive this or if i am on the right way - what am i missing?

Many thanks,
Michael


#2

Hello,
please provide complete config


#3

thanks for replying… it already works out of nowhere …
i think previous nat mappings needed to expire first (does that make sense?)

Rule 60 in my example above does indeed work as expected. Outgoing traffic from 192.168.100.100/32 is sent with 80.100.100.200 as source address.

thanks,
Michael