Escolar Documentos
Profissional Documentos
Cultura Documentos
xml
Summary: This
docum to
Content:1. Introductio conne
works
VPN c
1. Introduction
utilizin ge
the co
If you're
en nnect
you reading
work
likely
ng
to from your nee
thi
travel.
utilize
Many
concentrator
VPN
Cisco
illing
compa
Davidneed
H. Askew 300
to
bet bies
thatforced
think
most
to Author
ell,
connec
that
Linux
to this
use
th
document
that coconnecting
VPN
and
informs
le willis you veh
yt
Sven Vermeulen
to setup
el using
orkstation
a working
your Ge
or t
Contributor
Assumptions
Theat
assumptions
this point are
m
You
led
have Gentoo
You
sshave Internet
Youawant
Cisco
centrator
to3000
conne
V
You
ure,
know
new
build,
how
kernel
and
to c
2. Kernel Configuration
In order
ablenection
to
for
vice
open
driverLinux
support Universal TUN/TAP
a de to
V
must
kernel.
be
hy enabled
do
w What is you a rela
is
ne ini
forward
the dialog:
kernel
explanation confi
1 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
Youifcan
your
/TAP
verify
ollowing
kernel
support
your
ha
c
As you
CONFIG_TUN=m iscan
compiled
le. If
ur
seeit
setup
is
abo
di
a
enable
of choice,
ll,
itreboot
in
hisyour
ntinuing
docum
rebuild
and
ker
with the next steps.
If you
upport
built
ernel,
formation
directly
TUN/TA
dmesg you
output
sh
in
like the following:
If you
upport
u
build
first
tun module:
as
TUN/TA
must
a mod
lo
# modprobe tun
# lsmod
Module Size Used by
tun 7296 0
Now
tun module
that
k
dmesg output.
the
somethin
is loaded
You
following:
2 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
Now
orking
that
need you
kernel
net-misc/vpnc: tohave
insta
set
4. Example Setup
In order
llowing
lear,
tolesections
make
we
setup
or need
thethe
to
purposes
e, we
you will
rk
of
have
of
this
.assum
All
seve
aexeh
computers
92.168.0.0
5.0n network.
question
are
entoo
/ on
255 th
boxrewall,
using
DNS,querades
DHCP,
an etc
d iptable
the... ca
a
public
eives IP
also
from
naddress
on
have
h an
you
the a
ISit
L w
wantinto
to be
your able
office
to V
Our
nexample
configuration
e the followin
worksl
3 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
(Network configuration)
# cat /etc/hosts
127.0.0.1 desktop localhost
192.168.0.1 router
192.168.2.2 mediacenter
(Interface configuration)
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:11:2F:8D:08:08
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::211:2fff:fe8d:808/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3657889 errors:0 dropped:0 overruns:0 frame:0
TX packets:2305893 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2193722103 (2092.0 Mb) TX bytes:1415104432 (1349.5 Mb)
Interrupt:185 Memory:fac00000-0
(Routing information)
# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
loopback desktop 255.0.0.0 UG 0 0 0 lo
default router 0.0.0.0 UG 0 0 0 eth0
5. Configuring vpnc
4 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
If you
ort are
indows
your hat
forced
profile
is
you mach
a to
wfr
file ending
he information
. Below
in .pcf. This
is
[main]
Description=
Host=VPNGATEWAY.DOMAIN.ORG
AuthType=1
GroupName=group_id
GroupPwd=
enc_GroupPwd=F3256220AA200A1D532556024F4F314B0388D48B0FBF2DB12
EnableISPConnect=0
ISPConnectType=0
ISPConnect=FOOBAR
ISPCommand=
Username=
SaveUserPassword=0
UserPassword=
enc_UserPassword=
NTDomain=
EnableBackup=0
BackupServer=
EnableMSLogon=1
MSLogonType=0
EnableNat=1
TunnelingMode=0
TcpTunnelingPort=10000
CertStore=0
CertName=
CertPath=
CertSubjectName=
CertSerialHash=00000000000000000000000000000000
SendCertChain=0
VerifyCertDN=
DHGroup=2
ForceKeepAlives=0
PeerTimeout=90
EnableLocalLAN=0
EnableSplitDNS=1
ForceNetLogin=0
In the
we Host, above
canGroupName and see
enc_GroupPwd. Your
examp
entri
Username and
UserPassword may orted or setup. may
depen To
no
working tion se out
pcf2vpnc, included
vpnc of it,
configw
you
Note: You
ssword
can
m the
decrypt
cisco-decrypt program,
with
thethe
late
theh
s
vpnc.
5 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
Now nfiguration
that
time
you
To to
vpnc you
start
test
have
in do
pla
y
following:
# vpnc
Enter password for username@vpngateway.domain.org:
VPNC started in background (pid: 14788)...
As e
youabove
ut,
can
vpnc once
(as
comma
see
pted
root),
you
from
for r
your
entering
d, password.
which
oed vpnc your
back
willpn
process
lly become
d process.
will automa
a bac
# ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:11:2F:8D:08:08
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::211:2fff:fe8d:808/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2101119 errors:0 dropped:0 overruns:0 frame:0
TX packets:1577559 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1757862627 (1676.4 Mb) TX bytes:732200131 (698.2 Mb)
Interrupt:177 Memory:faa00000-0
# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
vpn01.domain.or router 255.255.255.255 UGH 1500 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth1
loopback desktop 255.0.0.0 UG 0 0 0 lo
default * 0.0.0.0 U 0 0 0 tun0
6 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
As e
you
above
ut(s),
can
vpnc hascomma
see
done
from
th
Created
rk interface,
terface
the
ffic tun0
acros
toaha
v
n
tunnel
Obtained
s for
mthe
your
the
tun0
IP
VPNad
d
Set your
the default
VPN gate
rou
At this
station
mmunicating
point,
via
is vpnc
capabl
your
the VPw
sets
toyour
your
ll network
vel
default
VPN
enacross
if
gat
tra
ro
it
destined
t orifically
elsewhere
for
itional
,
thespecifi
this
rout
Inte
n
basic
n may
type
butsteps
be
for
of satisfa
most,
conne
nee
Additional
ight wantthings
to have
yo
When
endxecute
you
the are
vpnc-disconnect. VPN
An read
exam
ses
below.
Note: Don't
cause
disconnect
al things
mple
we have
below
to yet
tes
ad
informational
. purpose
# vpnc-disconnect
Terminating vpnc daemon (pid: 26250)
6. Set up DNS
Unfortunately,
vpnc doesn't
p and
NS handle
manag
lished
for you t
tunnel. to decide
uldThe
ld
bejust
user
how
handle
ove
is
D
/etc/resolv.conf whenthat
VPN
you
would
ueries
conne
DNS ut
regardless r noted the
for
This
of
traffic
l
your
wheth
is a V
is
solution ly need
e tunnel,
and
and
to ad
if
conne
then
you
do
no y
s
further. t to rbe
tunnel
But,
ngthy
ableif
d you
conn
to
peri
lew
don't NS want
uests
servers
traffic,
your
forhandyou
wor
rea
Thellow
ideal
ur you
DNS
setup
categorie
to
d queri
and
sepa
wou
other.
, allueries
Under
VPN-related
ed by
ted
would
this
DNS
atse
thePNother
queries
tunnel
to
end be
l or
and
of
would
answ
ISP
you
a
supplied
This ill is
be
DNS
. the
demons
setup
serve
Note: We elated
will
e consider
any
to
DNS
the
query
ain,
queri
exam
suc
VPN
be
as host1.example.org
r server1.example
So gs
how up,
estsdo theso
made
youthat
examp
get setto
on
sentNStore
servers?
VPN going
ll a ut
supplie
local
to
don'
Wene
D
worry,
thanre
it's
youseveral
kages
much
he
think.
type
tha
eas
soT
of setup
for demonstratio
the we
dnsmasq will be
purposes
desire, ut
emerge it now:
7 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
# emerge dnsmasq
Nown option
you
dnsmasq startup
need
e followin
tot your
optio
to ad
your
.example.org
needs.
ppropriate
he lid
IP
Substit
addr
DNS
wit
do
server
he VPNthat belongs
tunnel.
# See the dnsmasq(8) man page for possible options to put here.
DNSMASQ_OPTS="-S /.example.org/192.168.125.10"
Next,
e first
make entry sure
127.0.0.1, in tha
/etc/reso
followed
of rvers
the by the
backup that
theDNSloca
sho D
dnsmasq
or ifait DNS
needs
fails
currently che.
query
to to
sta
An f
example /etc/resolv.conf is show
nameserver 127.0.0.1
nameserver 192.168.0.1
Now
p a
that
nnel
rule
start
you DNS,
forhave
dnsmasq. your
yo
# /etc/init.d/dnsmasq start
# rc-update add dnsmasq default
The ldideal
beestined
if
would
scenario
onlylink.
for
the
trav
VP
A t
thisPN
point,
traffic
tunnelthe
youspecify
will
setup
tunne
havetra
additional
er to
ou fix
need
etworks
routes.
this
youto
situa
on
kn
ar
In
yourwayVPN.
ded
to kfind
informati
The
a or,
networ
out
eas
but th
sometimes
uctant
uestions.
etwork
to they
answer
vide If
are
adth
yo
needed
e trial
ents
information
andwill error
be re
When
as
vpnc set the
the
t
started,
the VPNtunnel
set
defau
yo
tunn
default
rmal, rk
route
as
so expecte
that
backthin
t
Earlier,
ices red
were
when
pecified
foro being
your
DNS aV
handle
g domain.
add
your
168.125.0
a examp
route
t You
DNS fo
n
queries will work.
8 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
At this
d add
tes
point,
any
for
(such
t you
known
additio
assh
192.168.160.0,
cludes
eceived
P the
virtual
r IP
by
whi
ad
th
d
friendly
strator
uired
network
ise,
gave
info,
ing
youyou
adm
gre
m
hostscting
you
ive to
ut
yourself
will
frequent
what
lebe co
yo
a
should look like.
Note: Due
n to
using
rvices
your
stVPN
specify
setup,
ied
by nam
netww
th
domain nce:le.org
webserver1.e
name, for ins
# ping intranet1.example.org
PING intranet1.example.org (172.25.230.29) 56(84) bytes of data.
As e
you
above
ing
can probes exampl
see
intranet1.example.org were
from
to
unsuccessful.
ed to
t subnet.
add aSo
route
w
A few
mmands
uld
pingbe
toand
g
later,
awell
table
well
rout
on
yw
Next
iptis
to
connection.
an
manage
xecute
example
an it
thY
(
xterm
tionto
all
tostart
ess
you
yourt return
the
a
have
VPN
con
VPN.
ll need
Obviously
r your
ing
to nal
setup,
modify
to add
you
routes
ed. that you may
9 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
#!/bin/bash
source /sbin/functions.sh
read $disconnect
Version contains
0.4.0-r1
tiple
an init
of
configurations. ault script
onf, but
tions
looks
as
Thema
can ssible.beshutdown
imagined
custom-m
Before
n be an
ar
an
executed ected thecript
by
that
correspon
their
1-r1).
(since
are na
c
Their names end in
/etc/init.d/scripts.d/ directory.
namingched The
sche
in th
table.
Addlevel
vpnc
commands
with
for
to uration
default
the
the folsta
(i
Don't
tunforget
built
module
kernels
it
to
anism
that
add
(if yo
w
aa
startup.
If you
e your
don't
configuration
an passwordwanttell
how the
to
all
output standard
ngand prompts
output
/etc/conf.d/vpnc. Set th
VPNCOUTPUT to yes
default
screen
or no, is to
whe
out
n
10 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
Note: Thendle
init
utDNS
scripts
you
m scripts
t.
can
separa
See
don't
use
to
Tips . and Tricks
If you
Linux
are
pports
application
esktop
looking
ive
RDP Pro
fo
(
grdesktop a try.
ritten
in
It's
well
in
sktop,
a GTK+
GUI
with
bu
a
require ant n the
it.
dialogs
If
provides,
GUI
you
all conf
tha
don
rdesktop. Ultimately,
is just
sktop.a fronten
grdes
If you
you are
kvpnc. It ery
a
might
a appears
matur
KDE
want
ust
management GUI.
If you
to awhich
need
Windows
NS to
doesn'
entry,
the
connm
address WINS
use of
nmblookup server,
ato
an query
toolavaila
cal
yo
server e of
ant
for
the rtunately,
tothe
machine
stall
connec
host n
samba to get
going
thit,boxes ws
but
to be
you
if you
run
wom
want ecause
to
ral install
other it include
samb
usef
When
and
test
you its
nmblookup byhave
tools
rver
asking
at
sam
ins
I
address
about
ntelbox1. 192.168.12
a host na
Thets custom-made
for up
the g
a init.dfor
user-d
file the c s
vpnc
xamples
connection.
w to
able
setup
below
ctions so thTh s
to 123.234.x.x
d over
otherhe
theconnec
default
VPNare r
example
up.shnt default
uses
to
re save
starting
resets work
gat th
thengdefault
.
the
Once
tarted,
VPN
gatewayvpncconn h
work-postup.sh
deletes
t gateway,
old
this
ddefault
sets
new resto
thede g
connections
.x.x nnection.
to use to the
123. vp
#!/bin/sh
route -n | grep -E '^0.0.0.0 ' | cut -c 17-32 >/var/tmp/defaultgw
#!/bin/sh
route del -net 0.0.0.0 netmask 0.0.0.0 dev tun1
route add default gw $(cat /var/tmp/defaultgw)
route add -net 123.234.0.0 netmask 255.255.0.0 dev tun1
11 of 12 10/22/10 23:48
Gentoo Linux Documentation -- Gentoo vpnc HOWT O http://www.gentoo.org/doc/en/vpnc-howto.xml
Thesume
example
nection
that
n device.
hethe
script
usesvpY
device
nection's
ile.
name configu
in the
vpnc homepage
kvpnc homepage
grdesktop homepa
Hopefully
ave ctbeen
to
eby
your
anday
able
nowto
are
VPyo
to
remote
l bugs.gentoo.o
free should
ke
office
to fileor
work.
a you
wis
bu
make
ommendation
an
this
addition
documen re
o
The
cument
contents
nder
Creative
ttribution
are
theoflicense
this
Com /d
license.
12 of 12 10/22/10 23:48