Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

The new OpenRC networking script

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
145 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next
Author
Message
sera
Retired Dev
Retired Dev
Posts: 1017
Joined: Fri Feb 29, 2008 3:03 pm
Location: CET

  • Quote

Post by sera » Tue Oct 20, 2009 12:43 pm

d2_racing wrote:Right now, I'm using OpenRc 0.5.2 without any net.lo,net.eth0 and you were right, dhcpcd is acting like ifplugd.
That's another nice aspect of the new networking, ifplugd became obsolete.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Tue Oct 20, 2009 1:01 pm

In fact, I only need to test the wpa_supplicant script and I think that we will be go to go on writing a nice Wiki here :P
Top
pappy_mcfae
Watchman
Watchman
User avatar
Posts: 5999
Joined: Thu Dec 27, 2007 10:51 pm
Location: Pomona, California.
Contact:
Contact pappy_mcfae
Website

  • Quote

Post by pappy_mcfae » Tue Oct 20, 2009 7:28 pm

sera wrote:
d2_racing wrote:If we refer to the Funtoo doc, then we should use the script.
As we learned in this thread Funtoo is not the same as Gentoo. Thy have a specialized loopback init script called net.lo, not to be confused with our net.lo.
How did we learn this? Having two out of four machines running on funtoo stage3 tarballs, I can say this is false. If you are going to use openrc-0.5.0 or greater, then there is no distinction between Funtoo and Gentoo.

The new networking setup isn't as picky as the old. It will run with net.lo, or it will run with network. One can't tell the actual difference once the network is up and running.
Network on Gentoo is also to bring up the loopback interface but has a little more functionality on top. You can set routes, static IPs, create bridges and other things.
So unlike Gentoo, Funtoo really needs a separate script if not using dhcpcd.
No. Once again, you see a distinction where none exists. I defy anyone to look at my machines and tell me which ones were born of Gentoo tarballs, and which ones were born of Funtoo tarballs. It can't be done!

There are a number of scripts available that allow for all of the above, and then some. I provided the tarball with these scripts. And while these changes may have begun with Funtoo, with proper use of the scripts, your Gentoo install can become a Funtoo install, at least networking wise.

I heartily suggest you do some research on your own. Experiment, don't just buy into the assumptions of others.

Blessed be!
Pappy
This space left intentionally blank, except for these ASCII symbols.
Top
sera
Retired Dev
Retired Dev
Posts: 1017
Joined: Fri Feb 29, 2008 3:03 pm
Location: CET

  • Quote

Post by sera » Tue Oct 20, 2009 7:54 pm

Mike Hunt is using Funtoo, he doesn't have a script "network" and the content of his net.lo is completely different. I believe Mike here. Not just because he would have had to fake some of the output he presented in this thread.

With a lot of fuss I can also make a debian out of my gentoo that's not an argument.

Using the Gentoo net.lo defeats the purpose of this changes.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Tue Oct 20, 2009 9:24 pm

In fact, he has this file /etc/init.d/net.lo and on my Gentoo box, I don't have any and it's working since I can write on this forum :P
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Tue Oct 20, 2009 9:26 pm

He needs that file because of sshd and other network services.
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Tue Oct 20, 2009 10:19 pm

The internet (eth0) still works without any scripts except /etc/dhcpcd.conf.
net.lo sets up the lo interface that is needed by the networked services:

Code: Select all

# mv /etc/init.d/net.lo /root
`/etc/init.d/net.lo' -> `/root/net.lo'

# rc
* Caching service dependencies...
Service `cherokee' needs non existant service `net'
Service `fetchmail' needs non existant service `net'
Service `git-daemon' needs non existant service `net'
Service `netmount' needs non existant service `net'
Service `ntp-client' needs non existant service `net'
Service `ntpd' needs non existant service `net'
Service `openvpn' needs non existant service `net'
Service `pydoc-2.6' needs non existant service `net'
Service `samba' needs non existant service `net'
Service `saslauthd' needs non existant service `net'
Service `slapd' needs non existant service `net'
Service `slpd' needs non existant service `net'
Service `spawn-fcgi' needs non existant service `net'
Service `squid' needs non existant service `net'
Service `sshd' needs non existant service `net'
Service `svnserve' needs non existant service `net'
So without the net.lo script all those services will fail to start at boot.

