LinuxQuestions.org
Visit Jeremy's Blog.
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 05-06-2003, 12:32 PM   #1
razametal
LQ Newbie
 
Registered: Apr 2003
Location: Manta - Ecuador - South America
Distribution: Debian
Posts: 19

Rep: Reputation: 0
FreeSWan: Canīt ping through tunnel


Hi

I am trying to set up Freeswan between two Redhat servers (9.0 and 7.3).

They both have static ip addresses and I am using the net-to-net connection. I have installed version 1.99 with x.509 support rpm's.

192.168.1.0/24 --> LINUX FIREWALL A /VPN ========= LINUX FIREWALL B/VPN <---- 192.168.3.0/24


The following is an example of my ipsec.conf file:

conn manicentro-merced
left=216.219.56.200
leftsubnet=192.168.1.0/24
leftid=@left.test.com
leftrsasigkey=0sAQNzsT5wkoF....
leftnexthop=216.219.56.1
right=216.219.56.119
rightsubnet=192.168.3.0/24
rightid=@right.test.com
rightrsasigkey=0sAQNQdzFuK...
rightnexthop=216.219.56.117
auto=add

I have turned off the rp_filter on the external interfaces for both servers.

I have opened up upd 500 and have entered the following rules for the ESP protocol to the end of the script:

# === >> VPN << === #

# === >> IKE << === #
iptables -A INPUT -p udp -i eth0 --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -p udp -o eth0 --sport 500 --dport 500 -j ACCEPT

# === >> ESP << === #
iptables -A INPUT -p 50 -i eth0 -j ACCEPT
iptables -A OUTPUT -p 50 -o eth0 -j ACCEPT

# === >> AH << === #
iptables -A INPUT -p 51 -j ACCEPT
iptables -A OUTPUT -p 51 -j ACCEPT


When I start ipsec and bring up the tunnel, everything comes up fine and it indicates that the tunnel is stablished. However, I can not ping between the two subnets.

I think that it is a problem with my firewall script but I am not am iptables rules expert. Has anyone had any luck using freeswan with iptables? This is my first attempt with Freeswan and I would appreciate any help that could be offered.

Thank you,
 
Old 05-06-2003, 01:57 PM   #2
td3201
Member
 
Registered: Jan 2002
Location: Omaha, NE US
Distribution: Red Hat/CentOS
Posts: 226

Rep: Reputation: 30
I recommend you try the opportnistic encryption support with 2.00 that was just released.

Is that your full IPTABLES script? Do you have a deny all rule someplace?
 
Old 05-07-2003, 09:33 AM   #3
razametal
LQ Newbie
 
Registered: Apr 2003
Location: Manta - Ecuador - South America
Distribution: Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Hi.. iīll test the oportunistic encryption that you are seggeting me.

Iīve this small firwall script:

#!/bin/sh

# Load required modules
depmod -a
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe ipt_MASQUERADE
modprobe ipt_owner
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc

# Then flush all rules
iptables -F
iptables -t nat -F

# Turn on IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "0" > /proc/sys/net/ipv4/conf/eth0/rp_filter

# Red Cyber 10.10.10.0 is the eth1 and 192.168.1.0 is the eth2
iptables -t nat -A POSTROUTING -d ! 10.10.10.0/24 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 192/8 -d ! 192/8 -j MASQUERADE


iptables -A FORWARD -s 10.10.10.0/24 -j ACCEPT
iptables -A FORWARD -d 10.10.10.0/24 -j ACCEPT
#iptables -A FORWARD -s ! 10.10.10.0/24 -j DROP

# port 113 is evil
iptables -A INPUT --protocol udp --source-port 113 -j DROP
iptables -A INPUT --protocol udp --destination-port 113 -j DROP

# Enmascaramiento
iptables -A INPUT -p ALL -s 216.219.56.16/28 -j ACCEPT
iptables -A INPUT -p ALL -d 216.219.56.16/28 -j ACCEPT
iptables -A FORWARD -p ALL -s 216.219.56.16/28 -j ACCEPT
iptables -A FORWARD -p ALL -d 216.219.56.16/28 -j ACCEPT
iptables -A OUTPUT -p ALL -s 216.219.56.16/28 -j ACCEPT
iptables -A OUTPUT -p ALL -d 216.219.56.16/28 -j ACCEPT
iptables -t nat -A PREROUTING -p ALL -s 216.219.56.16/28 -j ACCEPT
iptables -t nat -A PREROUTING -p ALL -d 216.219.56.16/28 -j ACCEPT
iptables -t nat -A POSTROUTING -p ALL -s 216.219.56.16/28 -j ACCEPT
iptables -t nat -A POSTROUTING -p ALL -d 216.219.56.16/28 -j ACCEPT

iptables -A INPUT -p ALL -s 216.219.56.32/27 -j ACCEPT
iptables -A INPUT -p ALL -d 216.219.56.32/27 -j ACCEPT
iptables -A FORWARD -p ALL -s 216.219.56.32/27 -j ACCEPT
iptables -A FORWARD -p ALL -d 216.219.56.32/27 -j ACCEPT
iptables -A OUTPUT -p ALL -s 216.219.56.32/27 -j ACCEPT
iptables -A OUTPUT -p ALL -d 216.219.56.32/27 -j ACCEPT
iptables -t nat -A PREROUTING -p ALL -s 216.219.56.32/27 -j ACCEPT
iptables -t nat -A PREROUTING -p ALL -d 216.219.56.32/27 -j ACCEPT
iptables -t nat -A POSTROUTING -p ALL -s 216.219.56.32/27 -j ACCEPT
iptables -t nat -A POSTROUTING -p ALL -d 216.219.56.32/27 -j ACCEPT

