LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 03-12-2020, 01:46 AM   #1
bscho
Member
 
Registered: Nov 2012
Location: London
Distribution: Mint 20, Kali, Peppermint, Ubuntu, MakuluFlash, Fedora 32, Windows 12 Lite, MakuluLinux
Posts: 821

Rep: Reputation: 28
Hosting hosts file need help.


Hosting my site on Fedora 31. I can see the site on localhost and did see the site before on 192.168.1.5 but now that has disappeared and i can only see it on localhost. The hosts file only showed localhost at 127.0.0.1

I have tried to put 192.168.1.5 in the hosts file but it still does not work.

This is my hosts file

192.168.1.10 localhost
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain
192.168.1.5 localhost

I tried 192.168.1.10 and this does not work either.

Why did 192.168.1.5 disappear in the first place?

Have I not put the correct entry into the hosts file?

How can I fix this please?
 
Old 03-12-2020, 02:37 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,749

Rep: Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928
I assume your PC is using DHCP and normally nothing else is in the hosts file except for localhost by default.

If your using DHCP maybe your router or DHCP server assigned the computer a different IP address. Use a DHCP address reservation.

If the PC is not acquiring an IP address then something could be wrong with hardware assuming you have not made any changes to any network configuration settings like network manager. Is the PC wired or wireless? Does the output of the command
ip a

show any network adapters other then lo? Post the output. If wired make sure you see the LEDs on the adapter are flashing. If not check cables and what ever devie it is plugged into i.e router or switch etc.

If wireless are other devices connected to the router or access point work ok? If yes your adapter could have failed. Some other wireless device nearby could be interfering with the signal. Baby monitors, cordless phones etc.

Does the network adapter show up in the output of the lspci or lsusb command if a USB device? If not then could be hardware problem?

If integrated into motherboard then CMOS battery could be bad and settings default to disabled for the network adapter.

Last edited by michaelk; 03-12-2020 at 02:42 AM.
 
Old 03-12-2020, 03:37 AM   #3
bscho
Member
 
Registered: Nov 2012
Location: London
Distribution: Mint 20, Kali, Peppermint, Ubuntu, MakuluFlash, Fedora 32, Windows 12 Lite, MakuluLinux
Posts: 821

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by michaelk View Post
I assume your PC is using DHCP and normally nothing else is in the hosts file except for localhost by default.

If your using DHCP maybe your router or DHCP server assigned the computer a different IP address. Use a DHCP address reservation.

If the PC is not acquiring an IP address then something could be wrong with hardware assuming you have not made any changes to any network configuration settings like network manager. Is the PC wired or wireless? Does the output of the command
ip a

show any network adapters other then lo? Post the output. If wired make sure you see the LEDs on the adapter are flashing. If not check cables and what ever devie it is plugged into i.e router or switch etc.

If wireless are other devices connected to the router or access point work ok? If yes your adapter could have failed. Some other wireless device nearby could be interfering with the signal. Baby monitors, cordless phones etc.

Does the network adapter show up in the output of the lspci or lsusb command if a USB device? If not then could be hardware problem?

If integrated into motherboard then CMOS battery could be bad and settings default to disabled for the network adapter.
The router has nothing to do with it.

I am hosting my site on my machine.

The router need a ip address to do port forwarding but will not fowrward with localhost it need the 192.168.1.5

That is why I need to see my site on my machine at another ip address other than 127.0.0.1
 
Old 03-12-2020, 03:57 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,749

Rep: Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928
There are basically to ways to configure networking on the computer. It is assigned an IP address from the router or other DHCP server or a static address is configured on the computer itself via network manager. If network manager is disabled then via script files.

If using DHCP usually on a small network the same IP will be assigned as long as the lease has not expired and nothing else is using the same address. Otherwise it could change. Look at the output of the ip a command. Is an address assigned other then lo? If so what is it?
 
Old 03-12-2020, 04:59 AM   #5
bscho
Member
 
Registered: Nov 2012
Location: London
Distribution: Mint 20, Kali, Peppermint, Ubuntu, MakuluFlash, Fedora 32, Windows 12 Lite, MakuluLinux
Posts: 821

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by michaelk View Post
There are basically to ways to configure networking on the computer. It is assigned an IP address from the router or other DHCP server or a static address is configured on the computer itself via network manager. If network manager is disabled then via script files.

If using DHCP usually on a small network the same IP will be assigned as long as the lease has not expired and nothing else is using the same address. Otherwise it could change. Look at the output of the ip a command. Is an address assigned other then lo? If so what is it?
It has nothing to do with the router

I am hosting on my machine.

I have not yet connected to the net.

I just want to see my site at 192.168.1.5 that i used to see on my machine not connected to the net just like I see it on localhost

Last edited by bscho; 03-12-2020 at 05:02 AM.
 
Old 03-12-2020, 05:12 AM   #6
bscho
Member
 
Registered: Nov 2012
Location: London
Distribution: Mint 20, Kali, Peppermint, Ubuntu, MakuluFlash, Fedora 32, Windows 12 Lite, MakuluLinux
Posts: 821

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by michaelk View Post
There are basically to ways to configure networking on the computer. It is assigned an IP address from the router or other DHCP server or a static address is configured on the computer itself via network manager. If network manager is disabled then via script files.

If using DHCP usually on a small network the same IP will be assigned as long as the lease has not expired and nothing else is using the same address. Otherwise it could change. Look at the output of the ip a command. Is an address assigned other then lo? If so what is it?
Perhaps you do not understand me when I say hosting. I am running apache2 with my website in var/www/html on Fedora

I can see the website on localhost but no longer can see it at 192.168.1.5 which I used to see it on.

Why it changed I do not know? I need to see it on any address other than localhost that is why I changed my hosts file

which has not worked.
 
Old 03-12-2020, 05:35 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,749

Rep: Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928
Post the output of the command
ip a
 
Old 03-12-2020, 07:49 AM   #8
bscho
Member
 
Registered: Nov 2012
Location: London
Distribution: Mint 20, Kali, Peppermint, Ubuntu, MakuluFlash, Fedora 32, Windows 12 Lite, MakuluLinux
Posts: 821

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by michaelk View Post
Post the output of the command
ip a
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 40:8d:5c:73:2b:46 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic noprefixroute enp1s0
valid_lft 82622sec preferred_lft 82622sec
inet6 fe80::b0f1:2dcb:39b7:432b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlp2s6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether d6:1a:eb:2c:9f:5c brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:61:55:32 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:61:55:32 brd ff:ff:ff:ff:ff:ff
[gina@localhost ~]

This was great I found my site on 192.168.122.1

So I can now do port forwarding on my router.

Thanks that helped a lot.

Still cannot figure our why 192.168.1.5 does not work anymore and I have entered it in the hosts file but still it illudes me.
 
Old 03-12-2020, 08:14 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,749

Rep: Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928
Its 192.168.1.100.

Reread what I posted about DHCP. You can add an address reservation in the router so the computer always gets the same ip address.
 
Old 03-12-2020, 11:26 AM   #10
bscho
Member
 
Registered: Nov 2012
Location: London
Distribution: Mint 20, Kali, Peppermint, Ubuntu, MakuluFlash, Fedora 32, Windows 12 Lite, MakuluLinux
Posts: 821

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by michaelk View Post
Its 192.168.1.100.

Reread what I posted about DHCP. You can add an address reservation in the router so the computer always gets the same ip address.
Yes will do I missed it the frist time.
 
  


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
hp-hosts hosts file format change Skaendo Slackware 0 02-28-2019 01:45 AM
[SOLVED] How to 'include file' in hosts.allow or hosts.deny? arfon Linux - Security 8 01-19-2018 09:54 PM
[SOLVED] Need help to get the available hosts among many hosts Ben Wang Linux - Newbie 5 05-12-2015 04:55 PM
do I really need virtual hosting if only hosting one site kustomjs Linux - Server 8 05-22-2008 12:17 PM
does the /etc/hosts file work same as the M$ hosts file? Lleb_KCir Linux - Software 6 04-03-2004 04:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 07:02 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