Two IP on same interface


#1

Hi to all,

Here is the description of my problem :

  • I have migrated my network form 172.18.0.0/16 to 10.63.8.0/23
  • I have a machine SRVA who wants to connect to SRVB via LDAP but on his old address 172.18.1.1 (the IP is writen in the application and we can not modifiy the application)

SRVA 10.63.8.7
SRVB new address 10.63.8.21
SRVB old address 172.18.1.1

VyOS 10.63.8.3 on eth0 (only one interface)

Is it possible to do the NAT with VyOS ?

Here is my configuration and it does not work :

nat {
destination {
rule 100 {
destination {
address 172.18.1.1
}
inbound-interface eth0
protocol all
translation {
address 10.63.8.21
}
}
}
source {
rule 100 {
source {
address 10.63.8.21
}
outbound-interface eth0
translation {
address 172.18.1.1
}
}
}
}
protocols {
static {
interface-route 172.18.1.1/32 {
next-hop-interface eth0 {
}
}
}
}

Thanks in advance,
Cyrille


#2

1st of all, do both SRVA and SRVB have a static route for 172.16.1.0/24 , pointing to 10.63.8.3 ?


#3

Hi

Thanks for your answer
I find the solution

interfaces { ethernet eth0 { address 10.63.8.3/23 duplex auto hw-id 00:50:56:ac:f9:af smp_affinity auto speed auto } loopback lo { } } nat { destination { rule 100 { description "NAT du TCP-LDAP" destination { address 172.18.1.1 port 389 } inbound-interface eth0 protocol tcp translation { address 10.63.8.21 port 389 } } rule 101 { description "NAT du protocole ICMP" destination { address 172.18.1.1 } inbound-interface eth0 protocol icmp translation { address 10.63.8.21 } } } source { rule 100 { outbound-interface eth0 source { address 10.63.8.0/23 } translation { address masquerade } } } }