LinuxQuestions.org
Review your favorite Linux distribution.
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 01-06-2013, 08:09 PM   #1
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Rep: Reputation: 2
Help with network configuration in Chapter 7.2.2 of LFS 7.1


In chapter 7.2.2, the book requires us to create the network interface config files resolv.conf and ifconfig.

In these files, there are several parameters that are required that I'm not sure of how to find the correct information. Namely: gateway, IP (can I make this arbitrary 192.168.1.X based upon the other devices in my network?), Prefix, broadcast, and the DNS server IP I should use.

Can anyone point me in the right direction as to where I can find this information?

I am using a wireless connection (now called wlan0) on my laptop.
 
Old 01-07-2013, 12:29 AM   #2
k84834
Member
 
Registered: Aug 2012
Posts: 142

Rep: Reputation: Disabled
Quote:
can I make this arbitrary 192.168.1.X based upon the other devices in my network?
yes, when I was building my lfs, I use these info from my host machine. after your lfs will be booted, you can use from DHCP which is addressed in the BLFS book. you can set an static IP that is in your network IP range. other variables could be obtained from IP and GATEWAY.
in the resove.conf file, I think below info is enough:
nameserver 127.0.0.1
nameserver YOUR-GATEWAY_VALUE
 
Old 01-07-2013, 11:20 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
If in doubt set nameserver to 8.8.8.8 which is the free google dns server and is usually quite fast and reliable ( more so than bloody awful BT )

gateway is usually the ip of your router.

Last edited by Keith Hedger; 01-07-2013 at 11:21 AM.
 
Old 01-07-2013, 10:46 PM   #4
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by engineer

Namely: gateway, IP (can I make this arbitrary 192.168.1.X based upon the other devices in my network?), Prefix, broadcast, and the DNS server IP I should use.
Hello everybody,

As already mentioned, try using the IP of your router as the gateway IP. You can change your router's IP if you think you need to. I have a Linksys router and a Motorola DSL modem that use the same default network IP address (192.168.1.XXX). When the modem is in PPPoE mode and the router is in DHCP mode, I have to change the router's network address to 192.168.2.XXX for that arrangement to work. None of this matters if the DSL modem is in bridged mode and the router is configured to handle the DSL connection. Anyway, that is an example of a reason to change the router's address and the ifconfig file stuff, too.

The prefix thing is another way of expressing the subnet mask which establishes the parts of an IP address that identify the network and which part is reserved to identify the hosts on the network. A common subnet mask (the default, really) is 255.255.255.0 which can be thought about in binary digits like this 11111111.11111111.11111111.00000000. Those twenty-four one bits act (via a logical AND comparison to IP addresses) to sort of reserve the first three octets of the IP for the network and are where the "24" comes from for the prefix number for that example. Subnet mask. Prefix. Same thing expressed differently, IMO. Anyway, that leaves the eight bits of the last IP address octet to identify hosts on the network (256 possible hosts minus some reserved for the router itself and broadcast purposes). You can use the setup utility of your router to see its subnet mask and the IP address used by the router. You can convert the router's subnet mask to a prefix for your ifconfig, but I imagine it will be the one in the example above.

My understanding of the broadcast IP is that it usually is the network octets plus 255 (but in some cases, 000) for the fourth octet (e.g., 192.168.1.255). A broadcast packet sent by the router (for various reasons) to the broadcast IP address will be accepted and processed by all hosts on the subnet.

But as already mentioned, another system (such as your LFS host system) is a good place to look for these and many other config file settings.

The DNS nameserver IP can be your router as already mentioned. That probably will work okay by the router getting DNS nameservers provided by your ISP. You also can specify those ISP nameserver IPs directly in your resolv.conf. Or, use Google's as mentioned. Many people use OpenDNS's nameservers. I like to use my ISP's DNS nameserver addresses in the resolv.conf.

Anyway, this is how I view the world.

Last edited by stoat; 01-08-2013 at 11:25 AM.
 
Old 01-08-2013, 05:48 PM   #5
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Ok, per the responses above, I've used my previous config files (from the base system) to give me hints to create the new config files. I wound up using my default nameserver from my service provider (it was in the resolv.conf file on the base system), and added google's as a backup. I took the IP for my router as the default gateway. I used the last IP address in the range for the broadcast-192.168.1.255.

Final question: for the SERVICE flag, the instructions say to set this to static. I'm assuming that I have a dynamic IP provided by my ISP (how can I find out?), so after looking around, it looks like this can be set to 'dhcp'. Is this OK?

Thank you, and especially thanks to stoat for such a detailed post. rep'd.
 
Old 01-08-2013, 06:17 PM   #6
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
The book specifies static IP addressing because no DHCP client has been installed yet. That's in the BLFS book. And then, it's about the private subnet IP address your network interface acquires from your router, not the one your modem acquires from your ISP. Try the ipv4-static thing as the SERVICE, and specify an IP in the range set in your router config for users. It probably has a starting IP address and a maximum number allowed. Anyway, that's what I do here at home. But my connection is wired and stays at home. You have a laptop and may end up needing a DHCP client someday to connect at Starbucks. And maybe wpa_supplicant to negotiate encrypted connections (also a BLFS topic).