# === >> VPN << === #

# === >> IKE << === #
iptables -A INPUT -p udp -i eth0 --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -p udp -o eth0 --sport 500 --dport 500 -j ACCEPT

# === >> ESP << === #
iptables -A INPUT -p 50 -i eth0 -j ACCEPT
iptables -A OUTPUT -p 50 -o eth0 -j ACCEPT

# === >> AH << === #
iptables -A INPUT -p 51 -j ACCEPT
iptables -A OUTPUT -p 51 -j ACCEPT

# Proxy
iptables -t nat -A PREROUTING -i eth1 -d ! 216.219.56.2 -p tcp --dport 80 -j RED
IRECT --to-port 8080

# END
 
Old 05-07-2003, 09:36 AM   #4
razametal
LQ Newbie
 
Registered: Apr 2003
Location: Manta - Ecuador - South America
Distribution: Debian
Posts: 19

Original Poster
Rep: Reputation: 0
This is my routing table on left:

netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
216.219.56.0 0.0.0.0 255.255.255.252 U 0 0 0 eth0
216.219.56.0 0.0.0.0 255.255.255.252 U 0 0 0 ipsec0
216.219.56.8 216.219.56.18 255.255.255.248 UG 0 0 0 eth1
216.219.56.16 0.0.0.0 255.255.255.240 U 0 0 0 eth1
216.219.56.32 0.0.0.0 255.255.255.224 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 216.219.56.1 128.0.0.0 UG 0 0 0 ipsec0
128.0.0.0 216.219.56.1 128.0.0.0 UG 0 0 0 ipsec0
0.0.0.0 216.219.56.1 0.0.0.0 UG 0 0 0 eth0
 
Old 05-07-2003, 09:39 AM   #5
td3201
Member
 
Registered: Jan 2002
Location: Omaha, NE US
Distribution: Red Hat/CentOS
Posts: 226

Rep: Reputation: 30
First, simplify things and cut down your firewall to something extremely simple, like no filtering, just forward. Also, you dont need the '-p ALL' stuff, when you omit the -p, all is assumed.
 
Old 05-07-2003, 12:08 PM   #6
razametal
LQ Newbie
 
Registered: Apr 2003
Location: Manta - Ecuador - South America
Distribution: Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Hi.. I got the tunnel with FreesWan 2.0 , but I canīt ping the two lans.

# ipsec auto --verbose --up manicentro-merced
002 "manicentro-merced" #3: initiating Quick Mode RSASIG+ENCRYPT+TUNNEL+PFS+UP
112 "manicentro-merced" #3: STATE_QUICK_I1: initiate
002 "manicentro-merced" #3: sent QI2, IPsec SA established
004 "manicentro-merced" #3: STATE_QUICK_I2: sent QI2, IPsec SA established


192.168.1.0/24 is manicentro
192.168.3.0/24 is merced

If I ping from 192.168.1.1 (is a manicentro terminal, not the firewall) to 192.168.3.9 (is a merced terminal, not the firewall) and make tcpdump -i ipsec0 on left, I get:

[..]
12:00:12.472632 carcesa.com > 192.168.3.9: icmp: echo request (DF)
[..]

This is my routing table on left:
netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
216.219.56.0 0.0.0.0 255.255.255.252 U 0 0 0 eth0
216.219.56.0 0.0.0.0 255.255.255.252 U 0 0 0 ipsec0
216.219.56.8 216.219.56.18 255.255.255.248 UG 0 0 0 eth1
216.219.56.16 0.0.0.0 255.255.255.240 U 0 0 0 eth1
216.219.56.32 0.0.0.0 255.255.255.224 U 0 0 0 eth1
192.168.3.0 216.219.56.1 255.255.255.0 UG 0 0 0 ipsec0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 216.219.56.1 128.0.0.0 UG 0 0 0 ipsec0
128.0.0.0 216.219.56.1 128.0.0.0 UG 0 0 0 ipsec0
0.0.0.0 216.219.56.1 0.0.0.0 UG 0 0 0 eth0


And the routing table on right:
netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
216.219.56.16 0.0.0.0 255.255.255.240 U 40 0 0 wlan0
216.219.56.16 0.0.0.0 255.255.255.240 U 40 0 0 ipsec0
10.10.10.0 0.0.0.0 255.255.255.240 U 40 0 0 eth0
192.168.3.0 0.0.0.0 255.255.255.0 U 40 0 0 eth0
192.168.1.0 216.219.56.17 255.255.255.0 UG 40 0 0 ipsec0
127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
0.0.0.0 216.219.56.17 128.0.0.0 UG 40 0 0 ipsec0
128.0.0.0 216.219.56.17 128.0.0.0 UG 40 0 0 ipsec0
0.0.0.0 216.219.56.17 0.0.0.0 UG 40 0 0 wlan0
 
Old 05-07-2003, 11:22 PM   #7
razametal
LQ Newbie
 
Registered: Apr 2003
Location: Manta - Ecuador - South America
Distribution: Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Arghh...

what you think about openvpn ? ttp://openvpn.sf.net

Any 1 have tryed ?
 
  


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
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 02:39 PM
freeswan Ammad Linux - Networking 0 10-08-2004 02:36 AM
FreeSwan on 9.1 kkiedrowski Slackware 2 04-01-2004 07:30 AM
freeswan: CANNOT PING any remote machine cccc Linux - Networking 0 01-27-2004 06:01 PM
Freeswan PGPNET The Jesus Linux - Software 1 11-27-2002 05:41 PM

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

All times are GMT -5. The time now is 01:30 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