Cześć,
Łącze się z netem z laptopa korzystając z sieci 3g. Mam też serwer VPS w Hetznerze. Chciałbym, żeby cały ruch z laptopa przechodził przez VPSa (w praktyce chodzi mi o to, żebym korzystając z laptopa był widoczny pod adresem ip serwera).
Utworzyłem tunel korzystając z Vtun.
Adres ip VPSa to: 78.47.227.215
Adres ip laptopa: 188.33.39.239
Laptop:
ifconfig
[...]
ppp0 Link encap:Point-to-Point Protocol
inet addr:188.33.39.239 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:9300 errors:0 dropped:0 overruns:0 frame:0
TX packets:10066 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:3019405 (2.8 MiB) TX bytes:1112494 (1.0 MiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:188.33.39.239 P-t-P:78.47.227.215 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1450 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:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
78.47.227.215 188.33.39.239 255.255.255.255 UGH 0 0 0 ppp0
78.47.227.215 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
vtund.conf
options {
type stand;
port 5000;
syslog daemon;
timeout 60;
ppp /usr/sbin/pppd;
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/iptables;
ip /sbin/ip;
}
vpn1 {
passwd pass;
type tun;
proto tcp;
compress zlib:9;
encrypt yes;
keepalive yes;
stat yes;
persist yes;
up {
ifconfig "%% 188.33.39.239 pointopoint 78.47.227.215 mtu 1450";
route "add -host 78.47.227.215 gw 188.33.39.239";
};
down {
ifconfig "%% down";
ifconfig "%% delete";
route "del -host 78.47.227.215";
};
}
VPS:
ifconfig
eth0 Link encap:Ethernet HWaddr 00:1c:14:01:01:ba
inet addr:78.47.227.215 Bcast:78.47.227.239 Mask:255.255.255.240
inet6 addr: fe80::21c:14ff:fe01:1ba/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:731078 errors:0 dropped:0 overruns:0 frame:0
TX packets:79691 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40657390 (38.7 MiB) TX bytes:81398780 (77.6 MiB)
Interrupt:10 Base address:0x2000
tun0 Link encap:UNSPEC HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:78.47.227.215 P-t-P:188.33.39.239 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1450 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:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
188.33.39.239 78.47.227.215 255.255.255.255 UGH 0 0 0 eth0
188.33.39.239 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
78.47.227.224 78.47.227.225 255.255.255.240 UG 0 0 0 eth0
78.47.227.224 0.0.0.0 255.255.255.240 U 0 0 0 eth0
0.0.0.0 78.47.227.225 0.0.0.0 UG 0 0 0 eth0
vtund.conf
options {
port 5000; # Listen on this port.
# bindaddr { iface lo; }; # Listen only on loopback device.
# Syslog facility
syslog daemon;
# Path to various programs
ppp /usr/sbin/pppd;
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/ipchains;
ip /sbin/ip;
}
# Default session options
default {
compress yes; # Compression is off by default
speed 0; # By default maximum speed, NO shaping
}
vpn1 {
passwd pass; # Password
type tun; # IP tunnel
proto tcp; # UDP protocol
compress zlib:9; # LZO compression level 9
encrypt yes; # Encryption
keepalive yes; # Keep connection alive
up {
ifconfig "%% 78.47.227.215 pointopoint 188.33.39.239 mtu 1450";
route "add -host 188.33.39.239 gw 78.47.227.215";
};
down {
ifconfig "%% down";
ifconfig "%% delete";
route "delete -host 188.33.39.239";
};
}
Co teraz zrobić? Przypuszczam, że coś związanego z routingiem i maskaradą. Proszę o pomoc:) Będę wdzięczny za wszelkie wskazówki.