LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 09-13-2020, 10:54 PM   #16
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by boughtonp View Post
That's not what I said.

Given an /etc/hosts containing the line "127.0.1.1 fullnameofserver localnameofserver" then /etc/hostname should be "localnameofserver" (but will probably also work fine if its "fullnameofserver" instead).



As I wrote: I can't find any information on whether localhost is needed for /etc/hosts on Linux (on Windows it's not), but the example in "man hosts" says its "desirable"

Is it OK?
Code:
# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 example.net example
1.2.3.4 www.example.net example.net
 
Old 09-14-2020, 07:32 AM   #17
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,599

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546

You have example.net assigned to both 127.0.0.1 and 1.2.3.4 - only the first IP found for a hostname applies.

What is 1.2.3.4 supposed to indicate?

The /etc/hosts file is used for requests originating from that server - it does not apply externally. (For that you need to configure DNS records on the nameservers.)


Last edited by boughtonp; 09-14-2020 at 07:33 AM.
 
Old 09-18-2020, 06:52 AM   #18
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
You have example.net assigned to both 127.0.0.1 and 1.2.3.4 - only the first IP found for a hostname applies.

What is 1.2.3.4 supposed to indicate?

The /etc/hosts file is used for requests originating from that server - it does not apply externally. (For that you need to configure DNS records on the nameservers.)

With a correct "/etc/hosts" and "/etc/hostname", when I SSH to a web server that its global IP address is "1.2.3.4" and "ping localhost" and "ping example.net" then the ping command must show what IP address?
 
  


Reply



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
Fetchmail and Server certificate verification error: unable to get local issuer certificate Mr486 Linux - Software 2 08-12-2018 08:20 AM
SSL certificate generation question - No certificate matches private key etcetera Linux - General 1 04-10-2017 01:28 PM
[SOLVED] SSL Certificate for multiple hosts behind load balancer S-S Linux - Server 1 06-05-2013 10:20 AM
How to import/use CAcert SSL root certificate to use SSL with Xchat IRC client? GrapefruiTgirl Linux - Software 9 04-05-2011 09:54 AM
Apache with SSL does not load the 2nd SSL certificate janstapel Linux - Newbie 1 06-17-2010 09:32 PM

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

All times are GMT -5. The time now is 07:32 AM.

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