Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2018-09-24 00:54:06

  rombanek22 - Nowy użytkownik

rombanek22
Nowy użytkownik
Zarejestrowany: 2018-09-23

Pomocy ubuntu + OpenVPN ruting do reszty sieci

Witam Tak jak w temacie potrzebuje pomocy w ustawieniu  ubuntu + openvpn by działał jako ruter - cala sieć przechodziła na świat prez tego klienta vpn.
Dodam że posiadam dwie karty sieciowe, udało mi się uruchomić usługę openvpn i starałem śię odpałić server DHCP -udało mi się.
Z tego co orientuje się bedę musiał z eth0  która łączy się za pomocą vpn klient  z internetem podać dalej połączenie do drugiej eth1 która miała by za zadanie służyć jako ruter do swicza i przyznawać adresy dhcp dla reszty urzadzen w sieci - tak by wszystkie urzadzenia działały na usłudze vpn - czy wogóle jest to możliwe.


Bardzo proszę o wyrozumiałość moja wiedza jak i praca na Linuxie jest w zakresie raczkującym w do głowy mi nie przychodzi w jaki sposób dokładnie jak rozwiązać mój problem, mało tego gdzie szukać jakiegoś tematu który by mniej więcej mógł wskazać drogę ku światłości :/.


jeśli by była możliwość opisania krok po kroku co mam zrobić i gdzie szukać bym był dozgonnie wdzięczny

Ostatnio edytowany przez rombanek22 (2018-09-24 01:14:33)

Offline

 

#2  2018-09-24 10:25:05

  hi - Zbanowany

hi
Zbanowany
Zarejestrowany: 2016-03-24

Re: Pomocy ubuntu + OpenVPN ruting do reszty sieci

to tak na początek:
udostępnienie połączenia internetowego
jak skonfigurowac serwer vpn na debianie

Ostatnio edytowany przez hi (2018-09-24 10:27:39)


"Są drogi, którymi nie należy podążać, armie, których nie należy atakować, fortece, których nie należy oblegać, terytoria, o które nie należy walczyć, zarządzenia, których nie należy wykonywać" Sun Tzu

Offline

 

#3  2018-09-25 12:30:03

  Edis0n - Użytkownik

Edis0n
Użytkownik
Zarejestrowany: 2018-07-29

Re: Pomocy ubuntu + OpenVPN ruting do reszty sieci

Na początek dwie rzeczy:
W pliku konfiguracyjnym serwera ustawiasz taki parametr:
push "redirect-gateway def1" - jeżeli chcesz aby twoi userzy mieli wyjście na świat przez bramę VPN'a

No i zapytanie, czy jest sens na 2 interfejsy mieć ten sprzęt.
Bo np, jeżeli to nie jest firewall oddzielający DMZ to nie ma sensu się w bawić w routing tego typu.
Jeżeli to po prostu serwer VPN, to warto zrobić tylko maskarade np. w taki sposób:

iptables -A INPUT -p idp -s 0/0 --dport 1194 -j ACCEPT
iptables -A INPUTE -i tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -j ACCEPT

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
iptables -A inpute -s 10.8.0.0/24 -j LOG

*eth0 - to oczywiscie interfejs wew.

I jeszcze jedna linijka byla na konfiguracje jądra dla forwardowania pakietów ipv4. Ale nie pamiętam jaka.

Nie zapomnij o napisaniu reszty firewalla :)

Generalnie zacząłbym na twoim miejscu od początku.
Czy masz już wygenerowane certy CA + DH, czy masz już postawiony jakiś zasób w sieci do którego userzy mają mieć dostęp (np. SAMBA).

No i czas na PS. .... nie musisz konfigurować żadnego serwera DHCP ! Demon openvpn przypisuje adresy z podsieci, którą wyznaczasz w pliku konfiguracyjnym (linijka network *).

Ostatnio edytowany przez Edis0n (2018-09-25 12:38:00)

