tomato777
Hi,
I installed openVPN on centos 6 64bit based on several tutorials i found on the internet. Somehow, i am seeing the error message ""TCP/UDP: Socket bind failed on local address <ip>:1194" whenever i stop and start the openvpn service.
Is there anything that i missed out?
Please help.
Thanks.
maikcat
hi there,
TCP/UDP: Socket bind failed on local address <ip>:1194
means that something already uses 1194 port...
if you issue
ps ax | grep openvpn
BEFORE you start openvpn does it reports anything back?
also post the output of
sestatus
regards,
Michael.
tomato777
Hi,
ps and sestatus gave me the result as below:
[root@comp1 ~]# ps ax | grep openvpn
1780 ? S 0:00 openvpn /etc/openvpn/config-default.conf
3065 ? S 0:00 openvpn /etc/openvpn/config-default.conf
7318 pts/1 S+ 0:00 grep openvpn
[root@box1 ~]# sestatus
SELinux status: disabled
[root@comp1 ~]#
maikcat
openvpn is already running..?
please remove any unused config and restart service
Michael.
tomato777
[root@comp1 ~]# ps ax | grep openvpn
7356 pts/1 S 0:00 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/config-default.pid --config config-default.conf --cd /etc/openvpn --script-security 2
7364 ? Ss 0:00 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/config-default.pid --config config-default.conf --cd /etc/openvpn --script-security 2
7399 pts/1 S+ 0:00 grep openvpn
[root@comp1 ~]# service openvpn stop
Shutting down openvpn: [ OK ]
[root@comp1 ~]# ps ax | grep openvpn
7419 pts/1 S+ 0:00 grep openvpn
[root@comp1 ~]# service openvpn start
Starting openvpn: [FAILED]
[root@comp1 ~]# ps ax | grep openvpn
7435 pts/1 S 0:00 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/config-default.pid --config config-default.conf --cd /etc/openvpn --script-security 2
7443 ? Ss 0:00 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/config-default.pid --config config-default.conf --cd /etc/openvpn --script-security 2
7451 pts/1 S+ 0:00 grep openvpn
it failed to start after i stopped it.
when i check /var/log/message:
i can see it failed to bind:
Feb 12 10:22:24 comp1 openvpn[7446]: Socket Buffers: R=[229376->131072] S=[229376->131072]
Feb 12 10:22:24 comp1 openvpn[7446]: TCP/UDP: Socket bind failed on local address <ip>:1194: Address already in use
Feb 12 10:22:24 comp1 openvpn[7446]: Exiting
maikcat
after stopping openvpn try to start it using:
openvpn --config /etc/openvpn/configfile.conf
and see if it comes up...
Michael.
tomato777
Hi,
seems like i don't have this config file..i'm using the default
[root@comp1 openvpn]# openvpn --config /etc/openvpn/configfile.conf
Options error: In [CMD-LINE]:1: Error opening configuration file: /etc/openvpn/configfile.conf
Use --help for more information.
[root@comp1 openvpn]# pwd
/etc/openvpn
[root@comp1 openvpn]# ls
1194.log config-default.conf easy-rsa
[root@comp1 openvpn]#
tomato777
"config-default.conf" is the file that i'm using in my configuration where i updated for my server IP add and stuff.
maikcat
simply substitute the "configfile.conf" with your config filename...
is it starting ok?
Michael.
tomato777
i rename my config file to configfile.conf. then i started openvpn with the command 'openvpn --config configfile.conf"
i am getting below:
[root@comp1 openvpn]# openvpn --config configfile.conf
Wed Feb 13 09:35:13 2013 OpenVPN 2.2.2 x86_64-unknown-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] built on Apr 5 2012
Wed Feb 13 09:35:13 2013 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Wed Feb 13 09:35:13 2013 PLUGIN_INIT: POST /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so '[/usr/share/openvpn/plugin/lib/openvpn-auth-pam.so] [/etc/pam.d/login]' intercepted=PLUGIN_AUTH_USER_PASS_VERIFY
Wed Feb 13 09:35:13 2013 Diffie-Hellman initialized with 1024 bit key
Wed Feb 13 09:35:13 2013 WARNING: POTENTIALLY DANGEROUS OPTION --client-cert-not-required may accept clients which do not present a certificate
Wed Feb 13 09:35:13 2013 TLS-Auth MTU parms [ L:1574 D:138 EF:38 EB:0 ET:0 EL:0 ]
Wed Feb 13 09:35:13 2013 Socket Buffers: R=[229376->131072] S=[229376->131072]
Wed Feb 13 09:35:13 2013 ROUTE default_gateway=<ip+1>
Wed Feb 13 09:35:13 2013 TUN/TAP device tun0 opened
Wed Feb 13 09:35:13 2013 TUN/TAP TX queue length set to 100
Wed Feb 13 09:35:13 2013 /sbin/ip link set dev tun0 up mtu 1500
Wed Feb 13 09:35:13 2013 /sbin/ip addr add dev tun0 local 1.2.3.1 peer 1.2.3.2
Wed Feb 13 09:35:13 2013 /sbin/ip route add 1.2.3.0/24 via 1.2.3.2
Wed Feb 13 09:35:13 2013 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Wed Feb 13 09:35:13 2013 UDPv4 link local (bound): <ip>:1194
Wed Feb 13 09:35:13 2013 UDPv4 link remote: [undef]
Wed Feb 13 09:35:13 2013 MULTI: multi_init called, r=256 v=256
Wed Feb 13 09:35:13 2013 IFCONFIG POOL: base=1.2.3.4 size=62
Wed Feb 13 09:35:13 2013 Initialization Sequence Completed
when i check the openvpn process, i was getting 2 llines:
[root@comp1 ~]# ps ax | grep openvpn
9874 pts/0 S+ 0:00 openvpn --config configfile.conf
9875 pts/0 S+ 0:00 openvpn --config configfile.conf
9885 pts/1 S+ 0:00 grep openvpn
[root@comp1 ~]#
i killed all openvpn process before i started though, but once i started, there seems to be 2 processes.
maikcat
the Initialization Sequence Completed message shows that openvpn is up....
can you post your config?
Michael.
tomato777
this is the configfile content:
local <ipaddr> #- your_server_ip
port 1194 #- default port
proto udp #- protocol
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login
client-cert-not-required
username-as-common-name
server 1.2.3.0 255.255.255.0
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status 1194.log
verb 3
maikcat
what ifconfig shows after starting openvpn ?
also add log directive to create logs...
f.e
log openvpn.log
Michael.
tomato777
ifconfig doesn't difference before and after openvpn started.
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:1.2.3.1 P-t-P:1.2.3.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)
and i added the log openvpn.log in the configfile.conf
stop openvpn services, and start again..
maikcat
ifconfig doesn't difference before and after openvpn started.
:shock:
stoping openvpn doesnt bringing down tun interface :?:
Michael.
tomato777
when i used "service stop openvpn", it didn't.
but from ps ax | grep openvpn, i see there were 2 lines.
so i killed manually with kill command and there tun interface has gone when i issue ifconfig command.
seems like service stop openvpn didn't really do what it is supposed to do?
maikcat
AFAIK its service openvpn stop
not service stop openvpn... :ugeek:
tomato777
sorry it was a typing mistake..
i did use service openvpn stop though 🙂
maikcat
did you run it as root?
tomato777
yeah, i ran it as root all the time.
did you see anything 'funny' about my configfile?