0

I want to be able to do:

  1. ssh user_name@bla where bla points to a specific ip address
  2. Same, but from browser, I want to access http://blabla where blabla is another specific ip address with a port (i.e. 1.2.3.4:5678)

Is there a local DNS I can setup?

Working on 16.04

EDIT:

(1) can be easily achieved by adding the following line to /etc/hosts file: IP_ADDR bla and then ping bla translates into ping IP_ADDR. However (2) still eludes me.

Without a port, its much the same like (1), but adding a port makes it more complicated

1 Answers1

1

You can setup DNS for this, but much easier for local use is editing the /etc/hosts file:

127.0.0.1   localhost
127.0.1.1   Yourhostname

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters

192.168.124.99 bla 192.168.124.100 blabla 192.168.124.107 blablabla

Starting from a fresh /etc/hosts file, leave the lines that are already there alone, add your hostname as 127.0.1.1, and add others as needed. Save the file. It will work instantly.

EDIT this answer was posted before you added the /etc/hosts suggestion yourself.

Jos
  • 30,529
  • 8
  • 89
  • 96