# How to use files hosts / Comment utiliser fichier hosts

**URL:** https://forum.yunohost.org/t/how-to-use-files-hosts-comment-utiliser-fichier-hosts/16338
**Category:** Advanced use case
**Tags:** french
**Created:** [June 24, 2021, 7:23am UTC](https://forum.yunohost.org/t/how-to-use-files-hosts-comment-utiliser-fichier-hosts/16338 "2021-06-24T07:23:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Guillermo](https://forum.yunohost.org/user_avatar/forum.yunohost.org/guillermo/32/1213_2.png) [@Guillermo](https://forum.yunohost.org/u/Guillermo)
#### Post date: [June 24, 2021, 7:23am UTC](https://forum.yunohost.org/t/how-to-use-files-hosts-comment-utiliser-fichier-hosts/16338/1 "2021-06-24T07:23:29Z")

</div>

Hello, (French below / Français dessous).

I have a question about using the host file, to avoid hairpainning I modified the hosts file as follows:  
`192.168.1.XX domain`

But is it possible to write it this way:  
`192.168.1.XX domain External.IP domain`

So that the hosts know how to type on both addresses if the computer is being used on the same network as the server or if it is being used on an outside network?

Thanks for your feedback  
Guillaume

* * *

Bonjour,  
J’ai une question sur l’utilisation du fichier host, pour éviter les hairpainning j’avais modifié le fichier hosts de la manière suivante :

`IP interne domaine`

Mais est-ce possible de rédiger les choses de cette manière :

```auto
IP interne domaine
IP externe domaine

```

De manière à ce que le hosts sachent taper sur les deux adresses si l’ordinateur est utiliser sur le même réseau que le serveur ou s’il est utiliser sur un réseau extérieur ?

Merci pour vos retours  
Guillaume

---

<div class="post-metadata">

### Author: ![ljf](https://forum.yunohost.org/user_avatar/forum.yunohost.org/ljf/32/58_2.png) [@ljf](https://forum.yunohost.org/u/ljf)
#### Post date: [June 25, 2021, 11:20am UTC](https://forum.yunohost.org/t/how-to-use-files-hosts-comment-utiliser-fichier-hosts/16338/2 "2021-06-25T11:20:07Z")

</div>

> [@Guillermo](#):
>
> But is it possible to write it this way:  
> `192.168.1.XX domain External.IP domain`

That’s not a valid syntax for hosts file.

If you want to switch of network with your laptop without changing your hosts file (i guess you have hairping issue that force you to write in your hosts file), i recommend you to use your yunohost server has a DNS resolver.

Like that you can configure your network connexion at home with the ip of your server has a DNS resolver, and when you connect on an other network you will use the DHCP resolver instead…

To do that:

```auto
sed -i "s/listen-address=127.0.0.1/listen-address=127.0.0.1,SERVER_LOCAL_IP/g /etc/dnsmasq.conf
systemctl restart dnsmasq
yunohost firewall allow UDP 53

```

If you are not using vpnclient\_ynh, you should check your box is not configured in DMZ mode, and check you are not forwarding the 53 port. If your 53 port is reachable from outside, your server could be used in DNS attack.

---

<div class="post-metadata">

### Author: ![Guillermo](https://forum.yunohost.org/user_avatar/forum.yunohost.org/guillermo/32/1213_2.png) [@Guillermo](https://forum.yunohost.org/u/Guillermo)
#### Post date: [June 28, 2021, 12:46pm UTC](https://forum.yunohost.org/t/how-to-use-files-hosts-comment-utiliser-fichier-hosts/16338/3 "2021-06-28T12:46:20Z")

</div>

Sound create, i will try it with my raspberry before 🙂  
Thanks a lot it will be more easy than always switch hosts files