Offline

 

#4  2018-09-25 15:34:09

  rombanek22 - Nowy użytkownik

rombanek22
Nowy użytkownik
Zarejestrowany: 2018-09-23

Re: Pomocy ubuntu + OpenVPN ruting do reszty sieci

udalo mi się skonfigurowac ale z tym ze do nastepnego restartu :/, po czym w zaden sposób nie udało mi się drugi raz odpalić by działał internet w sieci.
Po ponownym restarcie nie nawiązał ponownie połączenie z internetem ale sieć działal, jak to zrobić nie mam pojecia.
Pamietam gdzie co wpisywałem - jak ustawiałem ale szczerze mówiąc by to chodziło jak należy z każdej strony brałem po trochu nie było nigdzie pełnej informacji krop po kroku co ustawić.
Jeśli chodzi o ustawienie sieci radze sobie ale wpierw musialem dopisać statycznie w interfejsie jaki adres ma miec karta sieciowa, potem po kolei zrobiłem serwer dhcp który działa, a potem zrobilem firewall by ustawić przekierowanie do drugiej karty sieciowej.
Po restarcie wszystkiego sieć ruszyła internet smigał tak jak oczekiwałem, wiec postanowiłem sprawdzić czy wszystko się utrzyma po ponownym restarcie - niestety nie wiem czy za dużo namieszałem jedyna opcja jaka mi przychodzi do głowy do postawienie od nowa systemu i ponownej konfiguracji.

Stawiam tylko ten serwer gdyż mój usługodawca internetu bez vpn działa masakrycznie wolno - za dnia prędkość jest żędu 30mb a wieczorami spada do 10.
Po uruchomieniu uslugi openvpn (expressvpn) moja prędkość wzrasta do 160 masakra, mam dodatkowy ruter asus i jak na nim odpalilem ta samą usługe moja prędkość stabilizuje się na 20.

Więc postanowiłem postawić linuxa do zarzadzania całem ruchem jak i łączeniem sie po przez niego z usluga openvpn i predkosć była taka jak przewidywałem.

Koledzy nie jestem biegły w sprawach linuxa i jeśli chodzi o to potrzebuje instrukcji krok po kroku gdzie co wpisac po kolei i jak to zrobić by ta sieć uruchomiała się automatycznie po ponownym restarcie bez jakiej kolwiek mojej ingerencji.

Offline

 

#5  2018-09-25 15:48:18

  rombanek22 - Nowy użytkownik

rombanek22
Nowy użytkownik
Zarejestrowany: 2018-09-23

Re: Pomocy ubuntu + OpenVPN ruting do reszty sieci

dodam że z ubuntu znikną mi profil połączenia który odpowiada za sieć lokalna, nie wiem czy tak powinna byc - sieć lokalna dziala i z terminala moge zobaczyc wszystkie informacje o sieci jedynie co nie mogę zobacyć teraz podejrzewam że tu leży u mnie wszystko :

iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination       
ufw-before-logging-input  all  —  anywhere             anywhere           
ufw-before-input  all  —  anywhere             anywhere           
ufw-after-input  all  —  anywhere             anywhere           
ufw-after-logging-input  all  —  anywhere             anywhere           
ufw-reject-input  all  —  anywhere             anywhere           
ufw-track-input  all  —  anywhere             anywhere           

Chain FORWARD (policy DROP)
target     prot opt source               destination       
ufw-before-logging-forward  all  —  anywhere             anywhere           
ufw-before-forward  all  —  anywhere             anywhere           
ufw-after-forward  all  —  anywhere             anywhere           
ufw-after-logging-forward  all  —  anywhere             anywhere           
ufw-reject-forward  all  —  anywhere             anywhere           
ufw-track-forward  all  —  anywhere             anywhere           

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination       
ufw-before-logging-output  all  —  anywhere             anywhere           
ufw-before-output  all  —  anywhere             anywhere           
ufw-after-output  all  —  anywhere             anywhere           
ufw-after-logging-output  all  —  anywhere             anywhere           
ufw-reject-output  all  —  anywhere             anywhere           
ufw-track-output  all  —  anywhere             anywhere           
xvpn       all  —  anywhere             anywhere           

Chain ufw-after-forward (1 references)
target     prot opt source               destination       

Chain ufw-after-input (1 references)
target     prot opt source               destination       
ufw-skip-to-policy-input  udp  —  anywhere             anywhere             udp dpt:netbios-ns
ufw-skip-to-policy-input  udp  —  anywhere             anywhere             udp dpt:netbios-dgm
ufw-skip-to-policy-input  tcp  —  anywhere             anywhere             tcp dpt:netbios-ssn
ufw-skip-to-policy-input  tcp  —  anywhere             anywhere             tcp dpt:microsoft-ds
ufw-skip-to-policy-input  udp  —  anywhere             anywhere             udp dpt:bootps
ufw-skip-to-policy-input  udp  —  anywhere             anywhere             udp dpt:bootpc
ufw-skip-to-policy-input  all  —  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
target     prot opt source               destination       
LOG        all  —  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-input (1 references)
target     prot opt source               destination       
LOG        all  —  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-output (1 references)
target     prot opt source               destination       

Chain ufw-after-output (1 references)
target     prot opt source               destination       

Chain ufw-before-forward (1 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     icmp —  anywhere             anywhere             icmp destination-unreachable
ACCEPT     icmp —  anywhere             anywhere             icmp source-quench
ACCEPT     icmp —  anywhere             anywhere             icmp time-exceeded
ACCEPT     icmp —  anywhere             anywhere             icmp parameter-problem
ACCEPT     icmp —  anywhere             anywhere             icmp echo-request
ufw-user-forward  all  —  anywhere             anywhere           

Chain ufw-before-input (1 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             anywhere           
ACCEPT     all  —  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ufw-logging-deny  all  —  anywhere             anywhere             ctstate INVALID
DROP       all  —  anywhere             anywhere             ctstate INVALID
ACCEPT     icmp —  anywhere             anywhere             icmp destination-unreachable
ACCEPT     icmp —  anywhere             anywhere             icmp source-quench
ACCEPT     icmp —  anywhere             anywhere             icmp time-exceeded
ACCEPT     icmp —  anywhere             anywhere             icmp parameter-problem
ACCEPT     icmp —  anywhere             anywhere             icmp echo-request
ACCEPT     udp  —  anywhere             anywhere             udp spt:bootps dpt:bootpc
ufw-not-local  all  —  anywhere             anywhere           
^[[CACCEPT     udp  —  anywhere             224.0.0.251          udp dpt:mdns
ACCEPT     udp  —  anywhere             239.255.255.250      udp dpt:1900
ufw-user-input  all  —  anywhere             anywhere           

Chain ufw-before-logging-forward (1 references)
target     prot opt source               destination       

Chain ufw-before-logging-input (1 references)
target     prot opt source               destination       

Chain ufw-before-logging-output (1 references)
target     prot opt source               destination       

Chain ufw-before-output (1 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             anywhere           
ACCEPT     all  —  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ufw-user-output  all  —  anywhere             anywhere           

Chain ufw-logging-allow (0 references)
target     prot opt source               destination       
LOG        all  —  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

Chain ufw-logging-deny (2 references)
target     prot opt source               destination       
RETURN     all  —  anywhere             anywhere             ctstate INVALID limit: avg 3/min burst 10
LOG        all  —  anywhere             anywhere             limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-not-local (1 references)
target     prot opt source               destination       
RETURN     all  —  anywhere             anywhere             ADDRTYPE match dst-type LOCAL
RETURN     all  —  anywhere             anywhere             ADDRTYPE match dst-type MULTICAST
RETURN     all  —  anywhere             anywhere             ADDRTYPE match dst-type BROADCAST
ufw-logging-deny  all  —  anywhere             anywhere             limit: avg 3/min burst 10
DROP       all  —  anywhere             anywhere           

Chain ufw-reject-forward (1 references)
target     prot opt source               destination       

Chain ufw-reject-input (1 references)
target     prot opt source               destination       

Chain ufw-reject-output (1 references)
target     prot opt source               destination       

Chain ufw-skip-to-policy-forward (0 references)
target     prot opt source               destination       
DROP       all  —  anywhere             anywhere           

Chain ufw-skip-to-policy-input (7 references)
target     prot opt source               destination       
DROP       all  —  anywhere             anywhere           

Chain ufw-skip-to-policy-output (0 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             anywhere           

Chain ufw-track-forward (1 references)
target     prot opt source               destination       

Chain ufw-track-input (1 references)
target     prot opt source               destination       

Chain ufw-track-output (1 references)
target     prot opt source               destination       
ACCEPT     tcp  —  anywhere             anywhere             ctstate NEW
ACCEPT     udp  —  anywhere             anywhere             ctstate NEW

Chain ufw-user-forward (1 references)
target     prot opt source               destination       

Chain ufw-user-input (1 references)
target     prot opt source               destination       

Chain ufw-user-limit (0 references)
target     prot opt source               destination       
LOG        all  —  anywhere             anywhere             limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
REJECT     all  —  anywhere             anywhere             reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             anywhere           

Chain ufw-user-logging-forward (0 references)
target     prot opt source               destination       

Chain ufw-user-logging-input (0 references)
target     prot opt source               destination       

Chain ufw-user-logging-output (0 references)
target     prot opt source               destination       

Chain ufw-user-output (1 references)
target     prot opt source               destination       

Chain xvpn (1 references)
target     prot opt source               destination       
xvpn_dns   all  —  anywhere             anywhere           
xvpn_ks    all  —  anywhere             anywhere           

Chain xvpn_dns (1 references)
target     prot opt source               destination       
xvpn_dns_iface_exceptions  all  —  anywhere             anywhere           
xvpn_dns_ip_exceptions  all  —  anywhere             anywhere           
DROP       udp  —  anywhere             anywhere             udp dpt:domain

Chain xvpn_dns_iface_exceptions (1 references)
target     prot opt source               destination       

Chain xvpn_dns_ip_exceptions (1 references)
target     prot opt source               destination       
ACCEPT     udp  —  anywhere             10.155.0.1           udp dpt:domain

Chain xvpn_ks (1 references)
target     prot opt source               destination       
xvpn_ks_iface_exceptions  all  —  anywhere             anywhere           
xvpn_ks_ip_exceptions  all  —  anywhere             anywhere           
ACCEPT     udp  —  0.0.0.0              255.255.255.255      udp dpt:bootps
DROP       all  —  anywhere             anywhere           

Chain xvpn_ks_iface_exceptions (1 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             anywhere           

Chain xvpn_ks_ip_exceptions (1 references)
target     prot opt source               destination       
ACCEPT     all  —  anywhere             ns1648.ztomy.com   
ACCEPT     all  —  anywhere             10.0.0.0/8         
ACCEPT     all  —  anywhere             172.16.0.0/12     
ACCEPT     all  —  anywhere             192.168.0.0/16     




netstat -pl | grep dhcpd
udp        0      0 0.0.0.0:bootps          0.0.0.0:*                           2446/dhcpd         
udp        0      0 0.0.0.0:41325           0.0.0.0:*                           2446/dhcpd         
udp6       0      0 [::]:31334              [::]:*                              2446/dhcpd         
raw        0      0 0.0.0.0:icmp            0.0.0.0:*               7           2446/dhcpd

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Możesz wyłączyć AdBlock — tu nie ma reklam ;-)