Just for the record, here it is again:

Code: Select all

# cat /etc/init.d/net.lo
#!/sbin/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.

depend() {
        provide net
}

start() {
        ebegin "Bringing up network interface lo"
        ifconfig lo 127.0.0.1 netmask 255.0.0.0 up && \
        route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
        eend $?
}

stop() {
        ebegin "Shutting down network interface lo"
        route del -net 127.0.0.0 netmask 255.0.0.0 dev lo &&
        ifconfig lo down
        eend $?
}
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Oct 21, 2009 12:21 am

Are you running on Gentoo or on Funtoo ?
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Oct 21, 2009 12:36 am

The French version of the Wiki is here : http://gentoo-quebec.org/wiki/index.php ... 5.x_Gentoo
Top
pappy_mcfae
Watchman
Watchman
User avatar
Posts: 5999
Joined: Thu Dec 27, 2007 10:51 pm
Location: Pomona, California.
Contact:
Contact pappy_mcfae
Website

  • Quote

Post by pappy_mcfae » Wed Oct 21, 2009 4:08 am

Written by yours truly!

BB!
P
This space left intentionally blank, except for these ASCII symbols.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Oct 21, 2009 11:48 am

In fact, I wrote that one with Pappy and with the examples and all the stuff from this thread actually.

So, it's the first French doc at least for now.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Oct 21, 2009 4:06 pm

About the static script :

Code: Select all

#!/sbin/runscript 
# Copyright 2009 Funtoo Technologies, LLC 
# All rights reserved. Released under the 2-clause BSD license. 

IP=192.168.0.130 
NM=255.255.255.0 
GW=192.168.0.1 
INT=eth0 
DOM=no.org 
NS1=65.68.49.50 
NS2=65.68.49.51 
NS3=192.168.0.1 

depend() { 
        provide net 
        after net.lo 
} 

start() { 
        ebegin "Bringing up network interface $INT" 
        ifconfig $INT $IP netmask $NM up && \ 
        route add default gw $GW $INT && \ 
        resolvconf -a $INT << EOF 
domain $DOM 
nameserver $NS1 
nameserver $NS2 
nameserver $NS3 

EOF 
        eend $? 
} 

stop() { 
        ebegin "Shutting down network interface $INT" 
        resolvconf -d $INT && \ 
        route del default gw $GW $INT && \ 
        ifconfig $INT down 
        eend $? 
} 
I think that "after net.lo" should be replace by "after network" since net.lo doesn't exist anymore on Gentoo ?

Can someone test that actually on Gentoo, I think that the script use net.lo since Funtoo use it.
Top
jfp
Guru
Guru
Posts: 326
Joined: Sun Jul 08, 2007 9:10 pm
Location: Virginia, USA

  • Quote

Post by jfp » Wed Oct 21, 2009 4:32 pm

I don't understand the comment
think that "after net.lo" should be replace by "after network" since net.lo doesn't exist anymore on Gentoo ?

Code: Select all

zippy ~ # equery belongs net.lo
[ Searching for file(s) net.lo in *... ]
sys-apps/openrc-0.5.2-r1 (/usr/share/openrc/net.lo -> /etc/init.d/net.lo)
sys-apps/openrc-0.5.2-r1 (/etc/init.d/net.lo)
It would seem that it "belongs" in Gentoo if you are using openRC. This item was one of the things I didn't quite understand in the wiki. (Thanks very much for that by the way)
jfp
Top
sera
Retired Dev
Retired Dev
Posts: 1017
Joined: Fri Feb 29, 2008 3:03 pm
Location: CET

  • Quote

Post by sera » Wed Oct 21, 2009 4:51 pm

d2_racing wrote: I think that "after net.lo" should be replace by "after network" since net.lo doesn't exist anymore on Gentoo ?
Nicely spotted. Yes, this should be changed.
Top
sera
Retired Dev
Retired Dev
Posts: 1017
Joined: Fri Feb 29, 2008 3:03 pm
Location: CET

  • Quote

Post by sera » Wed Oct 21, 2009 4:55 pm

