Добрый день господа,
В маршрутизации я лох, а дело видимо в ней. Одна надежда на помощь зала Есть корпоративная сеть 192.168.1.0/255.255.255.0
В ней есть openvpn сервер с двумя сетевыми картами
- eth0 192.168.1.24
- eth1 55.55.55.55 (белый IP)
[root@xxxx openvpn]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 66.66.66.66 * 255.255.255.224 U 0 0 0 eth1 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 1002 0 0 eth0 link-local * 255.255.0.0 U 1003 0 0 eth1 default uplink.domain. 0.0.0.0 UG 0 0 0 eth1
конфиг сервера
port 1723 proto udp dev tun ca /etc/openvpn/ca.crt cert /etc/openvpn/server.crt key /etc/openvpn/server.key dh /etc/openvpn/dh1024.pem server 172.16.0.0 255.255.255.0 # виртуальная сеть ifconfig-pool-persist ipp.txt keepalive 10 120 comp-lz #client-config-dir ccd persist-key persist-tun status openvpn-status.log #лог verb 3 local 55.55.55.55 push "redirect-gateway" # при подключении клиента у него устанавливается шлюз по умолчанию на этот сервер push "dhcp-option DNS 192.168.1.28" push "route 192.168.1.0 255.255.255.0" #push "route 172.16.0.0 255.255.255.0" log openvpn.log
запускаю openvpn сервер, смотрим маршруты
[root@zeus openvpn]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 172.16.0.2 * 255.255.255.255 UH 0 0 0 tun0 66.66.66.66 * 255.255.255.224 U 0 0 0 eth1 172.16.0.0 172.16.0.2 255.255.255.0 UG 0 0 0 tun0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 1002 0 0 eth0 link-local * 255.255.0.0 U 1003 0 0 eth1 default uplink.domain. 0.0.0.0 UG 0 0 0 eth1
настройки клиента на винде (10.0.0.0/255.255.255.0)
remote 55.55.55.55 1723 # ip и порт нашего сервера client dev tun ping 10 omp-lzo proto udp pkcs12 d:/temp/shevtsov.p12 #имя файла клиентского ключа verb 3 pull
route print до подключения
IPv4 таблица маршрута =========================================================================== Активные маршруты: Сетевой адрес Маска сети Адрес шлюза Интерфейс Метрика 0.0.0.0 0.0.0.0 10.0.0.1 10.0.0.2 276 10.0.0.0 255.255.255.0 On-link 10.0.0.2 276 10.0.0.2 255.255.255.255 On-link 10.0.0.2 276 10.0.0.255 255.255.255.255 On-link 10.0.0.2 276 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 10.0.0.2 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 10.0.0.2 276 =========================================================================== Постоянные маршруты: Сетевой адрес Маска Адрес шлюза Метрика 0.0.0.0 0.0.0.0 10.0.0.1 По умолчанию =========================================================================== IPv6 таблица маршрута =========================================================================== Активные маршруты: Метрика Сетевой адрес Шлюз 1 306 ::1/128 On-link 1 306 ff00::/8 On-link =========================================================================== Постоянные маршруты: Отсутствует
route print после подключения
IPv4 таблица маршрута =========================================================================== Активные маршруты: Сетевой адрес Маска сети Адрес шлюза Интерфейс Метрика 0.0.0.0 0.0.0.0 10.0.0.1 10.0.0.2 276 10.0.0.0 255.255.255.0 On-link 10.0.0.2 276 10.0.0.2 255.255.255.255 On-link 10.0.0.2 276 10.0.0.255 255.255.255.255 On-link 10.0.0.2 276 10.8.0.0 255.255.255.0 10.8.0.5 172.16.0.6 30 10.8.0.1 255.255.255.255 10.8.0.5 172.16.0.6 30 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 172.16.0.0 255.255.255.0 172.16.0.5 172.16.0.6 30 172.16.0.0 255.255.255.0 172.16.0.1 172.16.0.6 30 172.16.0.1 255.255.255.255 172.16.0.5 172.16.0.6 30 172.16.0.1 255.255.255.255 172.16.0.1 172.16.0.6 30 172.16.0.4 255.255.255.252 On-link 172.16.0.6 286 172.16.0.6 255.255.255.255 On-link 172.16.0.6 286 172.16.0.7 255.255.255.255 On-link 172.16.0.6 286 192.168.1.0 255.255.255.0 10.8.0.5 172.16.0.6 30 192.168.1.0 255.255.255.0 172.16.0.5 172.16.0.6 30 192.168.1.0 255.255.255.0 172.16.0.1 172.16.0.6 30 55.55.55.55 255.255.255.255 10.0.0.1 10.0.0.2 20 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 172.16.0.6 286 224.0.0.0 240.0.0.0 On-link 10.0.0.2 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 172.16.0.6 286 255.255.255.255 255.255.255.255 On-link 10.0.0.2 276 =========================================================================== Постоянные маршруты: Сетевой адрес Маска Адрес шлюза Метрика 0.0.0.0 0.0.0.0 10.0.0.1 По умолчанию =========================================================================== IPv6 таблица маршрута =========================================================================== Активные маршруты: Метрика Сетевой адрес Шлюз 1 306 ::1/128 On-link 1 306 ff00::/8 On-link =========================================================================== Постоянные маршруты: Отсутствует
лог сервера
Thu Sep 29 22:18:39 2011 OpenVPN 2.2.1 x86_64-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] built on Sep 12 2011 Thu Sep 29 22:18:39 2011 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts Thu Sep 29 22:18:39 2011 Diffie-Hellman initialized with 1024 bit key Thu Sep 29 22:18:39 2011 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ] Thu Sep 29 22:18:39 2011 Socket Buffers: R=[124928->131072] S=[124928->131072] Thu Sep 29 22:18:39 2011 ROUTE default_gateway=55.55.55.65 Thu Sep 29 22:18:39 2011 TUN/TAP device tun0 opened Thu Sep 29 22:18:39 2011 TUN/TAP TX queue length set to 100 Thu Sep 29 22:18:39 2011 /sbin/ip link set dev tun0 up mtu 1500 Thu Sep 29 22:18:39 2011 /sbin/ip addr add dev tun0 local 172.16.0.1 peer 172.16.0.2 Thu Sep 29 22:18:39 2011 /sbin/ip route add 172.16.0.0/24 via 172.16.0.2 Thu Sep 29 22:18:39 2011 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ] Thu Sep 29 22:18:39 2011 UDPv4 link local (bound): 55.55.55.55:1723 Thu Sep 29 22:18:39 2011 UDPv4 link remote: [undef] Thu Sep 29 22:18:39 2011 MULTI: multi_init called, r=256 v=256 Thu Sep 29 22:18:39 2011 IFCONFIG POOL: base=172.16.0.4 size=62 Thu Sep 29 22:18:39 2011 IFCONFIG POOL LIST Thu Sep 29 22:18:39 2011 shevtsov,172.16.0.4 Thu Sep 29 22:18:39 2011 Initialization Sequence Completed Thu Sep 29 22:18:44 2011 MULTI: multi_create_instance called Thu Sep 29 22:18:44 2011 89.204.41.251:1194 Re-using SSL/TLS context Thu Sep 29 22:18:44 2011 89.204.41.251:1194 LZO compression initialized Thu Sep 29 22:18:44 2011 89.204.41.251:1194 Control Channel MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ] Thu Sep 29 22:18:44 2011 89.204.41.251:1194 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ] Thu Sep 29 22:18:44 2011 89.204.41.251:1194 Local Options hash (VER=V4): '530fdded' Thu Sep 29 22:18:44 2011 89.204.41.251:1194 Expected Remote Options hash (VER=V4): '41690919' Thu Sep 29 22:18:44 2011 89.204.41.251:1194 TLS: Initial packet from 89.204.41.251:1194, sid=ad375162 81ba2ea6 Thu Sep 29 22:18:45 2011 89.204.41.251:1194 VERIFY OK: depth=1, /C=RU/ST=RU72/L=Tyumen/O=MY_LTD/CN=MY_LTD_CA/emailAddress=certs@MY.ru Thu Sep 29 22:18:45 2011 89.204.41.251:1194 VERIFY OK: depth=0, /C=RU/ST=RU72/L=Tyumen/O=MY_LTD/CN=shevtsov/emailAddress=certs@MY.ru Thu Sep 29 22:18:45 2011 89.204.41.251:1194 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key Thu Sep 29 22:18:45 2011 89.204.41.251:1194 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Thu Sep 29 22:18:45 2011 89.204.41.251:1194 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key Thu Sep 29 22:18:45 2011 89.204.41.251:1194 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Thu Sep 29 22:18:45 2011 89.204.41.251:1194 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA Thu Sep 29 22:18:45 2011 89.204.41.251:1194 [shevtsov] Peer Connection Initiated with 89.204.41.251:1194 Thu Sep 29 22:18:45 2011 shevtsov/89.204.41.251:1194 MULTI: Learn: 172.16.0.6 -> shevtsov/89.204.41.251:1194 Thu Sep 29 22:18:45 2011 shevtsov/89.204.41.251:1194 MULTI: primary virtual IP for shevtsov/89.204.41.251:1194: 172.16.0.6 Thu Sep 29 22:18:46 2011 shevtsov/89.204.41.251:1194 PUSH: Received control message: 'PUSH_REQUEST' Thu Sep 29 22:18:46 2011 shevtsov/89.204.41.251:1194 SENT CONTROL [shevtsov]: 'PUSH_REPLY,redirect-gateway,dhcp-option DNS 192.168.1.28,route 192.168.1.0 255.255.255.0,route 172.16.0.1,topology net30,ping 10,ping-restart 120,ifconfig 172.16.0.6 172.16.0.5' (status=1)
лог родного клиента
Thu Sep 29 22:32:16 2011 OpenVPN 2.2.1 Win32-MSVC++ [SSL] [LZO2] built on Jul 1 2011 Thu Sep 29 22:32:16 2011 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info. Thu Sep 29 22:32:16 2011 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables Thu Sep 29 22:32:16 2011 LZO compression initialized Thu Sep 29 22:32:16 2011 Control Channel MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ] Thu Sep 29 22:32:16 2011 Socket Buffers: R=[8192->8192] S=[8192->8192] Thu Sep 29 22:32:16 2011 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ] Thu Sep 29 22:32:16 2011 Local Options hash (VER=V4): '41690919' Thu Sep 29 22:32:16 2011 Expected Remote Options hash (VER=V4): '530fdded' Thu Sep 29 22:32:16 2011 UDPv4 link local (bound): [undef]:1194 Thu Sep 29 22:32:16 2011 UDPv4 link remote: 55.55.55.55:1723 Thu Sep 29 22:32:16 2011 TLS: Initial packet from 55.55.55.55:1723, sid=d0299bdb 3fc2851e Thu Sep 29 22:32:16 2011 VERIFY OK: depth=1, /C=RU/ST=RU72/L=Tyumen/O=MY_LTD/CN=MY_LTD_CA/emailAddress=certs@MY.ru Thu Sep 29 22:32:16 2011 VERIFY OK: depth=0, /C=RU/ST=RU72/L=Tyumen/O=MY_LTD/CN=server/emailAddress=certs@MY.ru Thu Sep 29 22:32:17 2011 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key Thu Sep 29 22:32:17 2011 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Thu Sep 29 22:32:17 2011 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key Thu Sep 29 22:32:17 2011 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication Thu Sep 29 22:32:17 2011 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA Thu Sep 29 22:32:17 2011 [server] Peer Connection Initiated with 55.55.55.55:1723 Thu Sep 29 22:32:20 2011 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1) Thu Sep 29 22:32:20 2011 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway,dhcp-option DNS 192.168.1.28,route 192.168.1.0 255.255.255.0,route 172.16.0.1,topology net30,ping 10,ping-restart 120,ifconfig 172.16.0.6 172.16.0.5' Thu Sep 29 22:32:20 2011 OPTIONS IMPORT: timers and/or timeouts modified Thu Sep 29 22:32:20 2011 OPTIONS IMPORT: --ifconfig/up options modified Thu Sep 29 22:32:20 2011 OPTIONS IMPORT: route options modified Thu Sep 29 22:32:20 2011 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified Thu Sep 29 22:32:20 2011 ROUTE default_gateway=10.0.0.1 Thu Sep 29 22:32:20 2011 TAP-WIN32 device [Подключение по локальной сети 4] opened: \\.\Global\{92CAF432-CB9D-48FD-A56D-8571ED715A81}.tap Thu Sep 29 22:32:20 2011 TAP-Win32 Driver Version 9.8 Thu Sep 29 22:32:20 2011 TAP-Win32 MTU=1500 Thu Sep 29 22:32:20 2011 Notified TAP-Win32 driver to set a DHCP IP/netmask of 172.16.0.6/255.255.255.252 on interface {92CAF432-CB9D-48FD-A56D-8571ED715A81} [DHCP-serv: 172.16.0.5, lease-time: 31536000] Thu Sep 29 22:32:20 2011 Successful ARP Flush on interface [18] {92CAF432-CB9D-48FD-A56D-8571ED715A81} Thu Sep 29 22:32:25 2011 TEST ROUTES: 3/3 succeeded len=2 ret=1 a=0 u/d=up Thu Sep 29 22:32:25 2011 C:\WINDOWS\system32\route.exe ADD 55.55.55.55 MASK 255.255.255.255 10.0.0.1 Thu Sep 29 22:32:25 2011 ROUTE: route addition failed using CreateIpForwardEntry: Этот объект уже существует. [status=5010 if_index=10] Thu Sep 29 22:32:25 2011 Route addition via IPAPI failed [adaptive] Thu Sep 29 22:32:25 2011 Route addition fallback to route.exe ‘Ў®© ¤®Ў ў«ҐЁп ¬ аиагв : ќв®в ®ЎкҐЄв 㦥 бгйҐбвўгҐв. Thu Sep 29 22:32:25 2011 C:\WINDOWS\system32\route.exe DELETE 0.0.0.0 MASK 0.0.0.0 10.0.0.1 Thu Sep 29 22:32:25 2011 Route deletion via IPAPI succeeded [adaptive] Thu Sep 29 22:32:25 2011 C:\WINDOWS\system32\route.exe ADD 0.0.0.0 MASK 0.0.0.0 172.16.0.5 Thu Sep 29 22:32:25 2011 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4 Thu Sep 29 22:32:25 2011 Route addition via IPAPI succeeded [adaptive] Thu Sep 29 22:32:25 2011 C:\WINDOWS\system32\route.exe ADD 192.168.1.0 MASK 255.255.255.0 172.16.0.5 Thu Sep 29 22:32:25 2011 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4 Thu Sep 29 22:32:25 2011 Route addition via IPAPI succeeded [adaptive] Thu Sep 29 22:32:25 2011 C:\WINDOWS\system32\route.exe ADD 172.16.0.1 MASK 255.255.255.255 172.16.0.5 Thu Sep 29 22:32:25 2011 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4 Thu Sep 29 22:32:25 2011 Route addition via IPAPI succeeded [adaptive] Thu Sep 29 22:32:25 2011 Initialization Sequence Completed
соединение устанавливается, но могу лишь пинговать с клиента сервер и обратно (172.16.0.5 <-> 172.16.0.1), а хотелось бы иметь возможность видить всю сеть 192.168.1.0/255.255.255.0
Также хотелось бы узнать, что делать с iptables. Порыл в сторону маскарадинга, смог пинговать с винды 172.16.0.6 сам сервер как по 172.16.0.1, так 192.168.1.24.. но ни сети ни инета не видно
Писал максимально подробно, уж не обессудьте ))