| View previous topic :: View next topic |
| Author |
Message |
UberLord Retired Dev


Joined: 18 Sep 2003 Posts: 6289 Location: Blighty
|
Posted: Sat Oct 17, 2009 5:08 pm Post subject: |
|
|
Yes, it's that simple.
Just add dhcpcd to the default runlevel to get it to start automatically  _________________ When baselayout tells you to update config files or things break WE REALLY DO MEAN IT
Please add SOLVED to the thread title if your issue has been
Strip comments from configs please |
|
| Back to top |
|
 |
JC99 l33t


Joined: 06 Aug 2003 Posts: 782 Location: Toronto
|
Posted: Sat Oct 17, 2009 5:45 pm Post subject: |
|
|
| AM088 wrote: | | ... it "just worked" |
Yeah, me too. I installed openrc-0.5-r1, ran etc-update, rebooted and everything "just worked"
...of course this makes me wonder whats going on. /etc/conf.d/network just contains examples of how to do things, it doesn't actually have anything in it that configures stuff and my /etc/init.d/net.ethx don't look like that script pappy_mcfae posted(On page 2 of this thread). I don't have dhcpcd-5 installed and I guess I don't need it cause I have a static IP? |
|
| Back to top |
|
 |
pappy_mcfae Watchman


Joined: 27 Dec 2007 Posts: 5806 Location: Pomona, California.
|
Posted: Sat Oct 17, 2009 6:05 pm Post subject: |
|
|
Actually, I noticed that if there isn't a script, or if openrc thinks there isn't a script, it will just set up for dhcp. I found that out because openrc has a bone against calling the script net.eth0. I had done an update to openrc -0.5.1-r1, and the net.eth0 script was renamed to something else, and the machine reset itself for old style networking.
Should I say it tried. When the machine couldn't find an acceptable script, it started a dhcp session instead. I've fixed the issue by calling the script eth0. Openrc doesn't seem to have a problem with that, at least on a reemerge of openrc -0.5.1-r1.
This is really fascinating stuff.
And yes, once everything is in place, it does just work. That's just too cool.
<edit>The above assumption is incorrect. The /etc/init.d/dhcpcd script has to be placed in /etc/runlevel/default in order for dhcp operation to occur. If there is no script like the one I show in a previous posting in this thread, or the dhcp script set in /etc/runlevels/default, there will be no network operation besides lo. I have verified this operation on two different machines.</edit>
Blessed be!
Pappy _________________ SITE LIST:
Main: http://www.kernel-seeds.org
Mirror: http://kernel-seeds.grytpype-thynne.org/
Mirror 2: http://kernel-seeds.gentoostudio.org/
Mirror 3: http://www.elilabs.com/~pappy/
Mirror 4: http://62.3.120.142/~seeds/
Last edited by pappy_mcfae on Mon Oct 19, 2009 8:43 pm; edited 1 time in total |
|
| Back to top |
|
 |
platojones Veteran


Joined: 23 Oct 2002 Posts: 1491 Location: Just over the horizon
|
Posted: Sat Oct 17, 2009 6:24 pm Post subject: |
|
|
| EvilEye wrote: | | AM088 wrote: | | ... it "just worked" |
Yeah, me too. I installed openrc-0.5-r1, ran etc-update, rebooted and everything "just worked"
...of course this makes me wonder whats going on. /etc/conf.d/network just contains examples of how to do things, it doesn't actually have anything in it that configures stuff and my /etc/init.d/net.ethx don't look like that script pappy_mcfae posted(On page 2 of this thread). I don't have dhcpcd-5 installed and I guess I don't need it cause I have a static IP? |
Well, I guess I'll let Roy answer this...I'll just say that I have a very simple network setup (static IP with one wired interface) using the old net.ethX script linked to net.lo. When I upgraded to the latest baselayout and openrc, ran etc-update and rebooted, everything worked exactly as before. So, I suspect the the /etc/conf.d/network config file only comes into play for more sophisticated network setups. |
|
| Back to top |
|
 |
UberLord Retired Dev


