Access to VirtualHosts from the local network











up vote
0
down vote

favorite












I have a Ubuntu Server 18.04 over VirtualBox VM where I've installed Apache and Nginx for some testing. The VirtualServer example.com up and running on the local machine. That VM is configured with 2 network adapters, 1st one configured as Internal Network and 2nd one as NAT in order to have internet connection.



A second VM, Ubuntu 18.04 (Desktop) is configured with Internal Network only. This VM can reach the Ubuntu server via IP but is unable to resolve example.com



I'm wondering if there is a way to make it happen without configuring a DNS server on the Ubuntu Server VM. Any ideas?










share|improve this question






















  • Hi AtomicNation! You can write an entry in the /etc/hosts file with the format IP example.com. Regards
    – Jorge Valentini
    Nov 21 at 20:31








  • 1




    @AtomicNation Welcome on SuperUser... You can edit your post adding the IP of the internal network interface in order to (hope to) receive a (more) detailed answer useful for other people too... do not forget to upvote and accept the answer(s) you may found useful...
    – Hastur
    Nov 21 at 21:33

















up vote
0
down vote

favorite












I have a Ubuntu Server 18.04 over VirtualBox VM where I've installed Apache and Nginx for some testing. The VirtualServer example.com up and running on the local machine. That VM is configured with 2 network adapters, 1st one configured as Internal Network and 2nd one as NAT in order to have internet connection.



A second VM, Ubuntu 18.04 (Desktop) is configured with Internal Network only. This VM can reach the Ubuntu server via IP but is unable to resolve example.com



I'm wondering if there is a way to make it happen without configuring a DNS server on the Ubuntu Server VM. Any ideas?










share|improve this question






















  • Hi AtomicNation! You can write an entry in the /etc/hosts file with the format IP example.com. Regards
    – Jorge Valentini
    Nov 21 at 20:31








  • 1




    @AtomicNation Welcome on SuperUser... You can edit your post adding the IP of the internal network interface in order to (hope to) receive a (more) detailed answer useful for other people too... do not forget to upvote and accept the answer(s) you may found useful...
    – Hastur
    Nov 21 at 21:33















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a Ubuntu Server 18.04 over VirtualBox VM where I've installed Apache and Nginx for some testing. The VirtualServer example.com up and running on the local machine. That VM is configured with 2 network adapters, 1st one configured as Internal Network and 2nd one as NAT in order to have internet connection.



A second VM, Ubuntu 18.04 (Desktop) is configured with Internal Network only. This VM can reach the Ubuntu server via IP but is unable to resolve example.com



I'm wondering if there is a way to make it happen without configuring a DNS server on the Ubuntu Server VM. Any ideas?










share|improve this question













I have a Ubuntu Server 18.04 over VirtualBox VM where I've installed Apache and Nginx for some testing. The VirtualServer example.com up and running on the local machine. That VM is configured with 2 network adapters, 1st one configured as Internal Network and 2nd one as NAT in order to have internet connection.



A second VM, Ubuntu 18.04 (Desktop) is configured with Internal Network only. This VM can reach the Ubuntu server via IP but is unable to resolve example.com



I'm wondering if there is a way to make it happen without configuring a DNS server on the Ubuntu Server VM. Any ideas?







networking virtualbox virtual-machine virtual-host






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 at 19:05









AtomicNation

31




31












  • Hi AtomicNation! You can write an entry in the /etc/hosts file with the format IP example.com. Regards
    – Jorge Valentini
    Nov 21 at 20:31








  • 1




    @AtomicNation Welcome on SuperUser... You can edit your post adding the IP of the internal network interface in order to (hope to) receive a (more) detailed answer useful for other people too... do not forget to upvote and accept the answer(s) you may found useful...
    – Hastur
    Nov 21 at 21:33




















  • Hi AtomicNation! You can write an entry in the /etc/hosts file with the format IP example.com. Regards
    – Jorge Valentini
    Nov 21 at 20:31








  • 1




    @AtomicNation Welcome on SuperUser... You can edit your post adding the IP of the internal network interface in order to (hope to) receive a (more) detailed answer useful for other people too... do not forget to upvote and accept the answer(s) you may found useful...
    – Hastur
    Nov 21 at 21:33


















Hi AtomicNation! You can write an entry in the /etc/hosts file with the format IP example.com. Regards
– Jorge Valentini
Nov 21 at 20:31






Hi AtomicNation! You can write an entry in the /etc/hosts file with the format IP example.com. Regards
– Jorge Valentini
Nov 21 at 20:31






1




1




@AtomicNation Welcome on SuperUser... You can edit your post adding the IP of the internal network interface in order to (hope to) receive a (more) detailed answer useful for other people too... do not forget to upvote and accept the answer(s) you may found useful...
– Hastur
Nov 21 at 21:33






@AtomicNation Welcome on SuperUser... You can edit your post adding the IP of the internal network interface in order to (hope to) receive a (more) detailed answer useful for other people too... do not forget to upvote and accept the answer(s) you may found useful...
– Hastur
Nov 21 at 21:33












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Let's suppose the IP of the web server is 10.0.0.1.



Write a line in the /etc/hosts file of the second VM (The client):



10.0.0.1     example.com


And it will be able to resolve example.com as 10.0.0.1



Note: It can be a tab, a space of multiple spaces to separate the two arguments



Note 2: This is for testing purposes only, not for production environments



Note 3: As @Hastur states, for the specific case of example.com, this should not be of any inconvenience as it is reserved, but if it actually is another domain, use only for testing purposes!






share|improve this answer



















  • 1




    Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
    – Hastur
    Nov 21 at 21:00












  • Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
    – Jorge Valentini
    Nov 21 at 21:07












  • Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
    – Hastur
    Nov 21 at 21:28












  • Amazing story!!
    – Jorge Valentini
    Nov 21 at 21:33






  • 1




    Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
    – Hastur
    Nov 21 at 21:44













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1377387%2faccess-to-virtualhosts-from-the-local-network%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Let's suppose the IP of the web server is 10.0.0.1.



Write a line in the /etc/hosts file of the second VM (The client):



10.0.0.1     example.com


And it will be able to resolve example.com as 10.0.0.1



Note: It can be a tab, a space of multiple spaces to separate the two arguments



Note 2: This is for testing purposes only, not for production environments



Note 3: As @Hastur states, for the specific case of example.com, this should not be of any inconvenience as it is reserved, but if it actually is another domain, use only for testing purposes!






share|improve this answer



















  • 1




    Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
    – Hastur
    Nov 21 at 21:00












  • Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
    – Jorge Valentini
    Nov 21 at 21:07












  • Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
    – Hastur
    Nov 21 at 21:28












  • Amazing story!!
    – Jorge Valentini
    Nov 21 at 21:33






  • 1




    Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
    – Hastur
    Nov 21 at 21:44

















up vote
1
down vote



accepted










Let's suppose the IP of the web server is 10.0.0.1.



Write a line in the /etc/hosts file of the second VM (The client):



10.0.0.1     example.com


And it will be able to resolve example.com as 10.0.0.1



Note: It can be a tab, a space of multiple spaces to separate the two arguments



Note 2: This is for testing purposes only, not for production environments



Note 3: As @Hastur states, for the specific case of example.com, this should not be of any inconvenience as it is reserved, but if it actually is another domain, use only for testing purposes!






share|improve this answer



















  • 1




    Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
    – Hastur
    Nov 21 at 21:00












  • Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
    – Jorge Valentini
    Nov 21 at 21:07












  • Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
    – Hastur
    Nov 21 at 21:28












  • Amazing story!!
    – Jorge Valentini
    Nov 21 at 21:33






  • 1




    Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
    – Hastur
    Nov 21 at 21:44















up vote
1
down vote



accepted







up vote
1
down vote



accepted






Let's suppose the IP of the web server is 10.0.0.1.



Write a line in the /etc/hosts file of the second VM (The client):



10.0.0.1     example.com


And it will be able to resolve example.com as 10.0.0.1



Note: It can be a tab, a space of multiple spaces to separate the two arguments



Note 2: This is for testing purposes only, not for production environments



Note 3: As @Hastur states, for the specific case of example.com, this should not be of any inconvenience as it is reserved, but if it actually is another domain, use only for testing purposes!






share|improve this answer














Let's suppose the IP of the web server is 10.0.0.1.



Write a line in the /etc/hosts file of the second VM (The client):



10.0.0.1     example.com


And it will be able to resolve example.com as 10.0.0.1



Note: It can be a tab, a space of multiple spaces to separate the two arguments



Note 2: This is for testing purposes only, not for production environments



Note 3: As @Hastur states, for the specific case of example.com, this should not be of any inconvenience as it is reserved, but if it actually is another domain, use only for testing purposes!







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 at 21:11

























answered Nov 21 at 20:33









Jorge Valentini

1929




1929








  • 1




    Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
    – Hastur
    Nov 21 at 21:00












  • Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
    – Jorge Valentini
    Nov 21 at 21:07












  • Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
    – Hastur
    Nov 21 at 21:28












  • Amazing story!!
    – Jorge Valentini
    Nov 21 at 21:33






  • 1




    Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
    – Hastur
    Nov 21 at 21:44
















  • 1




    Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
    – Hastur
    Nov 21 at 21:00












  • Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
    – Jorge Valentini
    Nov 21 at 21:07












  • Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
    – Hastur
    Nov 21 at 21:28












  • Amazing story!!
    – Jorge Valentini
    Nov 21 at 21:33






  • 1




    Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
    – Hastur
    Nov 21 at 21:44










1




1




Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
– Hastur
Nov 21 at 21:00






Hi Jorge, neat answer. Ps> example.com is one of the managed Reserved Domains... so even in a production environment it shouldn't incur in serious problems... but it is always better to say.
– Hastur
Nov 21 at 21:00














Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
– Jorge Valentini
Nov 21 at 21:07






Applause! hahaha, Thanks for your comment @Hastur, I just assumed that example.com was actually an example for him!! I figured that it wasn't actually example.com. But I didn't know it was reserved for this, so thanks for enlightening me!
– Jorge Valentini
Nov 21 at 21:07














Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
– Hastur
Nov 21 at 21:28






Well I seem to remember that instead of example.com in the beginning it was proposed another one... but actually someone had already registered it in the real life... ;) ps> name related to the disappoint often felt when you test something...
– Hastur
Nov 21 at 21:28














Amazing story!!
– Jorge Valentini
Nov 21 at 21:33




Amazing story!!
– Jorge Valentini
Nov 21 at 21:33




1




1




Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
– Hastur
Nov 21 at 21:44






Unfortunately It is an urban myth... Just check the issue date of the RFC 2606 (where it is reserved example.com) --June 1999-- and the one of the registration of the other name on whois --Registered On: 1999-07-08-- but it was funny to listen...
– Hastur
Nov 21 at 21:44




















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1377387%2faccess-to-virtualhosts-from-the-local-network%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Список кардиналов, возведённых папой римским Каликстом III

Deduzione

Mysql.sock missing - “Can't connect to local MySQL server through socket”