LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-24-2016, 09:24 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
Learning Linux networking


Scenario on my laptop:
Initially created two VMs and gave them names: vm1 and vm2.
For KVM, it shows up as vm1.qcow2 and vm2.qcow2.
For VmWare, the files would be vm1.vmx and vm2.vmx

I can spin up both at same time and they each has IP like so:
192.168.122.67 for vm1
192.168.122.20 for vm2

The IP addresses imply I have vm1 and vm2
on a local (private) network.

Now I want to give vm1 a name like vm1.example.com and
vm2 a name like vm2.example.com.
So when accessing vm2.example.com from vm1, I would do
something like this:
vm1 $ ssh user1@vm2.example.com

At this point there is no servers named
vm1.example.com and vm2.example.com

Q1.
If I want to access my.foo.com from my laptop,
I should set its IP address in /etc/hosts, e.g.
192.168.122.222 my.foo.com

I want vm2 to be vm2.example.com.
So if I want to access vm2.example.com from server vm1,
I add this line to file /etc/hosts on server vm1:
192.168.122.20 vm2.example.com

Now I can do this:
vm1 $ ssh user1@vm2.example.com
or
vm1 $ ping vm2.example.com

And vm2 would respond to ssh and pinging, even though it does not know it is responding on behalf of vm2.example.com.
Correct?

But at this point, there is no server name vm2.example.com.
vm2 instance does not know it is vm2.example.com.

So how do I “make” or “alias” vm2 instance to be self-ware that it is vm2.example.com?

Thank you.
 
Old 10-24-2016, 09:37 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,790

Rep: Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774
You do not. Or rather, you can and likely will, but for networking purposes that is irrelevant. What you need to understand here is not networking directly (IPv4 in this case) but rather name resolution. Bind/dbs, host tables, resolv.conf, and perhaps arp would be excellent topics to consider as research topics for this study.

Nothing actually uses the FQDN (another term to look up) directly. It is always translated into some kind of IP address (generally IPv4 or IPv6 in the real world) and all networking traffic uses the IP address. Understanding something about how the FQDN gets translated to the IP address will make your entire understanding of the related topics expand.

Fun stuff!
 
1 members found this post helpful.
Old 10-27-2016, 12:19 PM   #3
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Answer to self:

Use hostnamectl to make your host's name permanent
and self-aware of its designated name.
Reboot to see permanent result.

To see host's name, use command:
>hostname
or
>hostnamectl

To see host's short name:
>hostnamectl -s
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Machine Learning, Deep Learning 101 LXer Syndicated Linux News 0 07-20-2016 11:00 AM
Coding bootcamp learning platform and privacy issues with online learning. Need Advice ! slothbin Programming 2 04-01-2016 08:33 AM
Learning Networking and Server basics Nabeel Linux - Server 2 11-27-2015 11:02 AM
Networking learning curve: No Reboot! parent's_basement Debian 17 11-19-2008 09:24 PM
Learning Networking DoubleLetter Linux - Networking 1 06-29-2003 04:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration