i am having virtual server from Hetzner and after installing the CentOS 6 linux, i do not know how to make the default installation available from the internet, how to setup the routing. The Hetzner says that the gateway IP should be 172.31.1.1 (https://wiki.hetzner.de/index.php/CloudServer/en#What_are_Routes.3F - "The special private IP Address
172.31.1.1. This IP address is being used as a default gateway of your servers public network interface. ")
At first following worked: /sbin/route add default gw 172.31.1.1 eth0
but now one day later it says SDIOCADDRT: Network is unreachable. Current routing table (route -n) contains only one rule: 169.254.0.0/16 dev eth0 scope link metric 1002
Config file for the eth0 interface is: https://i.postimg.cc/9Qc6VwK7/ifcfg-eth0.gif
Please can you tell me which commands should make the routing table be done properly? Or what is wrong in my eth0 interface config. file?
UPDATE: i was told i should use static configuration on CentOS 6, but i am having problem with the route-eth0 file as i am unable to create it:
cp /etc/host.conf /etc/sysconfig/network-scripts/route-eth0
perl -pi -e s/multi on/172\.31\.1\.1\/32 dev eth0\\ndefault via 172\.31\.1\.1 dev eth0/g /etc/sysconfig/network-scripts/route-eth0
The error is: Substitution pattern not terminated at -e line 1.
(i can not use echo or tee or vim because Hetzner console do not work with | " ' $ > characters and Ctrl key)