Thursday, June 23, 2016

Xen 4.4: How to configure dom0 and domu with different ip subnet in Debian Jessie

Dom0 and domu has different subnet and dom0 act as router
  • Dom0 has A.B.C.81 with netmask 255.255.255.0.
  • Domu has ip range X.Y.X.144 - X.Y.Z.151 netmask 255.255.255.248.
OVH inform us, this ip range (X.Y.X.144 - X.Y.Z.151) will be reroute via A.B.C.81. It means, br0 becomes a gateway for domu.

Solution: 
This is text diaagram for paritcular case:
A.B.C.254 ---- A.B.C.81
(Gateway)       (br0/dom0)
                       X.Y.X.150 ---- X.Y.X.144 - X.Y.Z.149 (domu)
                         (br1/dom0)
List of ip can not be used for domu 
  • X.Y.X.144 as address 
  • X.Y.X.151 as broadcast
  • X.Y.X.150 OVH ask me to assign this ip as a gateway
I create a new bridge network br1 which does not attach to any physical device and assign it as router with ip Z.Y.Z.150:
# brctl addbr br1
# ifconfig br1 Z.Y.Z.150 netmask 255.255.255.248 up
# brctl stp br1 on (optional)
Here is a new bridge configuration:
# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.e03f49e8149b       yes             eth0
br1             8000.feffffffffff       no              vif2.0
virbr0          8000.000000000000       no
Here is route output:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         A.B.C.254  0.0.0.0         UG    0      0        0 br0
A.B.C.0    *               255.255.255.0   U     0      0        0 br0
192.168.0.0     *               255.255.255.0   U     0      0        0 virbr0
X.Y.X.144  *               255.255.255.248 U     0      0        0 br1
You can create your domu using xen-create-image with ip range from X.Y.X.145 to X.Y.X.149 and br1 as bridge network. This is an example:
# xen-create-image --hostname test --size=10GB --swap=1024MB --memory=512MB --vcpu=1 --dist=jessie --ip=Z.Y.Z.145 --netmask=255.255.255.248 --gateway=Z.Y.Z.150 --bridge=br1
Ping reply from outside (public) after dom0 make internal process to reroute from br0 into br1:
>ping x.y.z.145

Pinging x.y.z.145 with 32 bytes of data:
Reply from x.y.z.145: bytes=32 time=276ms TTL=50
Reply from x.y.z.145: bytes=32 time=270ms TTL=50
Reply from x.y.z.145: bytes=32 time=288ms TTL=50
Reply from x.y.z.145: bytes=32 time=269ms TTL=50

Ping statistics for x.y.z.145:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 269ms, Maximum = 288ms, Average = 275ms
To make it permanent, add br1 into /etc/network/networking in dom0:
auto br1
iface br1 inet static
        address X.Y.X.150
        netmask 255.255.255.248
        broadcast X.Y.X.151
   pre-up brctl addbr br1
References (thanks):

Tuesday, June 14, 2016

Odoo: Installation problems

Symptom: FATAL:  role "odoo" does not exist

Solution:

You need to create postgresql user with name odoo. As root create postgresql user:
# su - postgres -c "createuser -s odoo"

Symptom: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

Solution:

Alter postgresql encoding.

# su postgres

$ psql postgres
psql (9.6.4)
Type "help" for help.

postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0" as user "postgres".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
template0=# drop database template1;
DROP DATABASE
template0=# create database template1 with template = template0 encoding = 'UTF8';
CREATE DATABASE
template0=# update pg_database set datistemplate = TRUE where datname = 'template1';
UPDATE 1
template0=# \c template1
You are now connected to database "template1" as user "postgres".
template1=# update pg_database set datallowconn = FALSE where datname = 'template0';
UPDATE 1
template1=# \q


References: