LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Network Configuration Noob, Having trouble with ch. 7.5 (https://www.linuxquestions.org/questions/linux-from-scratch-13/network-configuration-noob-having-trouble-with-ch-7-5-a-4175665356/)

dopaseraoxy 12-03-2019 03:26 PM

Network Configuration Noob, Having trouble with ch. 7.5
 
I finally finished Chapter 6 of the LFS book :party:

Now I'm into Chapter 7. And I need to set up network configuration.

I'm being told to do this:

Code:

cd /etc/sysconfig/
cat > ifconfig.eth0 << "EOF"
ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static
IP=192.168.1.2
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=192.168.1.255
EOF

As well as everything else in Ch. 7.5. I'm completely lost, this is all jargon to me.

I ran bash /lib/udev/init-net-rules.sh on the previous page along with cat /etc/udev/rules.d/70-persistent-net.rules

To which the output was:

Code:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# net device r8169
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:c4:97:5f:f7:35", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="enp2s0f1"

So I understand that the name of my device is enp2s0f1. I know there are easier ways to find it but I hadn't clicked to 7.5 yet. But that's fine.

Anyways, I'm not sure what to input for ANY of the other options here, and I'm feeling a bit overwhelmed. What do I put in for SERVICE? Or GATEWAY or IP? Or BROADCAST?

If I scroll down I see this:

Code:

cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf

domain <Your Domain Name>
nameserver <IP address of your primary nameserver>
nameserver <IP address of your secondary nameserver>

# End /etc/resolv.conf
EOF

And it's making me even more confused. I'm so lost. Someone please help.

TheRealGrogan 12-03-2019 04:41 PM

That would depend on how you connect to the network. With a router/gateway? You'd need to know what IP address range it assigns (e.g. 192.168.0.x or 192.168.1.x or whatever it is) and if configuring statically, you would need to choose an IP address that's outside of its DHCP scope for automatically assigning addresses, and choose an address that's not already in use by another device. LIKELY addresses below .50 would be fine, but you'd have to check your router's configuration.

So, if configuring statically, the SERVICE variable would indeed be ipv4-static

If we assume the router uses 192.168.1.x as in the example

ONBOOT=yes
IFACE=eth0 <--- change that to enp2s0f1 if that's what you want to use.
SERVICE=ipv4-static
IP=192.168.1.2 <--- change that if not appropriate
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=192.168.1.255

If you want your interface to be eth0 (or eth1 or whatever is appropriate if there is more than one adapter in the machine), change your udev rule accordingly, for example:

Code:

# net device r8169
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:c4:97:5f:f7:35", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*" NAME="eth0"

If you want to use DHCP, you'd have to jump ahead and compile the dhcpcd program and configure it. (you likely only want the client package, dhcpcd not "DHCP")

http://www.linuxfromscratch.org/blfs...et/dhcpcd.html

Then you'd change the SERVICE to dhcpcd as in the example.

P.S. If configuring statically, most routers will allow you to use the router's IP address as a nameserver. Otherwise, use your ISP's nameservers, or OpenDNS's or something. If configuring dynamically, DHCP would take care of that.

spiky0011 12-03-2019 04:42 PM

hi

The ifconfig.eth0 file only you can set this for Your network as they are set differently.

In
"ip, gateway, broadcast"
you need the ip address of your router, ( obtain from host) ie 192.168.X.X where X might be differenet to the book i,e 192.168.0.X "0" will be subnet the last X for ip will be the ip address for your machine.

Gatway will be the same subnet as ip "0"(you can get that from router "noramlly 1")
Broadcast again subnet the same 0 but will end 255.

Using ifconfig on host will help with most of addresses. service is stating you are using a static ip addresss

/etc/resolv.conf
nameserver I use 8.8.8.8 which is google and 8.8.4.4 as well google again.
nameserver=8.8.8.8
nameserver=8.8.4.4

they are for dns address lookup

Sorry if not explained to well but will help.

dopaseraoxy 12-03-2019 05:02 PM

I'm trying my best to understand all the new terms being thrown at me. Networking is NOT a field I'm experienced in AT ALL. I've never touched it until today.

What I've understood so far is (and correct me if I'm wrong):

- IP is my router IP address, not anything to do with my computer network card
- Gateway is the router IP address but with a 1 instead of a 0
- Broadcast is router IP address but with 255 instead of 0
- I have IFACE right but I can change it to eth0 (for ease I assume?)

Everything else kind of came out as jargon to me (sorry TheRealGrogan). I seem to just have more networking questions now. What does it mean for it to be static? What's DHCP? What does it mean for it to be dynamic?

I never use a wired network, is that what all this is for, configuring wired network? Or network in general? If it's for wired is there a way for me to setup wireless instead? I'm running this on a laptop (all I have), so it'd be more efficient. What exactly IS a nameserver?

Sorry for the plethora of questions, like I said this is my first time encountering networking and I want to make sure I understand it properly before continuing with anything. Understanding comes before getting this thing booted in my opinion.

dopaseraoxy 12-03-2019 05:06 PM

Update: I ran ifconfig on my host system and got this output:

Code:

enp2s0f1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether d8:c4:97:5f:f7:35  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 89206  bytes 9141613 (9.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 89206  bytes 9141613 (9.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.17  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fd00:fc:8d08:8652:5c3f:cc4b:e0df:f2fa  prefixlen 64  scopeid 0x0<global>
        inet6 2607:fea8:28c0:5a6:5c3f:cc4b:e0df:f2fa  prefixlen 64  scopeid 0x0<global>
        inet6 2607:fea8:28c0:5a6::6  prefixlen 128  scopeid 0x0<global>
        inet6 2607:fea8:28c0:5a6:6c70:b994:c5c3:e2dc  prefixlen 64  scopeid 0x0<global>
        inet6 fd00:fc:8d08:8652:ff06:dd69:a88c:5fb5  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::5341:8556:736c:acbd  prefixlen 64  scopeid 0x20<link>
        ether 70:c9:4e:ce:4c:97  txqueuelen 1000  (Ethernet)
        RX packets 2298615  bytes 2642190534 (2.6 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 955270  bytes 380033075 (380.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0 seems to have broadcast, inet and netmask. I think, from what I read earlier this is my wireless network? I found I don't actually have an ethernet port on my laptop so would I have to set up wireless? How do I do that?

TheRealGrogan 12-03-2019 05:09 PM

IP address is not your router's IP address, but the IP address you want to assign to your network card.

GATEWAY is your router's IP address.

Static means a fixed IP address, not automatically (dynamically) assigned by the router.

Sorry, I don't know what else to tell you. You should probably read up on basic networking concepts.

You might want to skip networking until later, until you have WiFi drivers and related machinery. Once you get X and a graphical environment built (Desktop Environment) you can use Network Manager.

dopaseraoxy 12-03-2019 05:12 PM

So I can just skip this part for now and use Network Manager when I have a desktop environment set up?

TheRealGrogan 12-03-2019 05:34 PM

If you don't want to plug in with ethernet temporarily, yes.


All times are GMT -5. The time now is 07:47 AM.