Joined: 18 Sep 2003 Posts: 6289 Location: Blighty
|
Posted: Sat Oct 17, 2009 6:30 pm Post subject: |
|
|
| platojones wrote: | | Well, I guess I'll let Roy answer this...I'll just say that I have a very simple network setup (static IP with one wired interface) using the old net.ethX script linked to net.lo. When I upgraded to the latest baselayout and openrc, ran etc-update and rebooted, everything worked exactly as before. So, I suspect the the /etc/conf.d/network config file only comes into play for more sophisticated network setups. |
I suspect that you have both the old and the new style installed. This means that you effectively continue to use the old style until you manually change to the new style. And no, it's for less sophisticated setups  _________________ When baselayout tells you to update config files or things break WE REALLY DO MEAN IT
Please add SOLVED to the thread title if your issue has been
Strip comments from configs please |
|
| Back to top |
|
 |
UberLord Retired Dev


Joined: 18 Sep 2003 Posts: 6289 Location: Blighty
|
Posted: Sat Oct 17, 2009 6:34 pm Post subject: |
|
|
| pappy_mcfae wrote: | Actually, I noticed that if there isn't a script, or if openrc thinks there isn't a script, it will just set up for dhcp. I found that out because openrc has a bone against calling the script net.eth0. I had done an update to openrc -0.5.1-r1, and the net.eth0 script was renamed to something else, and the machine reset itself for old style networking.
Should I say it tried. When the machine couldn't find an acceptable script, it started a dhcp session instead. I've fixed the issue by calling the script eth0. Openrc doesn't seem to have a problem with that, at least on a reemerge of openrc -0.5.1-r1.
|
You're mixing things.
OpenRC has no bone about calling something net.eth0 as that's a designated name for the old style scripts.
The new style init script network handles ALL interfaces statically at once, therefore giving it an interface name is wrong.
And yes, the old style scripts do default to DHCP if nothing configured. New style does not do this (no dhcp stuff!).
| Quote: | This is really fascinating stuff.
And yes, once everything is in place, it does just work. That's just too cool.
|
Glad you think so  _________________ When baselayout tells you to update config files or things break WE REALLY DO MEAN IT
Please add SOLVED to the thread title if your issue has been
Strip comments from configs please |
|
| Back to top |
|
 |
platojones Veteran


Joined: 23 Oct 2002 Posts: 1491 Location: Just over the horizon
|
Posted: Sat Oct 17, 2009 6:49 pm Post subject: |
|
|
| Quote: | I suspect that you have both the old and the new style installed. This means that you effectively continue to use the old style until you manually change to the new style. And no, it's for less sophisticated setups  |
Oh, ok...yep. So, if I want to easily move to the new config style, I just need to remove the /etc/init.d/net.ethX from the default runlevel and remove the symlink, then comment out the /etc/conf.d/net config file and put the ifconfig info in /etc/conf.d/networks? Should I put anything into the default runlevel for networking (I[/quote]'ve already got net.lo there)?
I like to completely convert to the new way of doing things when I do an upgrade like this. |
|
| Back to top |
|
 |
JC99 l33t


Joined: 06 Aug 2003 Posts: 782 Location: Toronto
|
Posted: Sat Oct 17, 2009 6:50 pm Post subject: |
|
|
| platojones wrote: | | I'll just say that I have a very simple network setup (static IP with one wired interface) using the old net.ethX script linked to net.lo. When I upgraded to the latest baselayout and openrc, ran etc-update and rebooted, everything worked exactly as before. |
For me eth0 has a static ip. eth1 is wired and connects to my network. I guess I have both the old way and new way of networking installed (openrc-0.5.1-r1 is installed) but am using the old way. I am not sure how to make the switch to the new way so I guess I will just wait until an official guide comes out on how to make the switch (My server does all the IP masquerading so if the internet in my house is down for too long my mom and brother start yelling at me to get it working.).
It is not as important that I get the other stuff I have installed working properly right away (A wireless card setup as a wireless access point and a bridge). |
|
| Back to top |
|
 |
Ant P. Veteran

Joined: 18 Apr 2009 Posts: 1919 Location: UK
|
Posted: Sat Oct 17, 2009 7:46 pm Post subject: |
|
|
| Do we need to do anything to get IPv6 working with the new stuff, or will it just work like before? |
|
| Back to top |
|
 |
Etal Veteran


Joined: 15 Jul 2005 Posts: 1633
|
Posted: Sat Oct 17, 2009 9:09 pm Post subject: |
|
|
| UberLord wrote: | Yes, it's that simple.
Just add dhcpcd to the default runlevel to get it to start automatically  |
Awesome!  |
|
| Back to top |
|
 |
d2_racing Moderator


Joined: 25 Apr 2005 Posts: 13034 Location: Ste-Foy,Canada
|
Posted: Sun Oct 18, 2009 1:37 am Post subject: |
|
|
I have a quick question : How can I configure my wireless card that use dhcp instead of a static IP ?
I only found that:
| Code: |
#!/sbin/runscript
#!/sbin/runscript
#copyright 2009 Funtoo Technologies, LLC
# All rights reserved. Released under the 2-clause BSD license.
IP=192.168.0.5
NM=255.255.255.0
GW=192.168.0.5
INT=wlan0
DOM=exemple.org
NS1=0.0.0.0
NS2=0.0.0.0
WPA=/etc/wpa_supplicant/wpa_supplicant.conf
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
nameserver $NS1
nameserver $NS2
EOF
wpa_supplicant -i$INT -c$WPA -Dwext -B
eend $?
}
stop() {
ebegin "Shutting down network interface $INT"
resolvconf -d $INT &&\
route del default gw $GW $INT &&\
ifconfig $INT down
rm /var/run/wpa_supplicant/$INT
eend $?
}
|
So do I have to create only a script file for wlan0 and only use this :
| Code: |
#!/sbin/runscript
INT=wlan0
GW=192.168.0.5
WPA=/etc/wpa_supplicant/wpa_supplicant.conf
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
wpa_supplicant -i$INT -c$WPA -Dwext -B
eend $?
}
stop() {
ebegin "Shutting down network interface $INT"
resolvconf -d $INT &&\
route del default gw $GW $INT &&\
ifconfig $INT down
rm /var/run/wpa_supplicant/$INT
eend $?
}
|
_________________ Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec |
|
| Back to top |
|
 |
