LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-15-2020, 01:32 PM   #1
parthne555
LQ Newbie
 
Registered: Aug 2020
Posts: 4

Rep: Reputation: Disabled
Cannot ping "google.com" in my newly built LFS OS


I have just completed building my LFS OS. I am following LFS book 9.1 (latest stable). Everything works fine until I enter this command : ping google.com
It takes a while then I get this -> ping: unknown host

Please help!

Thanks in advance

Last edited by parthne555; 08-15-2020 at 01:35 PM.
 
Old 08-15-2020, 02:28 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,155

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
try:
Code:
ping 8.8.8.8
if that works then there's nothing wrong with your connection you just have a bad/undefined dns.
 
1 members found this post helpful.
Old 08-15-2020, 02:30 PM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,155

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
post the contents of /etc/resolv.conv
 
Old 08-15-2020, 02:44 PM   #4
parthne555
LQ Newbie
 
Registered: Aug 2020
Posts: 4

Original Poster
Rep: Reputation: Disabled
I entered this command "ping 8.8.8.8". It says-> Destination host unreachable. I have attached files please take a look at them. Also please note that I have selected Bridged Adapter->Realtek 8821AE Wireless Lan 802.11ac PCI-E NIC in virtual box network settings for this particular vm(i.e my LFS OS)
Attached Thumbnails
Click image for larger version

Name:	VirtualBox_KALI Linux_resolve.png
Views:	96
Size:	2.2 KB
ID:	33879   Click image for larger version

Name:	VirtualBox_KALI Linux_ping.png
Views:	102
Size:	6.0 KB
ID:	33880  

Last edited by parthne555; 08-15-2020 at 02:57 PM.
 
Old 08-16-2020, 06:20 AM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,155

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
if you have solved this please post the solution for the sake of others
 
Old 08-16-2020, 07:31 AM   #6
parthne555
LQ Newbie
 
Registered: Aug 2020
Posts: 4

Original Poster
Rep: Reputation: Disabled
To anyone who has encountered the same problem!

***Please read this carefully and patiently. I know this is long but it will help you!***

Here's what I did. I shared my hotspot with my windows PC that was running the newly built LFS OS on virtual box. Now I entered the default IP, Gateway and BROADCAST that was mentioned in the LFS-Book (9.1) i.e IP=192.168.1.2, GATEWAY=192.168.1 and BROADCAST=192.168.1.255 also PREFIX=24(these all for IPV4), then I booted it up. Entered the command-> ping google.com and I got this-> ping: unknown host. So the I watched SUDOTECH video on YouTube (which has also explained the building up of LFS OS very clearly) in a hope to find an answer as he TYPED in IP=192.168.0.2, GATEWAY=192.168.0.1, PREFIX=24 and BROADCAST=192.168.0.255 so as I did . Again when I entered the command "ping google.com" I got this-> ping: unknown host. So practically I did very thing possible anyone can think of doing. Then I checked the IP address of my windows PC connected to the hotspot it was 192.x.t.x(just assume this is the IP address of my windows pc for now). Now I took the "t" from that ip address (as everything else was same in the default IP address given by LFS) and placed it in the correct position in the default IP,default GATEWAY and default BROADCAST and letting everything else same as it is(PREFIX=24 of course). It worked magically!!
Steps to get the correct IP for your LFS OS project

1. Get the default IP, GATEWAY, BROADCAST and PREFIX from the LFS-Book.

2. Get the actual IP of at least one device connected to either hotspot or router(assuming only one device is connected).

3. Compare your IP(default one from LFS_Book) with the actual IP you got from the device connected to either hotspot or router.
For ex: if the actual IP of the device be x1.x2.x3.x4 then your IP for the LFS OS should be x1.x2.x3.y where y is any number less than or greater than x4 but not equal to x4

4. Accordingly change your GATEWAY, BROADCAST
For ex: Once you got the correct IP for your LFS OS(by following the above point correctly) then your GATEWAY should be x1.x2.x3.(y-1) and BROADCAST will be x1.x2.x3.255

5. Let the PREFIX=24 as we are doing this for IPV4

6. Configure the virtual box network settings to either to NAT(not NAT network!) or Bridged adapter.

That's it you are good to go!

**NOTE** -: These steps worked for me, but these might not work for you in some cases(as I am using virtual box). So in that case you should apply hit-and-trial analogy to get things working as I did in my case!

Last edited by parthne555; 08-16-2020 at 07:56 AM.
 
1 members found this post helpful.
Old 08-16-2020, 07:42 AM   #7
parthne555
LQ Newbie
 
Registered: Aug 2020
Posts: 4

Original Poster
Rep: Reputation: Disabled
Sorry Mr. Kieth Hedger I was busy working on my operating system(not the LFS one) so I forgot about this thread
 
Old 08-16-2020, 08:29 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,680
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
The addresses given in the book are specimens. There's no guarantee that your network will be using the same numbers. But it's fairly easy to find out your local IP address (/sbin/ifconfig) and the local address of your router/gateway (/sbin/ip route show). Then the broadcast address for the network will be the same for the first three octets with 255 for the fourth one.
 
Old 12-03-2022, 12:40 AM   #9
sodacris
LQ Newbie
 
Registered: Dec 2022
Posts: 3

Rep: Reputation: 0
VMware specific

I'm using VMWare, and find that VMWare's NAT Gateway is 192.168.X.2. The 192.168.X.1 is the host's IP.
I change the GATEWAY in /etc/sysconfig/ifconfig.XXX to 192.168.X.2, and it finally works.

BTW, if you find the network name annoying, I suggest using the following udev scripts:
/etc/udev/rules.d/10-my-custom-net.rules with content:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:4e:f7:3c", NAME="eth0"

the mac is the one from "ip addr", then reboot and it will be eth0.
 
  


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
problem with ssh on newly built lfs lfslfs Linux From Scratch 13 07-24-2017 11:52 PM
I cannot ping with command 'ping IP' address but can ping with 'ping IP -I eth0' sanketmlad Linux - Networking 2 07-15-2011 05:32 AM
can ping network computer, cannot ping google.com (help needed) ben_build#2.1.0 Linux - Wireless Networking 23 11-07-2010 12:55 PM
Newly Built Debian Server - PC Unable to Browse to Google bbrazell Linux - Server 5 06-01-2010 11:32 AM
Unable to boot the newly built LFS. luckybtn Linux From Scratch 3 09-13-2008 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

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