[SOLVED] Help with network configuration in Chapter 7.2.2 of LFS 7.1
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.
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.
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.
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:
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.
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.
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.
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.
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.