d2_racing Moderator


Joined: 25 Apr 2005 Posts: 13034 Location: Ste-Foy,Canada
|
Posted: Sun Oct 18, 2009 11:43 pm Post subject: |
|
|
Ok I see sera
1.
| Code: |
# cd /tmp
# tar xvjpf /usr/portage/distfiles/openrc-0.5.1.tar.bz2
# cd openrc-0.5.1/init.d.misc
# make
# install wpa_supplicant /etc/init.d
|
2.
| Code: |
# nano /etc/conf.d/wpa_supplicant
wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf"
wpa_supplicant_if="wlan0"
|
So, if I want to start manually my wireless card, I only run this :
| Code: |
# /etc/init.d/wpa_supplicant start
|
Basically, all the scripts are use when you use Ip static or a wireless device. For the rest, if you are using a lan card with dhcp, then you don't even have to bother to create some scripts.
Am I right ? _________________ Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 1:07 am Post subject: |
|
|
I'm not sure, can you configure that in /etc/dhcpcd.conf instead of a script? | Code: | | allowinterfaces wlan0 |
|
|
| Back to top |
|
 |
pappy_mcfae Watchman


Joined: 27 Dec 2007 Posts: 5806 Location: Pomona, California.
|
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 5:26 am Post subject: |
|
|
I don't use any script. Nothing in runlevels.
There is only net.lo which belongs to openrc.
My static IP is configured in /etc/dhcpcd.conf (see man dhcpcd.conf)
That's it.  |
|
| Back to top |
|
 |
pappy_mcfae Watchman


Joined: 27 Dec 2007 Posts: 5806 Location: Pomona, California.
|
Posted: Mon Oct 19, 2009 7:58 am Post subject: |
|
|
Mike Hunt,
If you're using the old networking setup, that is very true. However, with the new scripted networking setup with openec-0.5 and above, you would at least have to have /etc/runlevels/boot/network and /etc/runlevels/default/dhcpcd to get the new setup to work for dhcpcd.
d2_racing,
It looks like you use the entire wpa_supplicant script, AND, you'd also have to follow that with either the dhcpcd script (for dhcp), or use a script similar to what I have above with with INT=wlan0 instead of INT=eth0.
Blessed be!
Pappy _________________ SITE LIST:
Main: http://www.kernel-seeds.org
Mirror: http://kernel-seeds.grytpype-thynne.org/
Mirror 2: http://kernel-seeds.gentoostudio.org/
Mirror 3: http://www.elilabs.com/~pappy/
Mirror 4: http://62.3.120.142/~seeds/ |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Mon Oct 19, 2009 8:40 am Post subject: |
|
|
| d2_racing wrote: | Basically, all the scripts are use when you use Ip static or a wireless device. For the rest, if you are using a lan card with dhcp, then you don't even have to bother to create some scripts.
Am I right ? |
You can even set static ip's with dhcpcd this days. Alternatively you can set it in /etc/conf.d/network or create an own script for it. Having it in a separate script means you do not have to start it together with the lo interface as you want it for the wlan to be the case.
I'd say the network and wpa_supplicant script are enough for 95% of the people.
I'd would be possible to set up the wlan in network but far more complicated then adding the wpa_supplicant script.
I guess the simplest approach is to use network to bring the ethernet interfaces up.
Use the wpa_supplicant script for wireless.
Use dhcpcd to configure static and dynamic ip's.
ps: yes, /etc/init.d/wpa_supplicant start instead of adding it to a runlevel works. |
|
| Back to top |
|
 |
