Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

Thursday, 28 May 2015

Proxmax Clone Issue

Edit below files :

 /etc/udev/rules.d/70-persistent-net.rules
 /etc/sysconfig/network-scripts/ifcfg-eth0


Wednesday, 20 May 2015

Heartbeat Cluster Configuration

Node1 :
IpAddress(eth0):10.77.225.21
Subnetmask(eth0):255.0.0.0
Default Gateway(eth0):10.0.0.1
IpAddress(eth1):192.168.0.1(To send heartbeat signals to other nodes)
Sub net mask (eth1):255.255.255.0
Default Gateway (eth1):None(don’t specify any thing, leave blank for this interface default gateway).

Node2 :
IpAddress(eth0):10.77.225.22
Subnetmask(eth0):255.0.0.0
Default Gateway (eth0):10.0.0.1
IpAddress(eth1):192.168.0.2(To send heartbeat signals to other nodes)
Sub net mask (eth1):255.255.255.0
Default Gateway(eth1):None(don’t specify any thing, leave blank for this interface default gateway).


tyle=”font-family: verdana;”>4. Floating Ip address:10.77.225.20

Lets start configuration of Heartbeat cluster. And make a note that ever step in this Heartbeat cluster configuration is divided in two parts parts
1.(configurations on node1)
2.(configurations on node2)

For better understanding purpose

Step1 : Install the following packages in the same order which is shown

Step1(a) : Install the following packages on node1
#rpm -ivh heartbeat-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-ldirectord-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-pils-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-stonith-2.1.2-2.i386.rpm

Step1(b) : Install the following packages on node2
#rpm -ivh heartbeat-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-ldirectord-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-pils-2.1.2-2.i386.rpm
#rpm -ivh heartbeat-stonith-2.1.2-2.i386.rpm


Step2 : By default the main configuration files (ha.cf, haresources and authkeys) are not present in /etc/ha.d/ folder we have to copy these three files from /usr/share/doc/heartbeat-2.1.2 to /etc/ha.d/

Step2(a) : Copy main configuration files from /usr/share/doc/heartbeat-2.1.2 to /etc/ha.d/ on node 1
#cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/
#cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/
#cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/

Step2(b) : Copy main configuration files from /usr/share/doc/heartbeat-2.1.2 to /etc/ha.d/ on node 2
#cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/
#cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/
#cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/


Step3 : Edit ha.cf file
#vi /etc/ha.d/ha.cf

Step3(a) : Edit ha.cf file as follows on node1
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 25
warntime 10
initdead 50
udpport 694
bcast eth1
ucast eth1 192.168.0.1
auto_failback on
node rp1.linuxnix.com
node rp2.linuxnix.com

Step3(b) : Edit ha.cf file as follows on node2
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 25
warntime 10
initdead 50
udpport 694
bcast eth1
ucast eth1 192.168.0.2
auto_failback on
node rp1.linuxnix.com
node rp2.linuxnix.com

Let me explain each entry in detail:
Debugfile : This is the file where debug info with good details for your heartbeat cluster will be stored, which is very much useful to do any kind of troubleshooting.

Logfile : This is the file where general logging of heartbeat cluster takes place.

Logfacility : This directive is used to specify where to log your heartbeat logs(if its local that indicates store logs locally or if it’s a syslog then store it on remote server and none to disable logging). And there are so many other options, please explore yourself.

Keepalive : This directive is used to set the time interval between heartbeat packets and the nodes to check the availability of other nodes. In this example I specified it as two seconds(keepalive 2).

Deadtime : A node is said to be dead if the other node didn’t receive any update form it.

Warntime : Time in seconds before issuing a “late heartbeat” warning in the logs.

Initdead : With some configurations, the network takes some time to start working after a reboot. This is a separate “deadtime” to handle that case. It should be at least twice the normal deadtime.

Udpport : This is the port used by heartbeat to send heartbeat packet/signals to other nodes to check availability(here in this example I used default port:694).

Bcast : Used to specify on which device/interface to broadcast the heartbeat packets.

Ucast : Used to specify on which device/interface to unicast the heartbeat packets.