P.S.: If you're wanting to use a wireless connection right now, there are other things you will need that are not in the LFS book such as wireless-tools, a wireless driver maybe, and kernel config stuff. There are LFS hints about wireless and WPA. They're a little old, but probably still provide the gist of it all.

Last edited by stoat; 01-08-2013 at 09:03 PM.
 
Old 01-08-2013, 08:47 PM   #7
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
OK, I changed the ifconfig.wlan0 file back to 'ipv4-static', so it now looks like this:

Code:
root:/sources/linux-3.2.6# cat /etc/sysconfig/ifconfig.wlan0
ONBOOT=yes
IFACE=wlan0
SERVICE=ipv4-static
IP=192.168.1.10
GATEWAY=192.168.0.1
PREFIX=24
BROADCAST=192.168.1.255
I'll wait until I boot into the system and check the connection before I mark the thread SOLVED .

Last edited by engineer; 01-08-2013 at 08:48 PM. Reason: fix code tags
 
Old 01-09-2013, 02:18 AM   #8
k84834
Member
 
Registered: Aug 2012
Posts: 142

Rep: Reputation: Disabled
Quote:
Originally Posted by engineer View Post
OK, I changed the ifconfig.wlan0 file back to 'ipv4-static', so it now looks like this:

Code:
root:/sources/linux-3.2.6# cat /etc/sysconfig/ifconfig.wlan0
ONBOOT=yes
IFACE=wlan0
SERVICE=ipv4-static
IP=192.168.1.10
GATEWAY=192.168.0.1
PREFIX=24
BROADCAST=192.168.1.255
I think your GATEWAY may be 192.168.1.254 when your IP is 192.168.1.10 and your BROADCAST is 192.168.1.255 and your PREFIX is 24.

Last edited by k84834; 01-09-2013 at 02:20 AM.
 
Old 01-09-2013, 05:34 PM   #9
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
I haven't needed a wireless connection with my BLFS systems yet, but I was planning to work my way through that in the near future anyway. So today I experimented with setting it up with a static IP and WPA encryption. It went pretty much okay. FWIW (maybe nothing), here is what happened... Installed wpa_supplicant and libnl (already have openssl and the others). Recompiled the kernel with all the usual wireless stuff and the built-in zd1211rw driver module needed by this ZyXel USB adapter I had lying around. Copied the firmware for the zd1211rw driver to /lib/firmware/zd1211. Created /etc/wpa_supplicant.conf using wpa_passphrase with the router's SSID and WPA password. Created /etc/sysconfig/ifconfig.wlan0 as already discussed here. Tweaked /etc/udev/rules.d/70-persistent-net.rules for wlan0. Fiddled with /etc/sysconfig/ifconfig.eth0 to stop eth0 from going up at boot time. Unplugged the wired NIC cable to prevent being tricked by eth0 (just in case). Rebooted, brought the interface up, and established a connection with the usual terminal commands (no connection manager for this experiment). It's all in the book and the hints and the things already mentioned above.

P.S.: I let the network init script bring up the wlan0 interface during booting (ONBOOT=yes). The init screen was normal, happy, and pretty during booting. And I put the wpa_supplicant command in $HOME/.bash_profile to establish the router connection sort of automatically. For a permanently attached wireless device, that scheme makes the whole thing come up and work in the background just like the ethernet connection does. For a hot-plugged wireless device, some other arrangement will be needed. I'm not interested though.

Last edited by stoat; 01-11-2013 at 01:26 PM.
 
Old 01-21-2013, 08:11 PM   #10
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Update to mark the thread as SOLVED:

Code:
root:/sources/linux-3.2.6# cat /etc/sysconfig/ifconfig.eth0
ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static
IP=192.168.1.10
GATEWAY=192.168.0.1
PREFIX=24
BROADCAST=192.168.1.255
I had to change the IP address to 192.168.0.10 to make sure it is in the subnet I have given here. I haven't got the wlan0 working, but eth0 is now working.
 
  


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
LFS chapter-by-chapter complete commands with notes DrinkinHomeBrew Linux From Scratch 6 03-16-2012 01:57 AM
DHCP, Network configuration on LFS chawarma Linux From Scratch 1 02-18-2009 06:19 AM
LFS 6.3, messed up somewhere prior to chapter 6.12 (gcc), how to restart chapter 6? Funkster Linux From Scratch 2 12-24-2008 06:30 AM
How to download LFS Packages without network configuration 6920 Linux From Scratch 1 05-07-2007 04:15 PM
LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work bauld Linux From Scratch 11 03-15-2006 12:31 AM

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

All times are GMT -5. The time now is 03:10 PM.

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