[Openswan Users] Forcing port 4500
Roel van Meer
rolek at bokxing.nl
Mon Feb 14 01:40:00 EST 2011
Swartz, Patrick H writes:
> Doesn't seem to matter --
> sending 592 bytes for EVENT_RETRANSMIT through eth0:4600 to 184.108.40.206:500 (using #1)
> Looks like it is still trying to connect on the right side on port 500.
> Is there a way to tell pluto on the right side to listen on port 4600 (or
> whatever port)?
Perhaps you can use iptables to accomplish this?
iptables -t nat -A OUTPUT -o eth0 -d <peerip> -p udp --dport 500 -j DNAT --to-destination <peerip>:4500
iptables -t nat -A PREROUTING -i eth0 -s <peerip> -p udp --dport 4500 -j REDIRECT --to-port 500
If you run these two commands on both of your servers, you can keep your
original ipsec config (without --ikeport 4500) but traffic will be sent via
port 4500 anyhow.
You'll have to adjust the device and <peerip> for your setup, of course.
I've never used this trick with ipsec, so I'm not entirely sure this
works, but it should. I've used it with SIP, when we had routers that tried
to do NAT on the default si pports and broke it horribly in the process.
> Patrick Swartz
> UNIX Planning & Engineering (DSUSSE)
> First Data
> 402-777-7337 desk
> 402-201-1192 Company cell
> 402-871-8981 Personal cell
> -----Original Message-----
> From: Paul Wouters [mailto:paul at xelerance.com]
> Sent: Sunday, February 13, 2011 12:13 PM
> To: Swartz, Patrick H
> Cc: users at openswan.org
> Subject: RE: [Openswan Users] Forcing port 4500
> On Sat, 12 Feb 2011, Swartz, Patrick H wrote:
>> Thanks for the quick reply !!
>> Well, adding that to the ipsec.conf file did the trick so far as setting the outgoing port to 4500. However, it didn't work as I expected.
>> I set that on both sides, but after restarting and sending a test ping I see this in both secure logs --
> Did you try what i said:
> You might need to pick something other then 4500 to not interfere with the "jumping to 4500" though.
>> [Left log]
>> Feb 12 01:13:05 r9tvmp502 pluto: | handling event EVENT_RETRANSMIT for <invalid> "r9tvmp502-jerry" #1
>> Feb 12 01:13:05 r9tvmp502 pluto: | sending 592 bytes for EVENT_RETRANSMIT through eth0:4500 to 220.127.116.11:500 (using #1)
>> [Right log]
>> Feb 12 14:20:59 rhel5-3atest pluto: "r9tvmp502-jerry" #2: initiating Main Mode to replace #1
>> Feb 12 14:20:59 rhel5-3atest pluto: | sending 592 bytes for main_outI1 through eth0:4500 to 18.104.22.168:500 (using #2)
>> The brass-tax of this is I just need to work around our firewalls that are blocking port 500.
>> Here is a diagram of the test environment --
>> [left side] r9tvmp502(22.214.171.124) --> jerry(126.96.36.199) [right side]
>> Here is the main ipsec.conf that is the same on both sides --
>> version 2.0 # conforms to second version of ipsec.conf specification
>> # basic configuration
>> config setup
>> # Debug-logging controls: "none" for (almost) none, "all" for lots.
>> # klipsdebug=none
>> plutodebug="control parsing"
>> plutoopts="--ikeport 4500"
>> # For Red Hat Enterprise Linux and Fedora, leave protostack=netkey
>> # Enable this if you see "failed to find any available worker"
>> And the conn
>> conn r9tvmp502-jerry
>> Patrick Swartz
>> UNIX Planning & Engineering (DSUSSE)
>> First Data
>> 402-777-7337 desk
>> 402-201-1192 Company cell
>> 402-871-8981 Personal cell
>> -----Original Message-----
>> From: Paul Wouters [mailto:paul at xelerance.com]
>> Sent: Saturday, February 12, 2011 12:10 PM
>> To: Swartz, Patrick H
>> Cc: users at openswan.org
>> Subject: Re: [Openswan Users] Forcing port 4500
>> On Sat, 12 Feb 2011, Swartz, Patrick H wrote:
>>> After much trial-and-error, I think I have found the culprit we have firewalls that are blocking port 500. However, port 4500 is open.
>>> So my questions is Can I force openswan to use port 4500 for everything?
>>> I have set -- forceencaps=yes in the conn section of the openswan.conf file and nat_traversal=yes even though Im not using
>>> NATing just yet.
>>> However, after watching the /var/log/secure it looks like packets are still being sent out on port 500.
>> The first packet still goes out over port 500.
>> You can try adding this to config setup in ipsec.conf:
>> plutoopts="--ikeport 4500"
>> You might need to pick something other then 4500 to not interfere with the "jumping to 4500" though.
>> Let us know how this goes,
>> The information in this message may be proprietary and/or
>> confidential, and protected from disclosure. If the reader of this
>> message is not the intended recipient, or an employee or agent
>> responsible for delivering this message to the intended recipient,
>> you are hereby notified that any dissemination, distribution or
>> copying of this communication is strictly prohibited. If you have
>> received this communication in error, please notify First Data
>> immediately by replying to this message and deleting it from your
> Users at openswan.org
> Micropayments: https://flattr.com/thing/38387/IPsec-for-Linux-made-easy
> Building and Integrating Virtual Private Networks with Openswan:
More information about the Users