auto_failback : This option determines whether a resource will automatically fail back to its “primary” node, or remain on whatever node is serving it until that node fails, or an administrator intervenes. In my example I have given as on that indicate if the failed node come back online, controle will be given to this node automatically. Let me put it in this way. I have two nodes node1 and node2. My node one machine is a high end one and node is for serving temporary purpose when node 1 goes down. Suppose node1 goes down, node2 will take the control and serve the service, and it will check periodically for node1 starts once it find that node 1 is up, the control is given to node1.

Node : This is used to specify the participated nodes in the cluster. In my cluster only two nodes are participating (rp1 and rp2) so just specify that entries. If in your implementation more nodes are participating please specify a
ll the nodes.


Step4 : Edit haresources file
#vi /etc/ha.d/haresources

Step4(a) : Just specify below entry in last line of this file on node1
rp1.linuxnix.com 10.77.225.20 squid

Step4(b) : Just specify below entry in last line of this file on node1
rp1.linuxnix.com 10.77.225.20 squid

Explanation of each entry :
rp1.linuxnix.com is the main node in the cluster
10.77.225.20 is the floating ip address of this cluster.

Squid : This is the service offered by the cluster. And make a note that this is the script file located in /etc/ha.d/ resource.d/.

Note : By default squid script file will not be there in that folder, I created it according to my squid configuration.

What actually this script file contains?
Ans : This is just a start/stop/restart script for the particular service. So that heartbeat cluster will take care of the starting/stoping/restarting of the service(here its squid).
Here is what squid script file contains.
http://sites.google.com/site/surendr...directs=0&d;=1

Step5 : Edit authkeys file, he authkeys configuration file contains information for Heartbeat to use when authenticating cluster members. It cannot be readable or writeable by anyone other than root. so change the permissions of the file to 600 on both the nodes..

Two lines are required in the authkeys file:
A line which says which key to use in signing outgoing packets.
One or more lines defining how incoming packets might be being signed.

Step5 (a) : Edit authkeys file on node1
#vi /etc/ha.d/authkeys
auth 2
#1 crc
2 sha1 HI!
#3 md5 Hello!
Now save and exit the file

Step5 (b) : Edit authkeys file on node2
#vi /etc/ha.d/authkeys
auth 2
#1 crc
2 sha1 HI!
#3 md5 Hello!
Now save and exit the file


Step6 : Edit /etc/hosts file to give entries of hostnames for the nodes


Step6(a) : Edit /etc/hosts file on node1 as below



10.77.225.21 rp1.linuxnix.com rp1
10.77.225.22 rp2.linuxnix.com rp2


Step6(b) : Edit /etc/hosts file on node2 as below



10.77.225.21 rp1.linuxnix.com rp1
10.77.225.22 rp2.linuxnix.com rp2

Step7 : Start Heartbeat cluster

Step7(a) : Start heartbeat cluster on node1
#service heartbeat start

Step7(b) : Start heartbeat cluster on node2
#service heartbeat start

Checking your Heartbeat cluster:
If your heartbeat cluster is running fine a Virtual Ethernet Interface is created on node1 and 10.77.225.20
Clipped output of my first node
# ifconfig

Eth0 Link encap:Ethernet HWaddr 00:02:A5:4C:AF:8E
inet addr:10.77.225.21 Bcast:10.77.231.255 Mask:255.255.248.0
inet6 addr: fe80::202:a5ff:fe4c:af8e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5714248 errors:0 dropped:0 overruns:0 frame:0
TX packets:19796 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1533278899 (1.4 GiB) TX bytes:4275200 (4.0 MiB)
Base address:0×5000 Memory:f7fe0000-f8000000

Eth0:0 Link encap:Ethernet HWaddr 00:02:A5:4C:AF:8E
inet addr:10.77.225.20 Bcast:10.77.231.255 Mask:255.255.248.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0×5000 Memory:f7fe0000-f8000000

Eth1 Link encap:Ethernet HWaddr 00:02:A5:4C:AF:8F
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::202:a5ff:fe4c:af8f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:145979 errors:0 dropped:0 overruns:0 frame:0
TX packets:103753 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:38966724 (37.1 MiB) TX bytes:27640765 (26.3 MiB)
Base address:0×5040 Memory:f7f60000-f7f80000

Monday, 6 April 2015

Asterisk Webrtc Setup (source : github/(jwoertink))

Setup Network config

  1. vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
DHCP_HOSTNAME=pbx.dev
HOSTNAME="pbx.dev"
IPV6INIT=yes
MTU=1500
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
HWADDR=00:00:00:00:00 #YOUR MAC ADDRESS of VirtualBox
DNS1=8.8.8.8
USERCTL=no
IPADDR=0.0.0.0 #IP YOU NEED i.e. 172.16.1.56
NETMASK=255.255.255.0
GATEWAY=0.0.0.0 #YOUR GATEWAY i.e. 172.16.1.1
  1. service network restart If any fail, you may need to run reboot
  2. ifconfig | grep "inet addr" Check for IP address
  3. service iptables save
  4. service iptables stop
  5. chkconfig iptables off

Update Server Hostname

  1. vi /etc/sysconfig/network
  2. HOSTNAME=pbx.dev Set the HOSTNAME to pbx.dev or whatever you want your hostname to be
  3. vi /etc/hosts
172.16.1.56 pbx.dev #use your IP address
127.0.0.1 localhost pbx.dev
::1 localhost pbx.dev
  1. hostname pbx.dev
  2. service network restart

Install Virtualbox Guest Additions

  1. Devices > Insert Guest Additions CD Image
  2. mkdir /media/VirtualBoxGuestAdditions
  3. mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
  4. yum update -y
  5. yum groupinstall -y "Development Tools"
  6. rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  7. yum install -y gcc kernel-devel kernel-headers dkms make bzip2 perl
  8. yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
  9. KERN_DIR=/usr/src/kernels/$(uname -r)/
  10. export KERN_DIR
  11. cd /media/VirtualBoxGuestAdditions
  12. ./VBoxLinuxAdditions.run
  13. reboot

Configure Terminal

  1. vi /etc/grub.conf
  2. Find the kernel line and add vga=791 to the end of the line
  3. vi /etc/bashrc
  4. update PS1 to PS1='\[\033[02;32m\]\u@\h\[\033[02;34m\]\w\$\[\033[00m\] '
  5. add alias currip="ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print \$1}'"
  6. save and exit
  7. sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
  8. reboot

Install Asterisk Current

  1. yum install -y wget gcc-c++ ncurses-devel libxml2-devel sqlite-devel libsrtp-devel libuuid-devel openssl-devel iksemel-devel jansson-devel
  2. cd /usr/local/src/
  3. wget downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
  4. wget downloads.asterisk.org/pub/telephony/dahdi-tools/dahdi-tools-current.tar.gz
  5. wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2
  6. wget downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
  7. wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-12-current.tar.gz
  8. tar zxvf dahdi-linux*
  9. cd dahdi-linux*
  10. make && make install && make config
  11. cd ..
  12. tar zxvf dahdi-tools*
  13. cd dahdi-tools*
  14. make && make install && make config
  15. cd ..
  16. tar zxvf libpri*
  17. cd libpri*
  18. make && make install
  19. cd ..
  20. tar -xjvf pjproject-2.2.1.tar.bz2
  21. cd pjproject*
  22. ./configure --prefix=/usr/lib64/ --enable-shared
  23. make dep
  24. make && make install
  25. pjproject installs files to /usr/lib64/lib cd /usr/lib64/lib mv lib* .. mv pkgconfig/libpjproject.pc ../pkgconfig/
  26. cd /usr/local/src/pjproject*
  27. ldconfig
  28. ldconfig -p | grep pj should return a huge list of symlinked .so files
  29. PKG_CONFIG_PATH=/usr/lib64/pkgconfig/
  30. export PKG_CONFIG_PATH
  31. cd ..
  32. tar zxvf asterisk*
  33. cd asterisk*
  34. ./configure --libdir=/usr/lib64
  35. make menuselect
  36. Select Resource Modules then scroll down to ensure a * is next to res_srtp. Press x to save & quit
  37. vi include/asterisk/autoconfig.h this is a super hack >_<
  38. replace #undef HAVE_PJ_TRANSACTION_GRP_LOCK with #define HAVE_PJ_TRANSACTION_GRP_LOCK 1
  39. make && make install
  40. make samples
  41. make config

Configure Asterisk for WebRTC

  1. mkdir /etc/asterisk/keys
  2. cd /usr/local/src/asterisk*/contrib/scripts
  3. ./ast_tls_cert -C $(currip) -O "My Super Company" -d /etc/asterisk/keys
  4. vi /etc/asterisk/http.conf
[general]
enabled=yes
bindaddr=127.0.0.1 ; Replace this with your IP address
bindport=8088 ; Replace this with the port you want to listen on
  1. vi /etc/asterisk/sip.conf
[general]
context=default
allowguest=no
allowoverlap=no
accept_outofcall_message=yes
outofcall_message_context=default
realm=127.0.0.1 ; Replace this with your IP address
udpbindaddr=127.0.0.1 ; Replace this with your IP address
transport=ws,wss,udp
language=en
icesupport=yes
videosupport=yes
nat=auto_force_rport,auto_comedia
allow=!all,alaw,ulaw,gsm
;
[1060] ; This will be WebRTC client
type=friend
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=ws,wss,udp ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
videosupport=yes
nat=no
disallow=all
allow=ulaw,vp8,h264
;
[1061] ; This will be the legacy SIP client
type=friend
username=1061
host=dynamic
secret=password
context=default
directmedia=no
transport=udp
force_avp=yes
dtlsenable=no
videosupport=yes
nat=no
disallow=all
allow=ulaw,vp8
  1. vi /etc/asterisk/extensions.conf
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1061,1,Dial(SIP/1061) ; Dialing 1061 will call the SIP client registered to 1061
  1. vi /etc/asterisk/manager.conf
[general]
enabled=yes
port=5038
bindaddr=0.0.0.0
;
[admin]
secret=password
read=all
write=all
writetimeout=5000
  1. service asterisk restart
  2. Ensure Linphone is installed, and all Video and Audio codecs are turned on
  3. SIP account should be sip:1061@CENT_OS_IP_ADDRESS with udp transport

Install & Configure ejabberd

  1. yum install -y ejabberd
  2. vi /etc/ejabberd/ejabberd.cfg
% Find this line and add the pbx.dev
{hosts, ["localhost", "pbx.dev"]}.
  1. service ejabberd start
  2. ejabberdctl register admin pbx.dev password to create an account called admin on pbx.dev with the password "password"
  3. vi /etc/ejabberd/ejabberd.cfg
% This goes under the ACCESS CONTROL section
{acl, admin, {user, "admin", "pbx.dev"}}.
  1. service ejabberd restart
  2. Browse to http://pbx.dev:5280/admin and use admin/password to log in
  3. Virtual Hosts > pbx.dev > Users - Make a user called "asterisk". Also make yourself a user
  4. vi /etc/asterisk/xmpp.conf
[general]
autoregister=yes
autoprune=no
;
[ejabberd]
type=client
serverhost=pbx.dev
username=asterisk@pbx.dev
secret=password ;your password you chose for asterisk
priority=1
port=5222
usetls=no
usesasl=yes
status=available
statusmessage="It's Asterisk!"
timeout=5
  1. asterisk -r
  2. module reload res_xmpp - should show reloading
  3. xmpp show connections - should show 1 client connected. If so, then exit
  4. vi /etc/asterisk/extensions.conf
; replace the exten 1061 dialplan with this
exten => 1061,1,Set(JSTATUS=${JABBER_STATUS(ejabberd,youruser@pbx.dev/Desktop)}) ; /Desktop is the resource you will set in your xmpp client like Adium/Pidgin
same => n,GotoIf($[0${JSTATUS}=1]?available:unavailable)
same => n(available), JabberSend(ejabberd,youruser@pbx.dev,"Incoming call from ${CALLERID(num)}")
same => n,Dial(SIP/1061)
same => n,Hangup()
same => n(unavailable),JabberSend(ejabberd,youruser@pbx.dev,"Missed call from ${CALLERID(num)}")
; do other dialplan stuff when you're not available
  1. service asterisk restart

E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles

© 2014 VOIP4Learn. WP themonic converted by Bloggertheme9. Powered by Blogger.
TOP