d2_racing Moderator


Joined: 25 Apr 2005 Posts: 13034 Location: Ste-Foy,Canada
|
Posted: Mon Oct 19, 2009 12:05 pm Post subject: |
|
|
Ok now I know how to manage a Wifi connexion using a dhcp, now if I want to manage my eth0 interface like in the old days, do I need to setup a script ?
Because, if I use dhcpcd without any config for my e1000 lan card, how do I manage it to actually stop it when I want to start my wireless connexion ?
If someone can tell me that, I think that I will be able to complete the Wiki with Pappy  _________________ Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Mon Oct 19, 2009 1:11 pm Post subject: |
|
|
| d2_racing wrote: | | Because, if I use dhcpcd without any config for my e1000 lan card, how do I manage it to actually stop it when I want to start my wireless connexion ? |
What to you mean by stopping? Bringing the interface down? If so this hardly matters for power consumption (unlike wifi) so why would you want that anyway?
| d2_racing wrote: | | now if I want to manage my eth0 interface like in the old days, do I need to setup a script |
What have you done beside brining the interface up at startup and bringing it down at shutdown?
The only thing which might be useful and is so far unmentioned is enabling the rf-switch for wifi. As I don't have use for it myself here an untested approach to do so:
Add the following to /etc/udev/rules.d/90-network.rules: | Code: |
KERNEL=="wlan0", ACTION=="add", RUN+="/etc/init.d/wpa_supplicant start"
KERNEL=="wlan0", ACTION=="remove", RUN+="/etc/init.d/wpa_supplicant stop"
|
Remove wpa_supplicant from any runlevel. |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 1:17 pm Post subject: |
|
|
| pappy_mcfae wrote: | | ... with the new scripted networking setup with openec-0.5 and above, you would at least have to have /etc/runlevels/boot/network and /etc/runlevels/default/dhcpcd to get the new setup to work for dhcpcd. |
Yes, my mistake. I did indeed add dhcpcd to the default runlevel.
But there is no network in the boot runlevel
| Code: | # eselect rc show boot
Status of init scripts in runlevel "boot"
alsasound [started]
bootmisc [started]
fsck [started]
hostname [started]
hwclock [started]
keymaps [started]
localmount [started]
lvm [started]
modules [started]
mtab [started]
procfs [started]
root [started]
swap [started]
sysctl [started]
termencoding [started]
udev-postmount [started]
urandom [started]
|
This is with openrc-0.5.0-r2 btw. |
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Mon Oct 19, 2009 1:37 pm Post subject: |
|
|
Mike Hunt,
what returns for you? |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 1:57 pm Post subject: |
|
|
sera,
| Code: | # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 202 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default mymodem 0.0.0.0 UG 202 0 0 eth0 |
|
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Mon Oct 19, 2009 2:15 pm Post subject: |
|
|
| Do you have network in the default runlevel or another for that matter? |
|
| Back to top |
|
 |
Mike Hunt Watchman


Joined: 19 Jul 2009 Posts: 5287
|
Posted: Mon Oct 19, 2009 2:26 pm Post subject: |
|
|
No, not likely | Code: | # stat /etc/init.d/network
stat: cannot stat `/etc/init.d/network': No such file or directory |
|
|
| Back to top |
|
 |
sera Developer

Joined: 29 Feb 2008 Posts: 961 Location: CEST
|
Posted: Mon Oct 19, 2009 2:42 pm Post subject: |
|
|
| Mike Hunt wrote: | No, not likely | Code: | # stat /etc/init.d/network
stat: cannot stat `/etc/init.d/network': No such file or directory |
|
Are you actually on gentoo? What brings your loopback interface up. Have you some leftovers of the old net stuff around which might be called?
Edit: I've overred | Quote: | | There is only net.lo which belongs to openrc. |
This is the old networking. Probably there is a symlink to it named net.eth0 and udev starts the interface for you as in the old days. |
|
| Back to top |
|
 |
|