LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS Version 9.1, Chapter 7.5.1 Creating Network Interface Configuration Files (https://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-version-9-1-chapter-7-5-1-creating-network-interface-configuration-files-4175677887/)

Shah404 06-30-2020 06:52 AM

LFS Version 9.1, Chapter 7.5.1 Creating Network Interface Configuration Files
 
Hello Users!

I'm currently on chapter 7.5.1, and i am confused how to edit the ifconfig.eth0 file.

I am a beginner in linux.
When i use the command
Code:

cat /etc/udev/rules.d/70-persistent-net.rules
I get the output
Code:

# net device r8169
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="f8:a9:63:8e:e2:7a", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="enp8s0"

so i renamed the file ifconfig.eth0 to ifconfig.enp8s0.
also i edited the IFACE to enp8s0.
but i dont know what to do about IP and GATEWAY.

on using ifconfig on host. This is what i get
Code:

enp8s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f8:a9:63:8e:e2:7a  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 119791  bytes 162086004 (162.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 119791  bytes 162086004 (162.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp10s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.9  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::258a:248a:3db6:425b  prefixlen 64  scopeid 0x20<link>
        ether 90:48:9a:29:f4:b5  txqueuelen 1000  (Ethernet)
        RX packets 5176059  bytes 4804866566 (4.8 GB)
        RX errors 0  dropped 645732  overruns 0  frame 0
        TX packets 2727830  bytes 515851935 (515.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

it shows the ip of wlp10s0f0 but nothing of enp8s0.

i am getting the gateway from this command
Code:

route -n | egrep "Gateway|UG"
as i saw someone had the same problem as me in this forum.

i am building lfs on my usb.
Sorry if i my question confuses you, i am a beginner.
Please help!!

tinfoil3d 06-30-2020 10:12 AM

I think this has nothing to do with LFS, you just configure the ethernet as you need, what's the issue? If eth and wifi are on the same router with the same subnet then I'm not sure which interface would be used by the system, but it's something you'd want to avoid with some tools or scripts.
In this particular case you need to either use dhclient or dhcpcd or whatever you want to get your dynamic DHCP-issued configuration for ethernet OR configure it manually with ifconfig or ip, whichever you prefer.

Shah404 06-30-2020 10:26 AM

Sir, Can you please explain it to me clearly, i cant understand what you are saying. I am not using ethernet, i am using wifi.
if i configure it with the ip of wlp10s0f0 and make the file named ifconfig.wlp10s0f0 , but the book said to keep the value of name obtained by the persistent rule(i.e., enp8s0 ).
Will it work then? and also how do i check if its working? or should i continue building lfs first?
Thank You.

tinfoil3d 06-30-2020 10:37 AM

Wait, ifconfig output and your udev file clearly show ethernet device. If you're not planning on using that, just ignore it then?
What's your question again? What are you trying to achieve? I thought you're trying to set up both wifi and ether at the same time.

Shah404 06-30-2020 10:43 AM

i just want network connectivity in my lfs, and i dont know what to enter in the ifconfig.xyz file.
As book stated that
Quote:

Which interfaces are brought up and down by the network script usually depends on the files in /etc/sysconfig/. This directory should contain a file for each interface to be configured, such as ifconfig.xyz, where “xyz” should describe the network card.
so i created ifconfig.eth0 as stated by the book.
But inside the file( ifconfig.eth0 ), what ip is it asking for?
and which network card?

tinfoil3d 06-30-2020 10:56 AM

Clearly your interface name isn't eth0, and again, if you're not intending to use it, why create it? It says "for each interface to be configured", if you don't want to "configure"(that is, use) it then why create it in the first place?
IMO LFS is for advanced users. It takes some extensive knowledge to successfully operate it and as I see it, it's intended for people who don't want their systems do something they've not been told to. Personally never used that "LFS book", just built a couple of bare systems in the past. Exactly for this very purpose. Sometimes you want to tweak things in a quick and single-use way, this is where these bare systems or basic tools like ip come in handy. Clearly it's not for a daily use for most people.

spiky0011 06-30-2020 11:22 AM

Hi

1st thing do you want to use eth0 cable?
2nd, ip addr of router

then post output of
Code:

ip link
then post your ifconfig.? file

all from LFS.

Shah404 06-30-2020 11:39 AM

Hello Sir,
I want to use enp8s0
Router IP: 192.168.0.1
Code:

(lfs chroot) root:/# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp8s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether f8:a9:63:8e:e2:7a brd ff:ff:ff:ff:ff:ff
3: wlp10s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 90:48:9a:29:f4:b5 brd ff:ff:ff:ff:ff:ff

Code:

(lfs chroot) root:/# ifconfig
enp8s0    Link encap:Ethernet  HWaddr F8:A9:63:8E:E2:7A
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0  TX bytes:0

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Bcast:0.0.0.0  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:142284 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142284 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:164623685  TX bytes:164623685

wlp10s0f0 Link encap:Ethernet  HWaddr 90:48:9A:29:F4:B5
          inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5390125 errors:0 dropped:707387 overruns:0 frame:0
          TX packets:2850268 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4925801776  TX bytes:542532455

Thank You!

spiky0011 06-30-2020 12:19 PM

ok have you created the /etc/sysconfig/ifconfig.enp8s0 file?
If so post it, if not ok we will create 1

Shah404 06-30-2020 12:28 PM

Yes Sir, i have created it.
Code:

(lfs chroot) root:/etc/sysconfig# cat ifconfig.enp8s0
ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static
IP=192.168.0.1
GATEWAY=192.168.0.1
PREFIX=24
BROADCAST=192.168.0.255

and i am not sure about the values

spiky0011 06-30-2020 12:33 PM

change ip to 192.168.0.9
change IFACE=eth0 IFACE=enp8s0

Then go on and create /etc/resolv.conf

nameserver 192.168.0.1
nameserver 8.8.8.8

Shah404 06-30-2020 12:53 PM

Sir done,
And what about gateway?
while chroot,
the command
Code:

route -n | egrep "Gateway|UG"
shows
Quote:

route command not found
After running command in host machine,
Code:

$ route -n | egrep "Gateway|UG"
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.1.1    0.0.0.0        UG    600    0        0 wlp10s0f0

i should use 192.168.1.1, right?

spiky0011 06-30-2020 01:03 PM

whats the ip addr on host?

you gave router ip
Quote:

Router IP: 192.168.0.1

Shah404 06-30-2020 01:09 PM

on the host machine, it is
Quote:

~$ ifconfig
enp8s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether f8:a9:63:8e:e2:7a 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 135658 bytes 163846108 (163.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 135658 bytes 163846108 (163.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlp10s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.9 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::258a:248a:3db6:425b prefixlen 64 scopeid 0x20<link>
ether 90:48:9a:29:f4:b5 txqueuelen 1000 (Ethernet)
RX packets 5345707 bytes 4909530861 (4.9 GB)
RX errors 0 dropped 690769 overruns 0 frame 0
TX packets 2825698 bytes 537094822 (537.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
192.168.1.9

but i access the router admin page through 192.168.0.1

which is inturn connected to modem which i access through 192.168.1.1

spiky0011 06-30-2020 01:21 PM

so change all to 192.168.1.?
ip=192.168.1.10
GATEWAY=192.168.1.1
PREFIX=24

In chroot you are using host network device.
You would need to boot lfs to use that 1


All times are GMT -5. The time now is 01:38 AM.