jfp wrote:It would seem that it "belongs" in Gentoo if you are using openRC. This item was one of the things I didn't quite understand in the wiki. (Thanks very much for that by the way)
You still have the net.lo script in Gentoo but it won't be used with the new networking.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Oct 21, 2009 5:24 pm

Good, so Pappy will edit his post then :P
Top
Kaste
Guru
Guru
User avatar
Posts: 546
Joined: Wed Dec 21, 2005 7:37 am
Location: /home Sweet /home

  • Quote

Post by Kaste » Wed Oct 21, 2009 6:41 pm

Hi guys

I tried following all the clues in here but I'm somewhat confused. I have a laptop i try to run under openrc. I need to check first if i get a dhcp server on eth0 (one network) then ping some gateways to figure out which of the static networks I'm on (2 others) and then if that doesn't work start wlan (a few others).

Is this possible at all with openrc without too much fuss and if so how would i go about it?

Greets.
I'm a membar of Mesnar and me scull contains wakky secrets!
Top
pappy_mcfae
Watchman
Watchman
User avatar
Posts: 5999
Joined: Thu Dec 27, 2007 10:51 pm
Location: Pomona, California.
Contact:
Contact pappy_mcfae
Website

  • Quote

Post by pappy_mcfae » Wed Oct 21, 2009 7:00 pm

There really isn't a need. Even if net.lo doesn't exist, the script will start and run properly. While it might be considered more correct to change the script, the fact that I have networking on my openrc machines means that there isn't an issue leaving things as is.

If someone else wishes to change the script and see if things still work, that's fine. For me, I've done enough research with the new networking setup that I am confident it works, even after the oldnet USE flag was removed, and after a few updates to openrc, and a few dozen reboots.

Blessed be!
Pappy
This space left intentionally blank, except for these ASCII symbols.
Top
pappy_mcfae
Watchman
Watchman
User avatar
Posts: 5999
Joined: Thu Dec 27, 2007 10:51 pm
Location: Pomona, California.
Contact:
Contact pappy_mcfae
Website

  • Quote

Post by pappy_mcfae » Wed Oct 21, 2009 7:32 pm

Kaste wrote:Hi guys

I tried following all the clues in here but I'm somewhat confused. I have a laptop i try to run under openrc. I need to check first if i get a dhcp server on eth0 (one network) then ping some gateways to figure out which of the static networks I'm on (2 others) and then if that doesn't work start wlan (a few others).

Is this possible at all with openrc without too much fuss and if so how would i go about it?

Greets.
Probably not. I made up a "simple" script to automatically set this machine for wired or wireless networking depending on whether or not the NIC cable is installed. That script took me a about a week to get right. It will not work with baselayout-2/openrc.

If you already have a setup that works, and does these things, hold on to it for a bit. I have been considering seeing if I can update my script to the new networking. I have to be absolutely sure the new networking works...reliably, before I jump on that horse.

BB!
P
This space left intentionally blank, except for these ASCII symbols.
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Oct 21, 2009 9:04 pm

d2_racing wrote:
Mike Hunt wrote: In my case I use a static IP, so it is configured in /etc/dhcpcd.conf,

Code: Select all

interface eth0
static ip_address=192.168.2.10
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
[/quote]

So, what is the best method to do static IP then ? Using the script or using the dhcpcd.conf ?[/quote]

Whatever works best for you :)
My preference is for dhcpcd.conf because it allows much more easily and dhcpcd-5 replaces a lot of the functionality provided by the old scripts.
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
Kaste
Guru
Guru
User avatar
Posts: 546
Joined: Wed Dec 21, 2005 7:37 am
Location: /home Sweet /home

  • Quote

Post by Kaste » Wed Oct 21, 2009 9:06 pm

I have a bunch of scripts that i call depending on where i am at the moment and what connection i prefer in that place but they aren't automated in any way yet in a sense of detecting itself which one should be called.

So i need to invest the energy anyway, i am just trying to figure out if i can integrate that stuff into openrc which i use anyway.

Do you think this is a major hack or not?
I'm a membar of Mesnar and me scull contains wakky secrets!
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Oct 21, 2009 9:10 pm

Kaste wrote:I have a bunch of scripts that i call depending on where i am at the moment and what connection i prefer in that place but they aren't automated in any way yet in a sense of detecting itself which one should be called.

