server – FromHostneme to address

Someone can help me with that:
From / etc / hostname where goes for example something like this
4-125 or 4-10
and / etc / network / interfaces where will be something like this

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto enp0s3
iface enp0s3 static inet
address 192.168
mask 255.255.254.0
gateway 192.168.4.1
8.8.8.8 name server 1.1.1.1

Do it auotomatic with bash or a command

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto enp0s3
iface enp0s3 interstatic
address 192.168.5.125
mask 255.255.254.0
gateway 192.168.4.1
8.8.8.8 name server 1.1.1.1