Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Simple "ip host" question

Just a simple question here, (yes I'm still a beginner):

I have a router which the inside interface is hooked to a PC with the IP address 10.1.0.1.

I want to access that PC with ssh; (from the outside)

I did the command on the router:

Router(config)# ip host ssh1.myhost.com 10.1.0.1

In the future, there will be more PCs hooked to this router, and maybe switches.

I start putty on my workstation and try to open host "ssh1.myhost.com" with port 22. Connection refused.

Is this the proper way to set hosts?

1 ACCEPTED SOLUTION

Accepted Solutions
Silver

Re: Simple "ip host" question

Hi Alexandre,

If I got this right, you want to make an alias (name) for a PC host and access it from outside the router? The command ip host is simply a name mapping for ip address and is local significant for that device (in this case it is router). It is useful when you want to ssh FROM the router to another device and you don't want to type in ip address every time. But you can't access an device from outside the router using this name because it is stored only in router. The other thing is that the machine you want to access must have ssh configured and running. Please explain it more if I misunderstood you.

Best regards,

Jan.

8 REPLIES
Hall of Fame Super Silver

Simple "ip host" question

Alexandre

The syntax that you use is correct. But the command does not do what it seems that you would like it to do. When you configure that command it allows you to use that name while in a session on the router and access that address.

It sounds like what you want is to use the name ssh1.myhost.com from a session on your workstation. To accomplish this you would need DNS in your network and not the ip host command on the router.

HTH

Rick

Silver

Re: Simple "ip host" question

Hi Alexandre,

If I got this right, you want to make an alias (name) for a PC host and access it from outside the router? The command ip host is simply a name mapping for ip address and is local significant for that device (in this case it is router). It is useful when you want to ssh FROM the router to another device and you don't want to type in ip address every time. But you can't access an device from outside the router using this name because it is stored only in router. The other thing is that the machine you want to access must have ssh configured and running. Please explain it more if I misunderstood you.

Best regards,

Jan.

New Member

Simple "ip host" question

Thank you for the advice. Yes, the machine is CentOS and has OpenSSH up and running, it works well if I physically plug a keyboard on it.

So about the DNS stuff, if I set one of my machines to act as a DNS server (for example Named for linux) and I use:

Router# ip name-server

It should work, even if the DNS returns local addresses ?

New Member

Simple "ip host" question

Because I found "ip dns server" on Google, but any "ip dns" commande do not work on my 1760

Silver

Re: Simple "ip host" question

Hi Alexandre,

You're welcome and thank you! About the DNS: I believe that it should work from the router because you can configure named with private ip addresses. But if you try to get to the local machine (with local private IP) from another network it won't work if the host will use another DNS server to resolve the host name (which is locally significant only).

That is because - as in the previous scenario - ip name-server command have significance only for router, not for other machines on the network which may have another DNS server configured. This command tells the router to use DNS server with an configured ip address when translating names to ip addresses.

I don't know if that's what you are asking so feel free to correct me.

Best regards,

Jan.

New Member

Simple "ip host" question

This answer makes sense, I will test this tonight and tell you the results.

Purple

Simple "ip host" question

Hi,

just configure an entry in the hosts file on your machine mapping the name and the IP.

On linux this file is /etc/hosts and on Windows this is %systemrot%\Windows\System32\Drivers\etc\hosts

This is a text file you can open with any text editor.This way you can access the device by name on your LAN without using any DNS server.

Regards.

Alain

Don't forget to rate helpful posts.
New Member

Re: Simple "ip host" question

EDIT: To simplify, all I am trying to do is to access a machine with a paticular alias (ex: web01.myhost.com) from outside my network. Simple as that, but I can't find a solution anywhere.

I made the testing, here's what I did.

I setup a DNS server 10.2.0.1 on my local network, the DNS has been tested from inside and it is OK.

I put those configs:

dns01.myhost.com - 10.2.0.1

web01.myhost.com - 10.6.0.1

From the inside, all pings well. I made the command:

Router# ip name-server 10.2.0.1

From the router, pings to web01.myhost.com work (resolve to 10.6.0.1)

From the outside, if I ping web01.myhost.com, the router responds, but if I try to open a SSH session, the internal host is not even reached.

Any advice ?

377
Views
0
Helpful
8
Replies
CreatePlease to create content