By default, the /etc/hosts file is managed by the system. Hence, user modifications as deleted at each reboot. In order to prevent that from happening, a line has to be modified in the `/etc/cloud/cloud.cfg` file:
`manage_etc_hosts: false`
## `dnsmasq`
Installed in the front-web machine, with the following configuration (`/etc/dnsmasq.conf`):
```
domain-needed
bogus-priv
server=213.186.33.99
listen-address=192.168.0.59
no-dhcp-interface=ens4
bind-interfaces
```
The following lines are appended to the `/etc/hosts` file in the front-web machine:
```
51.83.13.51 front-web.wan
192.168.0.59 front-web.lan
51.83.15.2 back-office.wan
192.168.0.146 back-office.lan
51.68.115.202 es-1.wan
192.168.0.74 es-1.lan
51.77.229.85 es-2.wan
192.168.0.65 es-2.lan
51.83.13.94 es-3.wan
192.168.0.236 es-3.lan
```
The other machines will use front-web as DNS.
# Routing
In order for the front-web machine to be usable as a router, we need to apply the following modifications within **front-web**:
1. In `/etc/sysctl.conf` -> `net.ipv4.ip_forward=1`.
Once that it is done, the other machines can be setup as follows:
`/etc/network/interfaces`
```
[...]
iface ens4 inet static
address 192.168.0.XXX
netmask 255.255.255.0
gateway 192.168.0.59
dns-nameservers 192.168.0.59
[...]
```
In case the default gateway is not taken into account, the following command has to be issued:
`
$ route add default gw 192.168.0.59 ens4
`
The line `auto ens3` can be commented out in the file `/etc/network/interfaces.d/50-cloud-init.cfg`, in order to prevent the ens3 from being "upped" at reboot.
In order for the modification to be persisten, we need to disable cloud-init's network configuration capabilities, by editing the file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following content: