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)
They told me i need to use static configuration and it worked (after restarting network / rebooting).
(Note that the IPs under that link are likely specific only to a Hetzner servers)
Adjusting the configuration files was very difficult via Hetzner console (which does not accept Ctrl key, | > $ " ' etc.).
These were the commands i had to run (will almost certainly work only on Hetzner + CentOS 6 and after replacing myvpspubliciphere. But can give idea for anyone using limitted web console like one from Hetzner):
(the cp command was used to get a small file with just a two words which i can use for easily replacing its content by what i needed)