Ena ogwiritsira ntchito akufunanso kupanga pakompyuta pamtunda pakati pa makompyuta awiri. Amapereka ntchitoyo mothandizidwa ndi teknoloji ya VPN (Virtual Private Network). Kugwirizana kumeneku kumayendetsedwa kudzera kumagulu otsegulidwa kapena otsekedwa ndi mapulogalamu. Pambuyo pomangika bwino ndikukonzekera zigawo zonse, ndondomekoyi ikhonza kukhala yodzaza, ndi kugwirizana - kotetezedwa. Kuwonjezera apo, tikufuna kukambirana mwatsatanetsatane za kukhazikitsidwa kwa tekinoloje yoganiziridwa kudzera mwa kasitomala OpenVPN mu dongosolo loyendetsera ntchito pogwiritsa ntchito kernel ya Linux.
Ikani OpenVPN pa Linux
Popeza anthu ambiri amagwiritsa ntchito magawidwe a Ubuntu, lero malangizowa adzakhazikitsidwa pamatembenuzidwe awa. Nthaŵi zina, kusiyana kwakukulu mu kukhazikitsa ndi kukonza kwa OpenVPN simudzazindikira, kupatula ngati mutatsatira tsatanetsatane wa kufalitsa, zomwe mungathe kuziwerenga mu zolembedwera zadongosolo lanu. Timakupatsani inu kuti mudzidziwe nokha ndi ndondomeko yonseyo kuti muzimvetse mwatsatanetsatane ntchito iliyonse.
Onetsetsani kukumbukira kuti opaleshoni ya OpenVPN imapezeka kudzera m'makina awiri (kompyuta kapena seva), zomwe zikutanthauza kuti kukhazikitsa ndi kukonzekera kumagwira ntchito kwa onse omwe akugwirizana nawo. Phunziro lathu lotsatira lidzakumbukira kugwira ntchito ndi magwero awiri.
Khwerero 1: Sungani OpenVPN
Inde, muyenera kuyamba kuwonjezera makalata onse oyenera ku makompyuta. Konzani kuonetsetsa kuti ntchito yogwiritsidwa ntchito idzakhala yokhazikika mu OS. "Terminal".
- Tsegulani menyu ndipo yambani kutsegula. Mukhozanso kuchita izi mwakulumikiza makiyi ofunikira Ctrl + Alt + T.
- Lembani gulu
Sudo apt kukhazikitsa openvpn mosavuta-rsa
kukhazikitsa zofunikira zonse zofunikira. Pambuyo polowani dinani Lowani. - Tchulani mawu achinsinsi pa akaunti yodabwitsa. Omwe akujambula samawoneka m'bokosi.
- Onetsetsani Kuwonjezera kwa mafayilo atsopano mwa kusankha njira yoyenera.
Pitani ku sitepe yotsatira pokhapokha ngati maimidwewa apangidwa pa zipangizo ziwirizo.
Gawo 2: Kupanga ndi Kukonza Chidziwitso Chachidziwitso
Chidziwitso cha malo ndi udindo woonetsetsa makiyi a anthu ndikupatsirana mwamphamvu. Icho chimalengedwa pa chipangizo chimene otsala ena adzalumikizana nacho, kenaka mutsegule pulogalamuyi pa PC yofunayo ndikutsata izi:
- Foda ya kusungiramo mafungulo onse adayambitsidwa. Mutha kuziika paliponse, koma ndi bwino kupeza malo otetezeka. Gwiritsani ntchito lamulo ili
sudo mkdir / etc / openvpn / zosavuta
kumene / etc / openvpn / zosavuta - Malo okonza cholemba. - Kuwonjezera pa foda iyi imayenera kuyika mosavuta-rsa zowonjezerapo, ndipo izi zachitika
sudo cp -R / usr / gawo / mosavuta-rsa / etc / openvpn /
. - Chigawo chovomerezeka chimapangidwira m'ndandanda yokonzeka. Choyamba pitani ku foda iyi.
cd / etc / openvpn / zovuta-rsa /
. - Kenaka pangani lamulo lotsatila kumunda:
sudo -i
#yambira ./vars
# ./clean-all
# ./build-ca
Pamene kompyutesi ya seva ingasiyidwe yokha ndikusunthira ku makasitomala apamwamba.
Khwerero 3: Konzani Zolemba Zanyumba
Malangizo, omwe mudzawadziwe pansipa, adzafunika kuchitidwa pa kompyuta iliyonse ya kasitomala kuti akonze mgwirizano wotetezeka wogwira ntchito bwino.
- Tsegulani console ndipo lembani lamulo pamenepo.
sudo cp -R / usr / gawo / mosavuta-rsa / etc / openvpn /
kuti mufanizire zida zonse zofunika zolemba. - Poyamba, fayilo yapadera yovomerezeka inalengedwa pa PC seva. Tsopano ikufunika kuti ikopedwe ndi kuyikidwa mu foda ndi zigawo zina. Njira yosavuta yochitira izi ndi kudzera mwa lamulo.
sudo scp username @ host: /etc/openvpn/easy-rsa/keys/ca.crt / etc / openvpn / zovuta-rsa / makiyi
kumene username @ wothandizira - adiresi ya zipangizo zomwe mungatsatire. - Zimangokhala pokhapokha mutsegula chinsinsi chachinsinsi kuti mtsogolomu ikhale yolumikizidwa kudzera mu izo. Chitani izi mwa kupita ku foda yosungirako script.
cd / etc / openvpn / zovuta-rsa /
. - Kuti mupange fayilo, gwiritsani ntchito lamulo:
sudo -i
#yambira ./vars
# Lupics zokonzaLumpics Pankhaniyi, dzina la fayilo. Mfungulo wopangidwawo uyenera kuti ukhale m'ndandanda womwewo ndi mafungulo ena.
- Ikutsalira kokha kutumiza chinsinsi chofikira cholozera ku chipangizo cha seva kuti chitsimikizire kutsimikizika kwa kugwirizana kwake. Izi zachitika ndi kuthandizidwa ndi lamulo lomwelo lopangidwa. Muyenera kulowa
scp /etc/openvpn/easy-rsa/keys/Lumpics.csr dzina lanu @ host: ~ /
kumene username @ wothandizira - dzina la kompyuta kutumiza, ndi Lumpics.csr - dzina la fayiloyo ndi fungulo. - Pa PC seva, chitsimikizani makiyiwo kudzera
./sign-req ~ / Lumpics
kumene Lumpics - fayilo dzina. Pambuyo pake, bweretsani chikalatachosudo scp username @ host: /home/Lumpics.crt / etc / openvpn / zovuta-rsa / makiyi
.
Ili ndilo mapeto a ntchito yoyamba yonse, zonse zomwe zatsala ndikutulutsa OpenVPN yokha ku boma labwino ndipo mungayambe kugwiritsa ntchito mgwirizano wamtundu wapadera ndi mmodzi kapena angapo makasitomala.
Khwerero 4: Konzani OpenVPN
Chotsatira chotsatirachi chidzagwiritsidwa ntchito kwa onse ofuna chithandizo ndi seva. Tidzagawa zonse molingana ndi zochita ndikuchenjeza za kusintha kwa makina, kotero muyenera kutsatira malangizo.
- Choyamba, pangani mafayilo osinthika pa PC seva pogwiritsa ntchito lamulo
zcat /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz | sudo tee /etc/openvpn/server.conf
. Pamene mukukonzekera zipangizo zamakono, fayiloyi iyeneranso kulengedwa mosiyana. - Werengani mfundo zoyenera. Monga momwe mukuonera, doko ndi ndondomeko zili zofanana ndi zomwe zilipo, koma palibe magawo ena.
- Tengerani makina okonzekera mafayilo kudzera mu editor
sudo nano /etc/openvpn/server.conf
. - Sitidzatha kusintha ndondomeko zonse, popeza nthawi zina iwo ali pawokha, koma mizere yoyenera mu fayilo iyenera kukhalapo, koma chithunzi chomwecho chikuwoneka ngati ichi:
doko 1194
proto udp
comp-lzo
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/ca.crt
dh /etc/openvpn/easy-rsa/2.0/keys/dh2048.pem
subnet
seva 10.8.0.0 255.255.255.0
ngaticonfig-pool-imapitiriza ipp.txtZonsezi zitatha, sungani zosintha ndi kutseka fayilo.
- Gwiritsani ntchito gawo la seva lakwaniritsidwa. Thamangani OpenVPN kupyolera muzithunzi zosinthika
openvpn /etc/openvpn/server.conf
. - Tsopano tiyambitsa makasitomala apangizo. Monga tanenera kale, mafayilo opangidwirawo adalengedwanso pano, koma nthawiyi sichimasulidwa, kotero lamulo liri ndi mawonekedwe awa:
sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn/client.conf
. - Kuthamangitsa fayilo mofanana ndiwonetsedwa pamwambapa ndi kuyika mizere yotsatira apo:
wothandizira
.
dev tun
proto udp
kutali 194.67.215.125 1194
tsimikizani-yesetsani zosatha
nobind
pitirizani-fungulo
Pitirizani kugwirizana
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Sergiy.crt
Chinsinsi /etc/openvpn/easy-rsa/keys/Sergiy.key
tls-auth ta.key 1
comp-lzo
vesi 3Kusintha kukamaliza, yambani OpenVPN:
openvpn /etc/openvpn/client.conf
. - Lembani gulu
ifconfig
kuonetsetsa kuti dongosolo likugwira ntchito. Mwazinthu zonse zomwe zikuwonetsedwa, payenera kukhala mawonekedwe tun0.
Kuti mutsogolere pamsewu ndi kutsegula ma intaneti pa makasitomala onse pa PC seva, muyenera kuyika malamulo awa pansipa.
sysctl -w net.ipv4.ip_forward = 1
iptables -KUTUMWA -p kudp - kulengeza 1194 -j Kulandira
iptables -I CHIKHALIDWE -chiganizo -chith0 -j Kulandira
iptables -I NDIPONSO -iwo_maganizo -j kulandira
iptables -m nat -A POSTROUTING -m eth0 -j MASQUERADE
M'nkhani yamakono, inu mwadziwitsidwa ku kukhazikitsa ndi kukonza kwa OpenVPN pa seva ndi mbali ya kasitomala. Tikukulangizani kuti muzimvetsera zolemba zomwe zasonyezedwa "Terminal" ndi kufufuza ziphuphu zolakwika, ngati zilipo. Zochita zofananazi zidzakuthandizani kupeŵa mavuto ena ndi kugwirizana, chifukwa njira yothetsera vutoyo imalepheretsa maonekedwe enawo akuwoneka.