So i need to invest the energy anyway, i am just trying to figure out if i can integrate that stuff into openrc which i use anyway.

Do you think this is a major hack or not?
Yes, it's a major hack and I think the only viable reason for it would be to save cycles on devices where power efficiency is king and very desperate.
I normally keep all services running on my laptop (like sshd) and it picks up new interfaces and addresses just fine.

Obviously, this is not so good for servers (like apache) but they tend to have static IPs anyway.
Even then, you could write a hook in /etc/dhcpcd.exit-hook to start/stop services depending on overall network state. See dhcpcd-run-hooks(8) for details.
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
Kaste
Guru
Guru
User avatar
Posts: 546
Joined: Wed Dec 21, 2005 7:37 am
Location: /home Sweet /home

  • Quote

Post by Kaste » Thu Oct 22, 2009 9:35 am

Well my particular problem is one of the networks where there is a dhcp and it will shell out an adress just fine but that one won't allow me to connect to the internet. I need to set a static Ip in that case and the only way i can think of to detect if i am in that network is pinging the gateway. Is it possible to do this with the dhcpcd hooks?
I'm a membar of Mesnar and me scull contains wakky secrets!
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Thu Oct 22, 2009 11:25 am

Kaste wrote:Well my particular problem is one of the networks where there is a dhcp and it will shell out an adress just fine but that one won't allow me to connect to the internet. I need to set a static Ip in that case and the only way i can think of to detect if i am in that network is pinging the gateway. Is it possible to do this with the dhcpcd hooks?
No need for that! dhcpcd-5 handles arping profiles also. See this example

Code: Select all

interface eth0
arping 192.168.1.1

profile 192.168.1.1
static ip_address=192.168.1.4/24
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
bestia
n00b
n00b
Posts: 6
Joined: Mon Nov 16, 2009 6:29 pm

  • Quote

Post by bestia » Mon Nov 16, 2009 8:41 pm

Hi, everyone! It's my first post, so I just wanted to say that I'm impressed by such a great Gentoo community!
Here's my problem. After upgrade to baselayout-2 and openrc even though I have no net.* in my runlevels my wireless comes up with information:

Code: Select all

BESTIA bin # /etc/init.d/net.eth1 start
net.eth1          |* Bringing up interface eth1
net.eth1          |*   Starting wpa_supplicant on eth1...                                                                                           [ ok ]
net.eth1          |*   Starting wpa_cli on eth1...                                                                                                  [ ok ]
net.eth1          |*   Backgrounding ......
net.eth1          |* WARNING: net.eth1 has started, but is inactive
Everything works, but wpa_supplicant gui is showing info "could not get status from wpa_supplicant".
After reading a thread about OpenRC and the "new net" way I decided to switch to it and start up my wireless with the wpa_supplicant script.
What happens is that wpa_supplicant starts up but there's no network (using the same wpa_supplicant.conf as with "old net" way).

My /etc/conf.d/wpa_supplicant:

Code: Select all

 BESTIA bin # cat /etc/conf.d/wpa_supplicant
wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf"
wpa_supplicant_if="eth1"
And runlevels :

Code: Select all

BESTIA ~ # rc-update -s                                                                                                                       
               procfs |                                           boot                                                                        
              keymaps |                                           boot                                                                        
              hwclock |                                           boot                                                                        
                 dbus | default                                                                                                               
                local | default                 nonetwork                                                                                     
           consolekit | default
         termencoding |                                           boot
              urandom |                                           boot
          consolefont |                                           boot
                 fsck |                                           boot
           localmount |                                           boot
                  xdm | default
               dhcpcd | default
             netmount | default
             hostname |                                           boot
                 hald | default
              network |                                           boot
            savecache |                shutdown
                 root |                                           boot
               sysctl |                                           boot
             mount-ro |                shutdown
                devfs |                                   sysinit
                 mtab |                                           boot
              modules |                                           boot
            killprocs |                shutdown
                 swap |                                           boot
                dmesg |                                   sysinit
             bootmisc |                                           boot
       wpa_supplicant | default
                 udev |                                   sysinit
I don't really know where to start from, and I'm bit new to Gentoo as well so please, be emphatic ;]
Cheers, Bestia
Top
Post Reply

145 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic