[SOLVED] Cannot ping "google.com" in my newly built LFS OS
Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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)
Last edited by parthne555; 08-15-2020 at 02:57 PM.
***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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.