LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-24-2012, 12:49 PM   #1
dllobach
LQ Newbie
 
Registered: Jan 2012
Posts: 22

Rep: Reputation: Disabled
Setting up "hosts" on a standalone desktop PC


I've recently gotten through LFS 7.0 and all is fine until I get to the networking part (never been my strong suite.) I've been all over LQ (and other places) trying to get past the infamous "unknown host" problem: to no avail. I think I'm getting screwed up with the etc/hosts file. Here's what I've got:

/etc/hosts:
Code:
127.0.0.1	localhost
127.0.1.1	LFS2

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
/etc/resolv.conf
Code:
# /etc/resolv.conf
nameserver 74.128.17.114
nameserver 74.128.19.102
/etc/nsswitch.conf
Code:
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
/etc/sysconfig/ifconfig.eth0
Code:
ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static
IP=74.138.128.1
#GATEWAY=74.138.128.1
PREFIX=24
BROADCAST=74.138.135.255
I've confirmed the info from a working Ubuntu on the same PC. The Ubuntu connections shows:
Code:
Interface:           Ethernet (eth0)
Hardware Address:    E0:CB:4E:C4:0E:48
Driver:              forcedeth
Speed:               100 Mb/s
Security:            None

IPv4
IP Address:          74.138.129.126
Broadcast Address:   74.138.135.255
Subnet Mask:         255.255.248.0
Default Route:       74.138.128.1
Primary DNS:         74.128.17.114
Secondary DNS:       74.128.19.102
and when I issue route -n command from Ubuntu it shows Gateway = 74.138.128.1

issuing hostname --all-fqdns shows 74-138-129-126.dhcp.insightbb.com

I think I'm screwing up the LFS /etc/hosts file but have tried so many variations I'm going in circles. Can anyone see where I'm going wrong?

Thanks in advance, DaleL
 
Old 01-24-2012, 01:44 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,667

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Quote:
127.0.0.1 localhost
127.0.1.1 LFS2

Have you tried changing it to 127.0.0.1 just the same as localhost 127.0.0.1 ?
 
Old 01-24-2012, 02:04 PM   #3
dllobach
LQ Newbie
 
Registered: Jan 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thanks for the quick reply!

I gave your thought a quick try on my LFS running on virtualbox but still get "unknown host" when I ping. I don't think it'll make a difference but I will try it again when I reboot into the dedicated LFS partition.

DaleL
 
Old 01-24-2012, 05:09 PM   #4
Bertical
Member
 
Registered: Oct 2008
Location: Kingdom of Mercia
Distribution: Slackware
Posts: 83

Rep: Reputation: 13
My network theory is a bit rusty ... aren't you on a /21 network with those numbers ?

Last edited by Bertical; 01-24-2012 at 05:10 PM.
 
Old 01-24-2012, 08:06 PM   #5
dllobach
LQ Newbie
 
Registered: Jan 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
First, although i've come up with a word-around, I value your thoughts and would love further input in figuring this out.

Bertical, I'm not sure what "/21 network" is. As I've said, networking is a weak spot for me and even more so with Linux.

Soooooo, to make sure the problem wasn't with something I may have done while configuring the kernel, I did the following:

Copied the LFS 7.0 partition to a new partition (so I could preserve the build as it stood at the completion of the LFS 7.0 book.) Then I installed dhcp (dhcpcd-5.2.12) as per BLFS. Rebooted to the new partition (with dhcp) and things seem happy. Tried some pings against google and all was fine.

So, again begging your patience, I would love to figure out what I have messed up with the original LFS7 (without dhcp.)

Thanks,
DaleL
 
Old 01-25-2012, 03:20 AM   #6
Bertical
Member
 
Registered: Oct 2008
Location: Kingdom of Mercia
Distribution: Slackware
Posts: 83

Rep: Reputation: 13
The "PREFIX" command in /etc/sysconfig/ifconfig.eth0 is used to set the subnet mask. Your Ubuntu box is using 255.255.248.0 which is a /21 subnet mask ( first 21 bits are used for the network , the rest are used for the hosts ). On your LFS machine the subnet mask is set to /24.
 
Old 01-25-2012, 11:52 AM   #7
dllobach
LQ Newbie
 
Registered: Jan 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Bertical, thanks for the thought. I'm certainly not arguing with you, just going by the book which states that the IP address is four octets of 8 bytes (bits ?) each. So if the last octet is 0 then the first three are used and the prefix would be 24. I did try changing the prefix to 21 anyway but no go.

Thanks,
DaleL
 
Old 02-06-2012, 05:19 AM   #8
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
Quote:
Originally Posted by dllobach View Post
I gave your thought a quick try on my LFS running on virtualbox but still get "unknown host" when I ping.
Don't you need to create some sort of bridged connection when running in a virtual machine? At the bottom this page it talks about forwarding packets from the host.
 
Old 02-06-2012, 01:57 PM   #9
dllobach
LQ Newbie
 
Registered: Jan 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Andy, you may be right about virtualbox but I have also tried booting straight into LFS on its own partition and have tried every combination I can imagine. No luck. Bertical may also be onto something with the subnet mask but simply changing the PREFIX in my ifconfig didn't work. I've spent quite a few hours with google trying to learn more about the networking part and am still learning. I'm beginning to think that since it works fine with DHCP maybe it can't be done by putting addresses in myself. (LFS on virtualbox also works fine if I use DHCP.) I've been going through the scripts run by INIT but can't get the specific error from those scripts. I think that one day when I feel adventurous I'm going to have to but some debugging in the "ping" program and see exactly what is being returned when it fails. Thanks for your thoughts.
 
Old 02-09-2012, 10:11 AM   #10
Bertical
Member
 
Registered: Oct 2008
Location: Kingdom of Mercia
Distribution: Slackware
Posts: 83

Rep: Reputation: 13
Your network is 74.138.128.0 with a 255.255.248.0 subnet mask. This gives a range of host IP addresses from 74.138.128.1 to 74.138.135.254.

74.138.128.1 has been already allocated to your gateway ( according to the Ubuntu details )

74.138.135.255 is the broadcast address for your network and can't be used.

You need to assign an IP address from the range 74.138.128.2 to 74.138.135.254.

You need to change the PREFIX to 21 so your PC is in the correct subnet ( it can only see 74.138.128.0 - 74.138.128.255 at the moment )

You also need to uncomment the GATEWAY directive in eth0 config file so your PC can get to other networks via the gateway.


I think ....

Last edited by Bertical; 02-10-2012 at 07:02 PM. Reason: snip arp blx
 
Old 02-10-2012, 12:31 AM   #11
dllobach
LQ Newbie
 
Registered: Jan 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Bertical, thanks much for the info. While I don't have it fixed just yet, I am beginning to think LFS is working fine and I should perhaps learn more over in the networking forum.

Just one last question if I may: is it possible that connecting to my ISP through a modem (no router) mandates that I have dhcp of some kind running on my PC?

Meanwhile I did change the IP Address to the exact same one Ubuntu uses (note that I am booting directly into LFS, not virtualbox now.) I also changed the PREFIX to 21 and enabled the gateway. Now, at the end of init, I am getting a message that the default gateway is set up. Ping still gives me "unknown host" when pinging www.google.com but now tells me that the destination host is unreachable when I ping 8.8.8.8. From what I've found on google, I still have a "route" problem.

Since I would really like to learn just what is going on I think I'm going to dig out a live CD for another distribution (or perhaps the LFS liveCD) and watch the discovery process. I have Ubuntu and Mint but Ubuntu seems to use avahi and Mint is a derivative of Ubuntu so probably uses avahi also. I'd like to dig into the network part of INIT on liveCD to see just how it is acquiring addresses. A liveCD would surely have a dhcp type discovery process. Again, if my ignorance is showing and this all is a simple matter of DHCP being needed to connect to my ISP, don't be afraid to call me an idiot.

Thanks again for your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] "desktop 3d effects" setting option became uncheckable, how to fix it ? wubai Linux - Newbie 2 11-12-2012 07:13 PM
"Multicolumn" or "tiles", or even "list" icon view on desktop, in any DE? the dsc Linux - Desktop 3 02-20-2010 09:25 AM
What is the difference between "/etc/hosts.equiv" AND ".rhosts" ? kcarun Solaris / OpenSolaris 15 08-06-2009 11:46 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
"cp -p" fails with "cp: setting permissions for `/home/svbld/t': Invalid argument" mkhesin Red Hat 1 02-28-2007 12:57 AM

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

All times are GMT -5. The time now is 11:45 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration