Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Wireless LAN at startup] Custom command at startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
MaartenZz
n00b
n00b


Joined: 30 Sep 2004
Posts: 15

PostPosted: Sat Mar 19, 2005 5:33 pm    Post subject: [Wireless LAN at startup] Custom command at startup Reply with quote

Hello,

Is there a way to run a specific command at startup that is not in /etc/init.d?
I have this command:

(/usr/local/sbin/wlan-up)
Quote:
iwconfig wlan0 essid "Wireless" mode Ad-Hoc
ifconfig wlan0 192.168.2.1 broadcast 192.168.2.255 netmask 255.255.255.0


I want to run /usr/local/sbin/wlan-up automaticly at boot. This command has to be started before Shorewall starts up. (Else Shorewall will error, and the firewall will be down.)

Thank you for reading, and maybe with helping me out :wink:
Maarten.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Sat Mar 19, 2005 5:40 pm    Post subject: Reply with quote

baselayout-1.11.10-r2 has the features you need to configure an interface with the wireless options you need
Back to top
View user's profile Send private message
MaartenZz
n00b
n00b


Joined: 30 Sep 2004
Posts: 15

PostPosted: Sat Mar 19, 2005 5:43 pm    Post subject: Reply with quote

So this will replace my handmade script? 8)
Back to top
View user's profile Send private message
Xamindar
Veteran
Veteran


Joined: 03 Oct 2004
Posts: 1155
Location: California

PostPosted: Sat Mar 19, 2005 6:01 pm    Post subject: Reply with quote

Yes, your wireless interface can be brought up with configurations in the /etc/conf.d/net file.


If you want to run a custom command on startup just add it to /etc/conf.d/local.start

oh, but i think local.start stuff is run last on bootup.
Back to top
View user's profile Send private message
raluke
n00b
n00b


Joined: 11 Aug 2002
Posts: 56
Location: Maryland, USA

PostPosted: Sat Mar 19, 2005 6:06 pm    Post subject: Reply with quote

UberLord wrote:
baselayout-1.11.10-r2 has the features you need to configure an interface with the wireless options you need


But 1.11 is in testing. Is there no other way? I've been burned before by installing masked packages. Admittedly, I'm no expert...

Thanx,
-Robert
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Sat Mar 19, 2005 8:26 pm    Post subject: Reply with quote

raluke wrote:
UberLord wrote:
baselayout-1.11.10-r2 has the features you need to configure an interface with the wireless options you need


But 1.11 is in testing. Is there no other way? I've been burned before by installing masked packages. Admittedly, I'm no expert...


It's been in testing for some time now, and it fixes way more bugs than it creates.
http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup

Instructions on what else you need :)
Back to top
View user's profile Send private message
ronmon
Veteran
Veteran


Joined: 15 Apr 2002
Posts: 1043
Location: Key West, FL

PostPosted: Sun Mar 20, 2005 12:02 am    Post subject: Reply with quote

UberLord knows what he's talking about. I recently set up a new router box using the new baselayout. Now you can do the whole shebang in one file. Here's the conf.d/net from that box.
Code:

modules=( "iproute2" )
config_eth0=( "dhcp" )
dhcpcd_eth0="-N -t 30"
config_eth2=( "192.168.3.1/24 brd 192.168.3.255" )
fallback_eth0=( "192.168.0.2 netmask 255.255.255.0" )
fallback_route_eth0=( "default via 192.168.0.1" )

bridge_br0="eth1 wlan0"
config_eth1=( "null" )
config_wlan0=( "null" )
config_br0=( "192.168.2.1/24 brd 192.168.2.255" )

depend_br0() {
    need net.eth1 net.wlan0
}

modules_wlan0=( "iwconfig" )
essid_wlan0="clubhouse"
mode_wlan0="Master"
channel_wlan0="2"
iwpriv_wlan0="maccmd 1"
iwpriv_wlan0="addmac 00:00:00:00:00:00"
iwpriv_wlan0="addmac FF:FF:FF:FF:FF:FF"

Everything from bridging to wireless. It's pretty spiffy.
_________________
Ask Questions the Smart Way - by ESR
Back to top
View user's profile Send private message
MaartenZz
n00b
n00b


Joined: 30 Sep 2004
Posts: 15

PostPosted: Mon Mar 21, 2005 1:38 am    Post subject: Reply with quote

The baselayout update worked great for me! It took some etc-configgin' but it was wearth it :wink: Long live /etc/conf.d/wireless! Thank you all for helping me out.
Back to top
View user's profile Send private message
mOjO_420
n00b
n00b


Joined: 11 Jun 2003
Posts: 71
Location: Suburbs of Chicago, IL, USA

PostPosted: Sat Mar 26, 2005 7:56 pm    Post subject: Reply with quote

hey.. my question kind of relates to this subject so I'll ask it here.

I don't think this is a baselayout problem per se but...

when i plug both my wireless NIC (ath0) and my wired nic (eth0) in they both dhcp and both set a default gw with the same metric. Since it is actually the same LAN, I end up with two default gw's for different interfaces with the same metric.... this confuses the heck out of things because then all traffic beyond the LAN ceases. of course i have no real *need* to be on the same network twice (its a laptop, i'm not bridging) but I checked in windows (dual-boot) and windows is smart enough to always automatically give the wireless interface a higher metric... i want my gentoo install to be as smart as windows of course so i'm here asking this question.

now as some of you may know setting the metric via ifconfig is broke due to some bug or soemthing in ifconfig (at least thats what i read on the net and sure enough it doesnt work for me either). setting the metric via the route command however works very well and immediately fixes the problem.

i'd like to see this put in as an option in baselayout... soemthing like:
metric_ath0=20

i cant really code very well.. so i'm stuck begging for this. ;-)

and the other part of the problem is that i think its dhcpcd which is setting the default gw right? not really baslayout's job... but i didnt see an option to pass to dhcpcd which would always set the metric of a given interface to XX for all routes created.

well.. thats where my thought process is stuck... wanted to run it by you guys for a reccomendation on how to approach this...
_________________
http://thegeekclub.net
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Tue Mar 29, 2005 10:22 am    Post subject: Reply with quote

mOjO_420 wrote:

i'd like to see this put in as an option in baselayout... soemthing like:
metric_ath0=20


Hopefully we'll do this in baselayout-1.12.x :)
Back to top
View user's profile Send private message
mOjO_420
n00b
n00b


Joined: 11 Jun 2003
Posts: 71
Location: Suburbs of Chicago, IL, USA

PostPosted: Wed Mar 30, 2005 5:23 pm    Post subject: Reply with quote

cool... i've seen a couple of people post with similar issues in different areas of the forums.

on a side note, I think theres ton's of new wireless support being included into new KDE 3.4.0... anyone tried it yet?
would be nice to have a windows-like gui for displaying detected networks and just click and type password etc to connect to wireless networks... but to be usable to me it would have to get along nicely with the gentoo baselayout, wpa_supplicant, and ifplugd.
_________________
http://thegeekclub.net
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Wed Mar 30, 2005 11:24 pm    Post subject: Reply with quote

mOjO_420 wrote:
would be nice to have a windows-like gui for displaying detected networks and just click and type password etc to connect to wireless networks... but to be usable to me it would have to get along nicely with the gentoo baselayout, wpa_supplicant, and ifplugd.


Nice yes, but not essential

From time 2 time, I play with NetworkManager from RedHat but I cannot get it to work :/

The upside is, for simple net connection it's great. Ease of use + good GUI.
Downside is there's nothing for vlan, bridging, bonding + others which Gentoo baselayout 1.11.10 supports

Also, there's no easy way to configure that with a GUI compared to our configuration in /etc/conf.d/net
(note - that is the ease of configuring it, not understanding it)

Hopefully when baselayout-1.11.x goes stable, some bright spark can write a GUI config thats easy for users yet gives the power of network configuration that baselayout can provide....

Until then, it's pretty much Read Teh Docs and do it on the CLI
Back to top
View user's profile Send private message
mkrisch
n00b
n00b


Joined: 22 Nov 2004
Posts: 59

PostPosted: Thu Mar 31, 2005 7:48 am    Post subject: controlling automatic network start Reply with quote

i have a slightly similar scenario to mOjO_420. i also have both the wired and wireless interfaces set up, but they actually connect to differet interfaces.

in the simplest scenario, i'd just like to keep it that the wireless network doesn't come up unless the wired network is down. but despite having net.eth0 set to start in the default group, and net.eth1 not set, the wireless interface always starts up when i boot, and i need to manually shut it down (and sometimes restart eth0) in order to get the network running.


as an aside, it'd also be nice if there was a gnome applet that i could use to quickly /etc/init.d/net.eth? start/stop for different interfaces. anyone know of something like that?

--mk
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Thu Mar 31, 2005 10:17 am    Post subject: Reply with quote

Use ifplugd to manage your wired network devices.

ifplugd may also be able to manage your wireless too - but YMMV on that.
Back to top
View user's profile Send private message
mOjO_420
n00b
n00b


Joined: 11 Jun 2003
Posts: 71
Location: Suburbs of Chicago, IL, USA

PostPosted: Fri Apr 01, 2005 3:26 am    Post subject: Re: controlling automatic network start Reply with quote

mkrisch wrote:
i have a slightly similar scenario to mOjO_420. i also have both the wired and wireless interfaces set up, but they actually connect to differet interfaces.

in the simplest scenario, i'd just like to keep it that the wireless network doesn't come up unless the wired network is down. but despite having net.eth0 set to start in the default group, and net.eth1 not set, the wireless interface always starts up when i boot, and i need to manually shut it down (and sometimes restart eth0) in order to get the network running.

as an aside, it'd also be nice if there was a gnome applet that i could use to quickly /etc/init.d/net.eth? start/stop for different interfaces. anyone know of something like that?


yes.. ifplugd works great... just "emerge ifplugd" and edit /etc/conf.d/ifplugd once.
like Uberlord said it may not work that well for the wireless card, depends on your card, but i actually find that on my system (udev, hald, hotplug) that inserting the wireless card magically starts the wifi anyway without me running ifplugd even, and it sounds like yours is doing the same. you dont have to stop the wireless interface if you give it a lower metric... (hence the discussion). normally you would give the whole interface a lower metric with ifconfig but this is broken in ifconfig for reasons i dont remember... you can either switch to iproute2 or just use the regular "route" command.

when they are both plugged in, instead of shutting down try something like:
# route metric 5 eth1
(or whatever your wireless nic is instead of eth1)
not sure if that will work without the full "default gw x.x.x.x netmask y.y.y.y" stuff... and im too lazy to get my laptop and try right this minute.
_________________
http://thegeekclub.net
Back to top
View user's profile Send private message
BDickson
n00b
n00b


Joined: 19 Mar 2005
Posts: 55
Location: San Jose, CA

PostPosted: Wed Apr 06, 2005 4:45 am    Post subject: BDickson Reply with quote

UberLord wrote:
"baselayout-1.11.10-r2 has the features you need to configure an interface with the wireless options you need "


Does it include the ebuild for 0.3.8?

BD
_________________
Gentoo, for people with too much free time.


Last edited by BDickson on Thu Apr 07, 2005 4:23 am; edited 1 time in total
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Wed Apr 06, 2005 9:53 am    Post subject: Reply with quote

BDickson wrote:
UberLord wrote:
"baselayout-1.11.10-r2 has the features you need to configure an interface with the wireless options you need "

Does it include the ebuild for 0.3.8?


What is 0.3.8? If you're referring to wpa_supplicant, it's an a seperate ebuild called ..... wpa_supplicant ;)
Back to top
View user's profile Send private message
BDickson
n00b
n00b


Joined: 19 Mar 2005
Posts: 55
Location: San Jose, CA

PostPosted: Wed Apr 06, 2005 7:31 pm    Post subject: BDickson Reply with quote

UberLord:

Yes, I meant WPA_Supplicant, but I have no internet access except wifi, which isn't working.

When I try the 1.10.11 baselayout, I get no ebuild available. When I try just wpa_supplicant, i get no ebuild available.

I put

"Sys-apps/Baselayout ~86" in "/etc/portage/package.keyword", and still get no ebuilds available.

I've read all your recent posts, but no thing works.


BD
_________________
Gentoo, for people with too much free time.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Thu Apr 07, 2005 6:17 am    Post subject: Re: BDickson Reply with quote

BDickson wrote:

"Sys-apps/Baselayout ~86" in "/etc/portage/package.keyword", and still get no ebuilds available.


8O

It's case sensitive - all lower case! Also, it's x86, not 86
sys-apps/baselayout ~x86

Lastly, it's package.keywords, not package.keyword

I kinda get the impression that you're going to be posting a lot about wireless configuration .... :wink:
Back to top
View user's profile Send private message
BDickson
n00b
n00b


Joined: 19 Mar 2005
Posts: 55
Location: San Jose, CA

PostPosted: Thu Apr 07, 2005 8:04 am    Post subject: BDickson Reply with quote

The caps were from me typing on this screen while looking at the other PC. They are all lower case in the file, which I also mis-typed. There were 5 file names in package.keywords when I first opened it, and sys-apps/baselayout ~x86 is one of them.

As to lots of posts, i can't seem to emerge baselayout-1.11.10-r2, which I've seen you recommend, and I'm 2 weeks past the only time I was able to ping my router using ifconfig and iwconfig. DHCP doesn't work at all, and I am really hopeful that wpa_supplicant will simplify things, because I don't even know what I did wrong 2 weeks ago.

My 80211g works fine in Win98SE, but my DWL-G520 doesn't seem responsive in Gentoo. The only way it will accept an IP address is from ifconfig within /etc/conf.d/net, not from a prompt, but that's as far as I get. I can ping ath0, localhost, hostname but etc/resolv.conf and /etc/hosts must be messed up somewhere, but they look OK from posts I've viewed.

I've followed up on lots of suggestions, but I can't get 1.11.10 to emerge to try wpa_supplicant.

AND, I just booted up the box and my password doesn't work anymore!

Start over?

BD
_________________
Gentoo, for people with too much free time.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Thu Apr 07, 2005 8:51 am    Post subject: Re: BDickson Reply with quote

BDickson wrote:
As to lots of posts, i can't seem to emerge baselayout-1.11.10-r2, which I've seen you recommend


baselayout-1.11.10-r2 isn't in portage anymore - earliest 1.11.x is 1.11.10-r3
baselayout-1.11.10-r6 is what I recommend. Well, the latest 1.11.x release really ;)
Back to top
View user's profile Send private message
BDickson
n00b
n00b


Joined: 19 Mar 2005
Posts: 55
Location: San Jose, CA

PostPosted: Fri Apr 08, 2005 3:06 am    Post subject: BDickson Reply with quote

Thanks for the update.

Can you tell me how I can get 1.11.10-r6 onto this W2000 box so I can CD-R it to Gentoo?

My /etc/conf.d/net file was overwritten, so I'm ready to go from scratch.

BD
_________________
Gentoo, for people with too much free time.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6771
Location: Blighty

PostPosted: Fri Apr 08, 2005 8:43 am    Post subject: Reply with quote

You need to somehow get the file rc-scripts-1.6.10.tar.bz2 from a Gentoo mirror into the /usr/portage/distfiles directory

BTW, If you have a Windows partition you can configure Gentoo to read from FAT/FAT32/NTFS - so you don't need to CD-R it :)
Back to top
View user's profile Send private message
BDickson
n00b
n00b


Joined: 19 Mar 2005
Posts: 55
Location: San Jose, CA

PostPosted: Fri Apr 08, 2005 10:05 pm    Post subject: Reply with quote

UberLord Posted: 2005 12:43 am Fri Apr 08, Post subject:

You need to somehow get the file rc-scripts-1.6.10.tar.bz2 from a Gentoo mirror into the /usr/portage/distfiles directory

That was easy: It fit on a floppy. HOWEVER, if say "emerge baselayout", it starts on 1.10.4 (again).

When I try "emerge /etc/portage/distfiles/baselayout-1.11.10-r6" I get "there are no ebuilds available.

UberLord Posted: 2005 12:43 am Fri Apr 08, Post subject:

BTW, If you have a Windows partition you can configure Gentoo to read from FAT/FAT32/NTFS - so you don't need to CD-R it

I have Fat32 support in the kernel, but I'd have to reboot, download, reboot, etc, as networking isn't set up yet, nor is Samba

AHA! Just read the HOWTO Wireless Configuration and Startup:

Installation
>=sys-apps/baselayout-1.11.0 now has wireless support. We also need to install wireless-tools.

This version of baselayout relies on a few other packages being unmasked too - namely sysvinit, bash and sys-libs/readline.

Code:
mkdir -p /etc/portage
echo "sys-apps/baselayout ~x86" >> /etc/portage/package.keywords -Done
echo "sys-apps/sysvinit ~x86" >> /etc/portage/package.keywords -Done
echo "app-shells/bash ~x86" >> /etc/portage/package.keywords -Done
echo "sys-libs/readline ~x86" >> /etc/portage/package.keywords -Done

emerge -uav sys-apps/baselayout net-wireless/wireless-tools sys-libs/readline bash - Lists 17 files I need, ~117MB.

Guess I'll get started, eh? OK, that took a while. I now have 15 (some are _patch) of the files required, and versions of the 5 I couldn't find are in /usr/portage/sys-apps, etc.

All files are now in /usr/portage/disfiles, or sys-apps, etc. When I try "emerge --usepkg -uav sys-apps/baselayout net-wireless/wireless-tools sys-libs/readline bash", it wants another file, "patch.4.2.52.2". This appears to be a script, and I think it's associated with "db-4.2.52.tar.gz". I saved the file as .txt, then renoved the .txt before putting it in /distfiles. HOWEVER, the emerge doesn't recognize it, even with PKGDIR=/usr/portage/distfiles/"

'Normally', I just keep going, file by file, until the emerge completes, but now I'm stuck.

Thanks so far,

:?::?::?::?: BD
_________________
Gentoo, for people with too much free time.
Back to top
View user's profile Send private message
eagle_cz
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 214

PostPosted: Tue Jun 14, 2005 2:12 pm    Post subject: Reply with quote

ronmon wrote:
UberLord knows what he's talking about. I recently set up a new router box using the new baselayout. Now you can do the whole shebang in one file. Here's the conf.d/net from that box.
Code:

modules=( "iproute2" )
config_eth0=( "dhcp" )
dhcpcd_eth0="-N -t 30"
config_eth2=( "192.168.3.1/24 brd 192.168.3.255" )
fallback_eth0=( "192.168.0.2 netmask 255.255.255.0" )
fallback_route_eth0=( "default via 192.168.0.1" )

bridge_br0="eth1 wlan0"
config_eth1=( "null" )
config_wlan0=( "null" )
config_br0=( "192.168.2.1/24 brd 192.168.2.255" )

depend_br0() {
    need net.eth1 net.wlan0
}

modules_wlan0=( "iwconfig" )
essid_wlan0="clubhouse"
mode_wlan0="Master"
channel_wlan0="2"
iwpriv_wlan0="maccmd 1"
iwpriv_wlan0="addmac 00:00:00:00:00:00"
iwpriv_wlan0="addmac FF:FF:FF:FF:FF:FF"

Everything from bridging to wireless. It's pretty spiffy.


Did you make sure, that you access list is working ?
I made similar setup and HostAP didnt get locked

from /etc/conf.d/wireless

essid_wlan0="lalalala"
mode_wlan0="master"
channel_wlan0="13"

iwconfig_wlan0="retry 30 enc 2580-afeb"

iwpriv_wlan0="reset 1"
iwpriv_wlan0="reset 2"
iwpriv_wlan0="maccmd 3"
iwpriv_wlan0="maccmd 4"
iwpriv_wlan0="maccmd 1"
iwpriv_wlan0="addmac 00:60:B3:6B:6F:25" # Bird
iwpriv_wlan0="addmac 00:60:B3:6D:79:99" # aaa
#iwpriv_wlan0="addmac 00:60:B3:6E:10:E4" # bbb

maccmd are simply ignored.
Even if i put all iwpriv command on the one line, it work from bash, but doesnt work via script.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum