Sei sulla pagina 1di 3

--configuracion LVS

Paso 1: apt-get update


Paso 2: apt-get upgrade
Paso 3: apt-get install keepalived
Paso 4: vi /etc/keepalived/keepalived.conf
Paso 5: echo 1 /proc/sys/net/ipv4/ip_forward
Paso 6: systemctl restart keepalived.service
Paso 7: ip addr list
Paso 8: ipvsadm -L -n

clone machines virtuals

eisen@master:~$ hostnamectl set-hostname backup

---grafic interface
sudo apt-get install ubuntu-desktop

Master:
ipvirtual fuera: 172.168.0.100
ipRealdefuera: 172.168.0.101 ens34
ipRealdedentro: 172.168.1.101 ens39

Backup:
ipvirtual fuera: 172.168.0.102 ens34
ipRealdedentro: 172.168.1.102 ens39

ipvirtualdedentro
172.168.1.100

----------------------------------------------

sudo apt-get install apache2

apache1
ip:172.168.1.201 ens34
Gw:172.168.1.100

cat /var/www/html/mipagina.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<p>Servidor Apache apache1 con ip 172.168.1.201</p>
</body>
</html>
apache2
ip:172.168.1.202 ens39
Gw:172.168.1.100

cat /var/www/html/mipagina.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<p>Servidor Apache apache2 con ip 172.168.1.202</p>
</body>
</html>

sudo vi /etc/keepalived/keepalived.conf

global_defs {
! notification_email {
! root@dlp.srv.world
! }
! notification_email_from root@dlp.srv.world
! smtp_server 127.0.0.1
! smtp_connect_timeout 30
! router_id LVS_Server
}
vrrp_sync_group interfacesRouter1 {
group {
ipvirtualDeDentro
ipvirtualDeFuera
}
}
vrrp_instance ipvirtualDeDentro {
state master
# monitored interface
interface ens39
lvs_sync_daemon_interface ens39
# virtual router's ID
virtual_router_id 51
# set priority (change this value on each server)
# (large number means priority is high)
priority 150
# VRRP sending interval
advert_int 1
# authentication info between Keepalived servers
authentication {
auth_type PASS
auth_pass 1234
}
virtual_ipaddress {
# virtual IP address
172.168.1.100
}
}
vrrp_instance ipvirtualDeFuera {
state master
# monitored interface
interface ens34
lvs_sync_daemon_interface ens34
# virtual router's ID
virtual_router_id 52
# set priority (change this value on each server)
# (large number means priority is high)
priority 150
# VRRP sending interval
advert_int 1
# authentication info between Keepalived servers
authentication {
auth_type PASS
auth_pass 1234
}
virtual_ipaddress {
# virtual IP address
172.168.0.100
}
}
virtual_server 172.168.0.100 80 {
# monitored interval
delay_loop 30
lb_algo rr
lb_kind NAT
net_mask 255.255.255.0
protocol TCP
real_server 172.168.1.201 80 {
weight 1
TCP_CHECK {
connect_port 80
connect_timeout 3
}
}
real_server 172.168.1.202 80 {
weight 1
TCP_CHECK {
connect_port 80
connect_timeout 3
}
}
}

Potrebbero piacerti anche