Solved OpenVPN how to force only 1 ip.

bryn1u

Well-Known Member

Thanks: 9
Messages: 338

#1
Hello again,

I have resolved most problem in earliers posts related to OpenVPN.
I think this is the last problem wich is bothering me. I have a such simple rule to be able use OpenVPN traffic.
Code:
nat on em0 inet from 10.8.0.0/24 to any -> em0
pass out on tun0 from any to any
I have a 5 public ip added to em0 interface.
Code:
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
    ether 00:25:90:55:fb:de
    hwaddr 00:25:90:55:fb:de
    inet 91.121.x.x netmask 0xffffff00 broadcast 91.121.x.x
    inet 79.137.x.x netmask 0xffffffff broadcast 79.137.x.x
    inet 79.137.x.x netmask 0xffffffff broadcast 79.137.x.x
    inet 178.32.x.x netmask 0xffffffff broadcast 178.32.x.x
    inet 188.165.x.x netmask 0xffffffff broadcast 188.165.x.x
    inet 213.32.x.x netmask 0xffffffff broadcast 213.32.x.x
    inet6 fe80::225:90ff:fe55:fbde%em0 prefixlen 64 scopeid 0x1 
    inet6 2001:41d0:1:8378:: prefixlen 64 
    nd6 options=8063<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL,NO_RADR,DEFAULTIF>
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
And the problem is: with each new connection i get a random ip from these 5 ips. I've run OpenVPN on inet 188.165.x.x but it doesn't matter. Ip is taken randomly.
Is there any way to force only 1 static ip for OpenVPN ? I was trying to do it with nat and rdr, never worked :(
 
OP
OP
B

bryn1u

Well-Known Member

Thanks: 9
Messages: 338

#2
Ok. I've got it. It was really simple.
Code:
nat on em0 inet from 10.8.0.0/24 to any -> 188.165.x.x
Works great now.
 
Top