LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-02-2013, 04:43 AM   #1
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Rep: Reputation: 24
LFS 7.3 Chapter 7.2.2 Creating Network Interface Configuration Files


Hello LFSers!

I'm currently on chapter 7, and have got to create the network interface configuration files.

The question is, how can I get the variables needed to create the ifconfig files?

I'm using a virtualbox running Debian.

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

Code:
 net device e1000
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:1f:76:9b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
This means I have just one network device, right?

Now, as I was confused on the IP address and such I went to the host system and typed ifconfic and got the following output.

Code:
eth2      Link encap:Ethernet  HWaddr 08:00:27:b9:55:5a  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feb9:555a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5722 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3404 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5485072 (5.2 MiB)  TX bytes:194280 (189.7 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)
But when I type ipconfig in the Windows host system I get the following :

Code:
Windows IP Configuration

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : xxxxxx.xxxxx.com
        IP Address. . . . . . . . . . . . : 10.17.58.11
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.17.58.1

Ethernet adapter VirtualBox Host-Only Network:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 192.168.56.1
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :
So now I wrote the following for my ifconfig.eth1 file and am confused on the values to put. Have I done ok for the ones I've filled?

Code:
cd /etc/sysconfig/
cat > ifconfig.eth1 << "EOF"
ONBOOT=yes
IFACE=eth1
SERVICE=
IP=10.17.58.11
GATEWAY=10.17.58.1
PREFIX=
BROADCAST=
EOF

Last edited by DeeGee; 05-02-2013 at 04:50 AM.
 
Old 05-02-2013, 06:44 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
I doubt that your ifconfig.eth1 file is correct.

If I understand correctly you run a virtual machine from windows. This VM is running Debian and it is being used to build LFS.

The Windows IP Configuration isn't of any concern, virtualbox will give the host (Debian/LFS) unique network settings which are unrelated to the windows network configuration (not entirely true, but lets keep this as simple as possible).

Looking at the ifconfig command (the one executed from Debian) I see that your VM has set 10.0.2.X to be used as IP range and 10.0.2.15 is your hosts ip.

You mention that your host has 1 network interface. What I find strange is that I see 2 HW addresses and mention of eth2 and eth1. This might be due to the following: When copying/cloning VM's the assigned HW address changes, which in turn changes the eth designation (eth0 -> eth1 -> eth2 -> ...).

Did you clone/copy the VM running Debian while working on LFS?

Can you post the following information after a reboot (post all the generated output):
From windows:
- ipconfig

From Debian (as root):
- dmesg | egrep -i "eth|e1000"
- cat /etc/network/interfaces
- ifconfig
- cat /etc/udev/rules.d/70-persistent-net.rules
- cat $LFS/etc/udev/rules.d/70-persistent-net.rules

Edit: just noticed something interesting: Both you and AN28 use the exact same blog to note down your experiences (ChillPil) ..... One and the same person?

Last edited by druuna; 05-02-2013 at 07:02 AM.
 
Old 05-02-2013, 09:32 AM   #3
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by druuna View Post

Did you clone/copy the VM running Debian while working on LFS?
Yes, clone happened twice. Also the clones were run on several machines.

I'll post the details later as I'm not on my host machine at the moment.

However, have to make a small clarification.

Quote:
Originally Posted by druuna View Post
Edit: just noticed something interesting: Both you and AN28 use the exact same blog to note down your experiences (ChillPil) ..... One and the same person?
No, we are not the same person. I do not see the point of having two separate usernames. We are team-members of the same project, building our LFS systems separately.
 
Old 05-02-2013, 10:02 PM   #4
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by druuna View Post
From windows:
- ipconfig

From Debian (as root):
- dmesg | egrep -i "eth|e1000"
- cat /etc/network/interfaces
- ifconfig
- cat /etc/udev/rules.d/70-persistent-net.rules
- cat $LFS/etc/udev/rules.d/70-persistent-net.rules


Code:
H:\>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : xxxx.xxxx.com
        IP Address. . . . . . . . . . . . : 10.17.58.11
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.17.58.1

Ethernet adapter VirtualBox Host-Only Network:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 192.168.56.1
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :

H:\>
 
Old 05-02-2013, 10:58 PM   #5
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Here's the output when on the host system Debian:
Code:
root@Dee:/home# dmesg | egrep -i "eth|e1000"
[    4.594924] e1000 0000:00:03.0: PCI INT A -> Link[LNKC] -> GSI 10 (level, low) -> IRQ 10
[    4.595015] e1000 0000:00:03.0: setting latency timer to 64
[    5.225523] e1000: 0000:00:03.0: e1000_probe: (PCI:33MHz:32-bit) 08:00:27:b9:55:5a
[    5.430131] e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
[   40.105243] udev[227]: renamed network interface eth0 to eth2
[   59.554047] e1000: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[   69.867623] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   70.464170] eth2: no IPv6 routers present
[15920.708517] e1000: eth2 NIC Link is Down
[15925.568914] e1000: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
root@Dee:/home# dmesg | egrep -i "eth|e1000"
[    4.594924] e1000 0000:00:03.0: PCI INT A -> Link[LNKC] -> GSI 10 (level, low) -> IRQ 10
[    4.595015] e1000 0000:00:03.0: setting latency timer to 64
[    5.225523] e1000: 0000:00:03.0: e1000_probe: (PCI:33MHz:32-bit) 08:00:27:b9:55:5a
[    5.430131] e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
[   40.105243] udev[227]: renamed network interface eth0 to eth2
[   59.554047] e1000: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[   69.867623] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   70.464170] eth2: no IPv6 routers present
[15920.708517] e1000: eth2 NIC Link is Down
[15925.568914] e1000: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
root@Dee:/home# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
root@Dee:/home# ifconfig
eth2      Link encap:Ethernet  HWaddr 08:00:27:b9:55:5a  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feb9:555a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:32898 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22249 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:28972009 (27.6 MiB)  TX bytes:1896318 (1.8 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

root@Dee:/home# cat /etc/udev/rules.d/70-persistent-net.rules
# 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.

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:c3:73:39", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:1f:76:9b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:b9:55:5a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
root@Dee:/home# cat $LFS/etc/udev/rules.d/70-persistent-net.rules
# 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 e1000
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:1f:76:9b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
 
Old 05-03-2013, 02:13 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Looking at the LFS 70-persistent-net.rules that was created the network interface is on eth1 with hardware address 08:00:27:1f:76:9b and looking at the Debian output I see that the interface is on eth2 with hardware address 08:00:27:b9:55:5a (HW address 08:00:27:1f:76:9b is mentioned on Debian, but is on eth1 and not used).

Did you make a clone after the LFS 70-persistent-net.rules was created?

You could try the following (the LFS side of things):

- Add the following to the $LFS/etc/udev/rules.d/70-persistent-net.rules:
Code:
# net device e1000
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:b9:55:5a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
I do believe that the current rule assigning eth1 can be removed, but wait with that until all is working.

- Create the ifconfig file assosiated with the above rule:
Code:
cd /etc/sysconfig/
cat > ifconfig.eth0 << "EOF"
ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static
IP=10.0.2.15
GATEWAY=A.B.C.D
PREFIX=24
BROADCAST=10.0.2.255
EOF
I can't determine from the given info which gateway needs to be used (bold blue part). Try the following (on Debian):
Code:
route -n | egrep "Gateway|UG"
Use the IP mentioned under the Gateway header.

I'm not familiar with virtualbox and how you have set up networking. If the gateway setting doesn't work you could try either of these 2 IP's:
- 10.17.58.1
- 10.0.2.1

I hope you do know by now that every time you clone your VM the HW Address changes and as a result you need to change configuration settings to make things work again.
 
1 members found this post helpful.
Old 05-03-2013, 06:06 AM   #7
AN28
Member
 
Registered: Apr 2013
Posts: 93

Rep: Reputation: 0
Just a small doubt guys, what is the best way to find what the primary/secondary nameserver is ??

we need to specify it when creating the /etc/resolv.conf file

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

I tried the following commands but they weren't too helpful:

Code:
root@Dee:/# cat /etc/resolv.con
cat: /etc/resolv.con: No such file or directory
Code:
root@Dee:/# dig -t ns xxxxx.xxxx.com
dig: parse of /etc/resolv.conf failed

Last edited by AN28; 05-03-2013 at 06:25 AM.
 
Old 05-03-2013, 06:43 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
@AN28: First of all: Please start your own thread next time! You're not the OP and this isn't related to the original problem.

About the nameservers: Check which DNS your ISP (or network administrator) told you to use (as stated in the LFS book).

BTW: It is /etc/resolv.conf and not /etc/resolv.con
 
1 members found this post helpful.
Old 05-03-2013, 12:13 PM   #9
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
There are also a number of free nameservers out there ( googles is 8.8.8.8 for instance ) just google it.
 
1 members found this post helpful.
Old 05-05-2013, 10:32 PM   #10
AN28
Member
 
Registered: Apr 2013
Posts: 93

Rep: Reputation: 0
Thank you for the information found the nameservers

@Drunna sorry about that but it is with reference to the successive section after which was being discussed here.
That is why I posted the comment on this thread. Anyway next time I shall use a new one
 
Old 05-05-2013, 11:57 PM   #11
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by druuna View Post

I hope you do know by now that every time you clone your VM the HW Address changes and as a result you need to change configuration settings to make things work again.
My heartiest thanks druuna, this was really helpful and solved my issue.

Just a small question to gain knowledge regarding the ifconfig file name. The original .rules file is for eth1 while the Debian output gives eth2. The modified file uses eth0. So are we trying to make the configuration the same as the host computer upone which the VM is running?

Is there a way to check if all is correct before running the completed LFS system?

Again, thank you so much for the great help.
 
Old 05-06-2013, 01:38 AM   #12
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 374

Rep: Reputation: 85
If you only have one networkcard, the original name of it is eth0.
Then was created a persistant network rule so that the mac-adress of that device always has the name eth0.
When you clone your vm (or move the harddrive to another computer) the mac-adress for the networkcard is changed, and then udev creates a new rule for it, and gives it the name eth1.

In some distros this happen automatic, but in other you need to manually change the udev rule, if you move the system to new hardware.
 
1 members found this post helpful.
Old 07-01-2013, 11:52 PM   #13
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by Lennie View Post
Then was created a persistant network rule so that the mac-adress of that device always has the name eth0.
When you clone your vm (or move the harddrive to another computer) the mac-adress for the networkcard is changed, and then udev creates a new rule for it, and gives it the name eth1.

In some distros this happen automatic, but in other you need to manually change the udev rule, if you move the system to new hardware.
Again, a very much related question.

I had successfully cloned the LFS build on virtualbox in the same computer.

I recently tried copying my LFS virtualbox file to a virtualbox on another computer. I've changed the IP addresses etc. as well as the MAC address in the 70-persistent-rules file. But still I cannot connect to the Internet.

A small nudge on how to manually change the udev rule is very much appreciated.

Thank you
 
Old 07-02-2013, 02:54 AM   #14
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by DeeGee View Post
I recently tried copying my LFS virtualbox file to a virtualbox on another computer.
Do I have to assume that that worked and you are able to boot into (B)LFS without any errors?

Quote:
I've changed the IP addresses etc. as well as the MAC address in the 70-persistent-rules file.
Changed it to what? Did you follow the "procedure" I posted in posts #2 and #6?

Quote:
But still I cannot connect to the Internet.

A small nudge on how to manually change the udev rule is very much appreciated.
We need details to tackle this. In addition to posts #2 and #6; Are there any log messages (not necessarily limited to networking) that stand out?
 
Old 07-02-2013, 11:31 PM   #15
DeeGee
Member
 
Registered: Apr 2013
Distribution: Debian, Linux From Scratch, Mint
Posts: 118

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by druuna View Post
Do I have to assume that that worked and you are able to boot into (B)LFS without any errors?
Everything works fine other than the fact that the system prints out the following message at startup.

Code:
Bringing up the eth0 interface... Cannot find device eth0 [FAIL]
Quote:
Originally Posted by druuna View Post
Changed it to what? Did you follow the "procedure" I posted in posts #2 and #6?
Yes, I changed /etc/sysconfig/ifconfig.eth0 and /etc/udev/rules.d/70-persistent-net.rules. For the 70-persistent-net.rules, I changed the ATTR{address} parameter as well to the MAC address of the NIC card of the new VM(This was taken from the VM settings)

What other information would be required?

Thank you very much
 
  


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
[SOLVED] Help with network configuration in Chapter 7.2.2 of LFS 7.1 engineer Linux From Scratch 9 01-21-2013 08:11 PM
LFS chapter-by-chapter complete commands with notes DrinkinHomeBrew Linux From Scratch 6 03-16-2012 01:57 AM
LFS 6.4 network interface config for proxy support Ron_Beltran Linux From Scratch 0 09-22-2009 04:48 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
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 12:41 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
Open Source Consulting | Domain Registration