Kod: Zaznacz cały
push route
Przykład nie jest mój, przedstawiłem go z jakiejś strony ale powinien działać.
Kod: Zaznacz cały
push route
Kod: Zaznacz cały
local 192.168.0.1
port 1212
proto udp
dev tap
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/server.crt
key /etc/openvpn/easy-rsa/keys/server.key # This file should be kept secret
dh /etc/openvpn/easy-rsa/keys/dh1024.pem
server 10.88.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.0.0 255.255.255.0"
client-config-dir ccd
route 192.168.1.0 255.255.255.0
client-to-client
push "route 192.168.1.0 255.255.255.0"
keepalive 10 120
comp-lzo
#user nobody
#group nobody
persist-key
persist-tun
#status openvpn-status.log
#log openvpn.log
verb 3
mute 10
OpenVPN ROUTE: failed to parse/resolve route for host/network: 192.168.1.0
Kod: Zaznacz cały
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -X
iptables -t nat -X
iptables -t nat -F
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A FORWARD -o lo -j ACCEPT
#przekierowanie na cala siec
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d 0/0 --dport 1212 -j ACCEPT
iptables -A INPUT -p tcp -j ACCEPT -m state --state ESTABLISHED
iptables -A INPUT -p tcp -j ACCEPT -m state --state RELATED
iptables -A INPUT -p udp -j ACCEPT -m state --state ESTABLISHED
iptables -A INPUT -p udp -j ACCEPT -m state --state RELATED
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s 192.168.0.0/24 -p udp --dport 137 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.0.0/24 -p udp --dport 138 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.0.0/24 -p tcp --dport 139 -m state --state NEW -j ACCEPT
iptables -A INPUT -s 192.168.0.0/24 -p tcp --dport 445 -m state --state NEW -j ACCEPT
Kod: Zaznacz cały
route -n
Kod: Zaznacz cały
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
213.25.2.230 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
Kod: Zaznacz cały
ifconfig
Kod: Zaznacz cały
misiek:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
213.25.2.230 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.0.0.0 10.0.0.2 255.255.255.0 UG 0 0 0 tun0
192.168.1.0 10.0.0.2 255.255.255.0 UG 0 0 0 tun0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
Kod: Zaznacz cały
eth0 Link encap:Ethernet HWaddr 00:19:e0:0e:a0:8b
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::219:e0ff:fe0e:a08b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:110799 errors:0 dropped:0 overruns:0 frame:0
TX packets:138706 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12671779 (12.0 MiB) TX bytes:166942874 (159.2 MiB)
Interrupt:11 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5907 errors:0 dropped:0 overruns:0 frame:0
TX packets:5907 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:728571 (711.4 KiB) TX bytes:728571 (711.4 KiB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:xx.xx.xx.xx P-t-P:213.25.2.230 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:108245 errors:0 dropped:0 overruns:0 frame:0
TX packets:87530 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:127006660 (121.1 MiB) TX bytes:9180930 (8.7 MiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.0.0.1 P-t-P:10.0.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)