LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2007, 04:46 AM   #1
xnomad
Member
 
Registered: Jun 2005
Posts: 53

Rep: Reputation: 15
IPsec routing issue


Hi I'm supposed to setup an IPsec tunnel with another company's server.

They have provided me with the details and I have to make it work.

Our LAN IP behind our router is in the 10.1.1.0/24 subnet.

They are telling me, however, that I have to make all traffic going to their network appear to be coming from a LAN IP 172.16.100.10. They then want me, whilst pretending to be this host, connect to another subnet on their end eg 192.168.1.0/24.

I'm finding this unreasonable as they are dictating which network, traffic should appear to be coming from (I have no idea why, I'm starting to think they don't know what they are talking about)

How am I meant to masquerade traffic as coming from 172.17.128.156 and route all traffic for 192.168.1.0 through that link?

I'm running Centos 5.0 and I have shorewall installed as my firewall/router setup.


Lets say my default gw is eth0
I then create a virtual interface called eth0:1 with the ip address of 172.16.100.10

I can't add the route 192.168.1.0/24 to dev eth0:1 specifically can I? It will just appear as eth0......

If anyone has any ideas or experience with this could you please help?

Thanks,
 
Old 12-19-2007, 05:08 AM   #2
stzein
Member
 
Registered: Mar 2004
Location: Antwerp, Belgium
Distribution: Gentoo
Posts: 65

Rep: Reputation: 15
I think you'll have to set up shorewall to use NAT. You tell it to send all traffic from your internal network destined for 192.168.1.0/24 over eth0:1.
I can't really help you with the specific configuration, but I'm sure you can find adequate documentation.
 
Old 12-19-2007, 07:41 PM   #3
xnomad
Member
 
Registered: Jun 2005
Posts: 53

Original Poster
Rep: Reputation: 15
Ok I figured out the masquerading by just reading the shorewall documentation and trial and error. This is how far I've got but I can't get IPsec working as it won't encrypt the traffic.

First I created a virtual NIC
My interfaces are bonded and I'm using Linux HA so I already have virtual IP's on my router so rather than create a bond1:1 which is my HA (heartbeat) virtual NIC. I had to create a bond1:2

so I created the file /etc/sysconfig/network-scripts/ifcfg-bond1:2
(other people might create a ifcfg-eth0:1 or ifcfg-eth1:1 depending on what interface they are doing this on)

I gave this new interface the address of 172.17.128.156/32

I then added a route for the 192.168.1.0/24 network to go via this interface with a

route add -net 192.168.1.0 netmask 255.255.255.0 gw 172.17.128.156

to make this route permanent on a redhat based system create a file like I have but make sure you name your interface correctly
/etc/sysconfig/network-scripts/route-bond1:2

and inside the file put
192.168.1.0/24 via 172.17.128.156

then bring the interface up with a /sbin/ifup bond1:2
do a netstat -rn to see the routing table and make sure it is correct.

Then in /etc/shorewall/masq

I added the following line:
bond:1:192.168.0.0/24 10.1.1.20/32 172.17.128.156

This means that all traffic destined for 192.168.0.0/24 from the internal machine 10.1.1.20 has a SNAT source address of 172.17.128.156.

I do a tcpdump -i bond1:2 -nnvv dst host 192.168.0.1

and on the machine 10.1.1.20 I ping 192.168.0.1

tcpdump shows me that the source address for these pings is 172.17.128.156.

So the masquerading is now working.

Only problem now is that if I use setkey to set my SA's for IPsec they take over the traffic for 192.168.0.1 before shorewall gets to them so I'm stuck again..... :-(
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Routing Issue marc hall Linux - Networking 4 07-18-2004 10:59 AM
routing issue.. inode100 Linux - Networking 12 02-25-2004 03:52 PM
routing issue RyPingu Linux - Networking 1 08-15-2003 01:39 PM
again: routing issue! mule Linux - Networking 4 08-07-2003 08:43 AM
Routing Issue jrmann1999 Linux - Networking 1 01-15-2002 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration