FreeS/WAN에서 핑이 안됩니다.

ejungw의 이미지

안녕하세요? 와우리눅스7.1(커널2.4.2)에서 FreeS/WAN 1.99를 설치하고 있습니다.

      subnet ----- left gateway === right gateway ----- subnet
192.168.2.0         X.X.X.117         X.X.X.151           192.168.1.0

로 구성이 되어있구요. 각 서브넷에는 윈2000이깔린 컴이 한대씩 물려있습니다.

ipsec whack --status 를 한 결과는 다음과 같습니다.

000 interface ipsec0/eth0 X.X.X.151
000  
000 "myfreeswan": 192.168.1.0/24===X.X.X.151...X.X.X.117===192.168.2.0/24
000 "myfreeswan":   ike_life: 3600s; ipsec_life: 28800s; rekey_margin: 540s; rekey_fuzz: 100%; keyingtries: 0
000 "myfreeswan":   policy: RSASIG+ENCRYPT+AUTHENTICATE+COMPRESS+TUNNEL+PFS; interface: eth0; erouted
000 "myfreeswan":   newest ISAKMP SA: #1; newest IPsec SA: #4; eroute owner: #4
000  
000 #4: "myfreeswan" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 25675s; newest IPSEC; eroute owner
000 #4: "myfreeswan" ah.2d658a36@X.X.X.117 ah.cf65afea@X.X.X.151 esp.2d658a37@X.X.X.117 esp.cf65afeb@X.X.X.151 comp.8001@X.X.X.117 comp.90cb@X.X.X.151 tun.1004@X.X.X.117 tun.1003@X.X.X.151
000 #1: "myfreeswan" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 448s; newest ISAKMP
000 #3: "myfreeswan" STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 26349s
000 #3: "myfreeswan" ah.2d658a34@X.X.X.117 ah.cf65afe8@X.X.X.151 esp.2d658a35@X.X.X.117 esp.cf65afe9@X.X.X.151 comp.8000@X.X.X.117 comp.90ca@X.X.X.151 tun.1002@X.X.X.117 tun.1001@X.X.X.151
000 #2: "myfreeswan" STATE_MAIN_R3 (sent MR3, ISAKMP SA established); EVENT_SA_REPLACE in 1149s
000  

X.X.X.151(right gateway)에서 route를 한 결과는 다음과 같습니다

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     X.X.X.117       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 eth1
X.X.X.0         0.0.0.0         255.255.255.0   U     0      0        0 eth0
X.X.X.0         0.0.0.0         255.255.255.0   U     0      0        0 ipsec0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         X.X.X.1         0.0.0.0         UG    0      0        0 eth0

ipsec.conf라는 설정파일은 다음과 같습니다.

                 # /etc/ipsec.conf - FreeS/WAN IPsec configuration file

# More elaborate and more varied sample configurations can be found
# in FreeS/WAN's doc/examples file, and in the HTML documentation.



# basic configuration
config setup
	# THIS SETTING MUST BE CORRECT or almost nothing will work;
	# %defaultroute is okay for most simple cases.
	interfaces=%defaultroute
	# Debug-logging controls:  "none" for (almost) none, "all" for lots.
	klipsdebug=none
	plutodebug=none
	# Use auto= parameters in conn descriptions to control startup actions.
	plutoload=%search
	plutostart=%search
	# Close down old connection when new one using same ID shows up.
	uniqueids=yes



# defaults for subsequent connection descriptions
# (these defaults will soon go away)
conn %default
	keyingtries=0
	disablearrivalcheck=no
	authby=rsasig
	leftrsasigkey=%dnsondemand
	rightrsasigkey=%dnsondemand


# connection description for opportunistic encryption
# (requires KEY record in your DNS reverse map; see doc/opportunism.howto)

conn myfreeswan
	left=X.X.X.117
	leftsubnet=192.168.2.0/24
	###leftfirewall=yes
	#leftnexthop=X.X.X.151
	right=X.X.X.151
	rightsubnet=192.168.1.0/24
	###rightfirewall=yes
	#rightnexthop=X.X.X.117
	keyingtries=0
	auth=ah
	authby=rsasig
	leftrsasigkey=0sAQOmLHNSsbrKRt9nhhyWxBMZORwaHknkaXUrs8w2RzKBiCMTCQbfc3emZnBDBs2fOdjN6X3TLlQ1S2iw5D/EC5xs0uVN6k3FP9uibQfBCkmbL0/r+/Rg1jyMU0THFKoCLTnBpSI8U38VE/ButiVD3EneqWJ82qKSFQRzhQ/s9EiPBQ==
	rightrsasigkey=0sAQPQeiC87Ar/pXIqkk6UzrlTcYtTcgclI1VLJUA/rqF/YTZIxrtj7n0C/WoHxKnPXGvyBcizo2CCVe4OJl5w7fjRDofuOpGFWcnhBTH/UMrO7nyQzaUssBq/iRDrBP3IIZaMxYbROrSr7LSeBWyhxyWba0QPNS8gB/EubMrdLwnu9w==
	auto=start
	compress=yes

conn me-to-anyone
	left=%defaultroute
	right=%opportunistic
	keylife=1h
	rekey=no
	# for initiator only OE, uncomment and uncomment this 
	# after putting your key in your forward map 
	#leftid=@myhostname.example.com
	# uncomment this next line to enable it
	#auto=route


# sample VPN connection
conn sample
	# Left security gateway, subnet behind it, next hop toward right.
	left=10.0.0.1
	leftsubnet=172.16.0.0/24
	leftnexthop=10.22.33.44
	# Right security gateway, subnet behind it, next hop toward left.
	right=10.12.12.1
	rightsubnet=192.168.0.0/24
	rightnexthop=10.101.102.103
	# To authorize this connection, but not actually start it, at startup,
	# uncomment this.
	#auto=add

왼쪽서브넷에 있는 컴퓨터에서 오른쪽 서브넷에 있는 컴퓨터로 핑이 가야 한다고 (또는 그 반대방향) 매뉴얼에는 적혀 있는데 계속 request timed out이 나옵니다.
라우팅경로나 iptables문제 같기도 한데.. 잘 안됩니다. 현재는 각 게이트웨이에서 iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to X.X.X.151 이런식으로 마스커레이딩을 하여 서브넷에 있는 컴이 인터넷을 하고 있습니다.
(iptables로 다른 부분은 막지 않았습니다.)

도움을 부탁드립니다.

그럼 좋은 하루 되십시오.

bean의 이미지

저는 이부분에 대해서는 잘 모르지만 한가지만 짚어볼까합니다.

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to X.X.X.151 라는 부분이 문제가 되는것 같군요
이렇게 쓰면 당연히 X.X.X.151로 보내는게 아닐까 생각되네요.

제생각으로는 아래와 같이 사용하는게 맞지 않을까 생각되네요

iptables -t nat –F
iptables -t nat -A POSTROUTING -o eth0 -d \! 10.0.0.0/8 -j MASQUERADE

이렇게 iptables코드를 사용하는데 맞지 않을가 생각되네요...

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.