Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Wireless configuration and startup - The Gentoo way
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3 ... 45, 46, 47 ... 57, 58, 59  Next  
This topic is locked: you cannot edit posts or make replies.    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Tyger
n00b
n00b


Joined: 25 Jul 2004
Posts: 30
Location: Germany

PostPosted: Tue Jul 27, 2004 8:54 am    Post subject: Reply with quote

stingray wrote:

[...]
my setup is an ethernet adapter at eth0 and a wireless adapter at eth1. everytime i run
[...]
looks for me like the default gateway doesn't get set. the eth1-script works without problems (sets gateway). i figured out that only the last gateway="ethX/...."-line in /etc/conf.d/net is used.

the important part in the /etc/conf.d/net looks like this:

# For setting the default gateway
#
gateway="eth0/192.168.6.1"
gateway="eth1/192.168.7.1"

[...]


You can have only one default gateway _per system_ (Actually, with /sbin/route you can set as many default gw as you like, but they are non functional). The default gateway does something like: "if no other routing rule matches, use this device"

Type 'ip route' or 'route' to show your routing table (ip is part of iproute2). It should show something like

Code:

192.168.6.0/24 dev eth0  proto kernel  scope link  src 192.168.6.20
192.168.7.0/24 dev eth1  proto kernel  scope link  src 192.168.7.21
127.0.0.0/8 via 127.0.0.1 dev lo  scope link
default via 192.168.7.1 dev eth1


The first two lines are brought up automagically by my kernel/ifconfig tool and state rules to route all packets to address 192.168.6.x via dev eth0 and all packets to 192.168.7.x via dev eth1. Packets to 127.x.x.x are routed to localhost. Any packet left (those to the internet) will be routed via the default gateway.

You can give additional routes using
Code:

routes_eth0 = "..."
routes_eth1="..."

in /et c/conf.d/net or routes_ESSID in /etc/conf.d/wireless.

You can test your routes with
Code:

ip route get <ip-address>

This will show the device the request will take.

Have a look at the Networking Howtos at www.tldp.org to learn more about routing.
_________________
Join the adopt an unanswered question initiative now
Back to top
View user's profile Send private message
ZZamboni
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jan 2004
Posts: 96
Location: Zurich, Switzerland

PostPosted: Tue Jul 27, 2004 9:03 am    Post subject: Reply with quote

UberLord,

Thanks for the scripts and the ebuild - it works beautifully! I only had to fix a typo in wireless_associate_pre(), as per the following patch:
Code:

--- wireless.sh.orig    2004-07-27 10:38:29.216451316 +0200
+++ wireless.sh 2004-07-27 10:38:33.353603047 +0200
@@ -258,8 +258,8 @@
        ebegin "  Running an assocation setup script for \"${d}\""
        ${s} || r=$?

-       eend r
-       return r
+       eend $r
+       return $r
 }

 # bool wireless_associate(char *interface, char *essid, char *wep_required)

It seems that the built-in mini-PCI Cisco interface on my T30 does not support scanning before LEAP authentication is complete, but I have set the first ESSID in prefered_aps to the one that needs LEAP auth, so it's the default one when the scanning fails.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 27, 2004 9:58 am    Post subject: Reply with quote

Thanks for the patch! It's going in the next version.

I'm not sure about how LEAP really works. If it's specific to the card, then you can run your LEAP script before wireless in preup in /etc/conf.d/net

If it's specific to the AP then it needs to be where it is.

Could you let me know as if it's the fomer then I can remove the pre-associate script bit from my code!
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
ZZamboni
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jan 2004
Posts: 96
Location: Zurich, Switzerland

PostPosted: Tue Jul 27, 2004 11:40 am    Post subject: Reply with quote

UberLord wrote:
I'm not sure about how LEAP really works.
...
If it's specific to the AP then it needs to be where it is.

It is specific to the AP. In my case, I need LEAP at work, but WEP at home, so the pre-associate script needs to be run after scanning for APs. I think it's OK where it is. In my laptop the scan cannot be performed in the LEAP network (the scan fails), but I have a colleague with a different network card for whom the scan works correctly, and it identifies the network for which LEAP authentication is needed.

As an aside, here's a script I wrote for automatically detecting when a network cable is connected, and switch to the wired or wireless interface accordingly. It uses mii-tool (part of the net-tools package), and it is still a little bit crude, but it works. Now I can finally have a system that automatically configures itself to the network!

Code:

#!/bin/sh
# Automatically switch from wired to wireless network, by detecting
# if a cable is connected, using mii-tool.
# Usage: set the names of WIRED and WIRELESS accordingly, then run
# the script.
# ZZamboni, Jul 2004

WIRED=eth0
WIRELESS=eth1
PERIOD=2
VERBOSE=1

. /sbin/functions.sh

# silently check if an interface is active
active() {
        /etc/init.d/net.${1} --quiet status
}
# enable and disable interfaces. We use pause instead of stop
# to avoid stopping dependent services
enable() {
        /etc/init.d/net.${1} start
}
disable() {
        /etc/init.d/net.${1} pause
}
# switch from one interface to the other
switch_if() {
        FROM=$1
        TO=$2
        DESC=$3
        if ! active $TO; then
                [[ -n "$VERBOSE" ]] && einfo "Switching to$DESC interface $TO"
                enable $TO
        fi
        if active $FROM; then
                disable $FROM
        fi
}

# main loop
while /bin/true; do
        L=`/sbin/mii-tool ${WIRED}`
        if expr "$L" : ".*no link" >/dev/null; then
                switch_if ${WIRED} ${WIRELESS} " wireless"
        else
                switch_if ${WIRELESS} ${WIRED} " wired"
        fi
        sleep ${PERIOD}
done
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 27, 2004 11:50 am    Post subject: Reply with quote

Would it hurt to run LEAP on non-LEAP capable AP's? ie, would they be picked up and allowed to associate?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
ZZamboni
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jan 2004
Posts: 96
Location: Zurich, Switzerland

PostPosted: Tue Jul 27, 2004 11:59 am    Post subject: Reply with quote

UberLord wrote:
Would it hurt to run LEAP on non-LEAP capable AP's? ie, would they be picked up and allowed to associate?


I believe it would not hurt, but the authentication will fail, so if the exit code of the script is checked before proceeding, it would not allow the rest of the set up to proceed.

I'll double-check tonight at home.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 27, 2004 12:31 pm    Post subject: Reply with quote

ZZamboni wrote:
UberLord wrote:
Would it hurt to run LEAP on non-LEAP capable AP's? ie, would they be picked up and allowed to associate?


I believe it would not hurt, but the authentication will fail, so if the exit code of the script is checked before proceeding, it would not allow the rest of the set up to proceed.

I'll double-check tonight at home.


That would be cool.
By moving the code into th preup function in conf.d/net you can handle the return yourself, choosing to fail the preup or not. Obviously you would have to insert it berfore the wireless_up line.

That would be of great benefit as I can remove LEAP stuff from my code as I'm not overly happy running an external script. The only reason it was in there was because my origonal work was a direct replacement for net.eth0 instead of a plugin which it is now. If I can remove it then it becomes much cleaner.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
crafteh
n00b
n00b


Joined: 30 Mar 2004
Posts: 29

PostPosted: Tue Jul 27, 2004 2:36 pm    Post subject: Reply with quote

UberLord wrote:
crafteh wrote:
Is there any way to set it to connect to the AP with the strongest signal? I'm trying to connect to my schools network and it sees 5-6 access points. The one it connects to though, it gets signal quality of like 10/90, even though I'm right next to it.. then it cuts out. Maybe you could incorporate that into the next build?


I can do that. However, it will only work for Acess Points it finds


That'd be sweet! Would it be very difficult to do? Without that, the wireless doesn't work too well for me D:
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 27, 2004 2:44 pm    Post subject: Reply with quote

crafteh wrote:
That'd be sweet! Would it be very difficult to do? Without that, the wireless doesn't work too well for me D:


It's already done - it sorts by that quality number reported by iwlist $iface scan

If you want to beta test it, you can blag it from http://rsm.demon.co.uk/~roy/downloads/wireless-config-0.5.3/wireless.sh

However, I need feedback from a few users with other issues before I release a new version. Regardless, a new version with this feature will be released on Friday at the latest.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
teedog
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 211

PostPosted: Tue Jul 27, 2004 3:11 pm    Post subject: Reply with quote

Hi UberLord,

Just wanted to report this small problem with the latest version:

Code:
init.d # /etc/init.d/net.wlan0 start
 * Running preup function
 *   Configuring wireless network for wlan0
 *   Scanning for access points
 *     Found 01:23:01:23:01:23
 *     Found
 *     Found
 *   Connecting to "" (WEP Disabled)...                   [ !! ]

 *   Connecting to "" (WEP Disabled)...                   [ !! ]

 *   Trying to force preferred incase they are hidden
 *   Connecting to "my wireless" (WEP Disabled)...        [ ok ]
 *     wlan0 connected to "my wireless" in managed mode
 *     on channel 01 (WEP disabled)
 * Bringing wlan0 up via DHCP...                          [ ok ]
 *   wlan0 received address 123.123.123.123


Notice the second and third found AP's appear to have no MAC address. The script also connects to "" because, I presume, those found AP's are not broadcasting their ESSID. Are there any cases when connecting to "" would work? Could you add an option to not connect to AP's that are not broadcasting the ESSID?

Also, although 3 AP's are found, it only seems to connect to 2 of them.

The only thing I edited in /etc/conf.d/wireless is "preferred_aps" so I don't think there's anything wrong with my config.

Thanks again.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 27, 2004 3:44 pm    Post subject: Reply with quote

Thats weird.

Could you try the beta version above (re-download it if you already got it)
and try that. Post the output of it and the contents of
Code:
ifconfig wlan0 up
iwlist wlan0 scan

If you don't want to post mac addys' then please PM me the exact output.

Thanks
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
teedog
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 211

PostPosted: Tue Jul 27, 2004 4:21 pm    Post subject: Reply with quote

UberLord, PM with outputs sent.
Back to top
View user's profile Send private message
stingray
n00b
n00b


Joined: 13 Jul 2003
Posts: 20
Location: germany

PostPosted: Tue Jul 27, 2004 6:33 pm    Post subject: Reply with quote

Tyger wrote:
Have a look at the Networking Howtos at www.tldp.org to learn more about routing.


did i mention that i only use one interface at a time? :> either eth0 (wire) or eth1 (wlan). they access the same router via a different subnet (ethernet/192.168.6.0, wlan/192.168.7.0). i plan on using ifplugd for this. i guess with this in mind my prior posts about having a different default gw for both interfaces make much more sense.
Back to top
View user's profile Send private message
teedog
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 211

PostPosted: Wed Jul 28, 2004 12:14 am    Post subject: Reply with quote

Hi UberLord,

I'm still having problems with WEP using your latest wireless.sh.

If I put
Code:
key_myessid="1234-1234-1234-1234-1234-1234-56 enc open"

in /etc/conf.d/wireless (where 1234 etc is replaced with my key), I get:

Code:
# /etc/init.d/net.wlan0 start
 * Running preup function
 *   Configuring wireless network for wlan0
 *   Scanning for access points
 *     Found "myessid" at 00:0A:25:47:4D:8G (WEP required)
 *     Found "myessid" at 00:02:73:86:N4:9E (WEP required)
 *   Connecting to "myessid" (WEP enabled)...     [ ok ]
 *     wlan0 connected to "myessid" in managed mode
 *     on channel 06 (WEP disabled)
 * Bringing wlan0 up via DHCP...              [ !! ]


If I put
Code:
key_myessid="1234-1234-1234-1234-1234-1234-56"

in /etc/conf.d/wireless (where 1234 etc is replaced with my key), I get:

Code:
# /etc/init.d/net.wlan0 start
 * Running preup function
 *   Configuring wireless network for wlan0
 *   Scanning for access points
 *     Found "myessid" at 00:0A:25:47:4D:8G (WEP required)
 *     Found "myessid" at 00:02:73:86:N4:9E (WEP required)
 *   Connecting to "myessid" (WEP enabled)...       [ !! ]
 *   Failed to associate with any preferred access points on wlan0
 * Couldn't associate with any access points on wlan0
 * Failed to configure wireless for wlan0
 * preup wlan0 failed


Any ideas?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 28, 2004 8:10 am    Post subject: Reply with quote

stingray wrote:
Tyger wrote:
Have a look at the Networking Howtos at www.tldp.org to learn more about routing.


did i mention that i only use one interface at a time? :> either eth0 (wire) or eth1 (wlan). they access the same router via a different subnet (ethernet/192.168.6.0, wlan/192.168.7.0). i plan on using ifplugd for this. i guess with this in mind my prior posts about having a different default gw for both interfaces make much more sense.


Well, you could move one of the gateways to gateway_ESSID so that whichever iface comes up last takes precedence :)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 28, 2004 8:17 am    Post subject: Reply with quote

teedog wrote:
I'm still having problems with WEP using your latest wireless.sh.
Any ideas?


I find it odd that many people have problems with WEP and the new 0.5.x script.

Find an old script that works - the entire 0.4.x series is available from http://rsm.demon.co.uk/~roy/downloads

Then I may be able to fix it.

BTW, WEP has always worked for me - every AP I use has WEP. Not that it does you much good, just pointing out that it does work.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 28, 2004 8:48 am    Post subject: Reply with quote

NEW EBUILD POSTED

Fixed problems with removing Access Points found from arrays (thanks ZZamboni)
Fixed an error with the preassociate script routine
Fixed duplicate ESSIDs being found (difference MAC addresses) and trying to connect to the same ESSID numerous times

New features
Access Points found are sorted by quality (highest first)
Blacklists have been implemented (blacklist_aps= blacklist_aps_eth0=)
Unique Access Point - basically if you have two or more wifi cards then this stops them associating with the same Access Point

Blacklists and Unique AP only work with scanning - if you hard code an ESSID (including "ANY") or your card does not support scanning then they will not work.

Many, many thanks to CB2206 and teedog for doing some serious beta testing for me :)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 28, 2004 12:42 pm    Post subject: Reply with quote

NEW EBUILD POSTED

2 in one day! lol

New feature
Master mode is now supported

Bug fixed
iwconfig_eth0 and iwpriv_eth0 are only applied after wireless has been configured but before the report shows
This fixes an error when "rate 54M" was requested and it fails for some reason

Config Change
adhoc_channel_eth0 has been changed to channel_eth0 to reflect it's use for master mode as well
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stingray
n00b
n00b


Joined: 13 Jul 2003
Posts: 20
Location: germany

PostPosted: Wed Jul 28, 2004 1:09 pm    Post subject: Reply with quote

UberLord wrote:

Well, you could move one of the gateways to gateway_ESSID so that whichever iface comes up last takes precedence :)


sounds good, but it doesn't seem to work. :) i added the line

gateway_myessid="192.168.7.1"

to my /etc/conf.d/wireless but whenever i run the net.eth1 script no gw is set. looks like the gateway_essid-flag is not yet implemented.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 28, 2004 2:48 pm    Post subject: Reply with quote

stingray wrote:
UberLord wrote:

Well, you could move one of the gateways to gateway_ESSID so that whichever iface comes up last takes precedence :)


sounds good, but it doesn't seem to work. :) i added the line

gateway_myessid="192.168.7.1"

to my /etc/conf.d/wireless but whenever i run the net.eth1 script no gw is set. looks like the gateway_essid-flag is not yet implemented.


You're correct!
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 28, 2004 2:52 pm    Post subject: Reply with quote

NEW EBUILD POSTED

Fixed
gateway_ESSID works again

But really guys, that variable has been depreciated. You should be using
Code:

ifconfig_eth0=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0" )
routes_eth0=( "default gw 192.168.0.2" )

to get the same thing

Of course, you can change eth0 to ESSID for wireless ;)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stingray
n00b
n00b


Joined: 13 Jul 2003
Posts: 20
Location: germany

PostPosted: Wed Jul 28, 2004 3:59 pm    Post subject: Reply with quote

thanks a lot UberLord, this really solved my problem. :D
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Jul 29, 2004 8:05 pm    Post subject: Reply with quote

Just a quick note to say that I've updated the ebuild so that postdown is used instead of the predown function - this is to give DHCP a chance to release it's IP and a few other things.

The actual wireless script has not changed.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
mattjackets
n00b
n00b


Joined: 29 Jul 2004
Posts: 2

PostPosted: Thu Jul 29, 2004 10:11 pm    Post subject: runscript.sh strange error Reply with quote

Hi all, I'm new to gentoo so if i missed something obvious just let me know...

I've installed wireless-config on top of my already working wireless setup which involves:
wlan-ng and a prism3 usb nic.
/etc/init.d/wlan is started at "BOOT" runlevel

when I run /etc/init.d/net.wlan0 start I get the following error:
Code:
 * Running preup function
 *   Configuring wireless network for wlan0
/sbin/runscript.sh: line 759: error: command not found
 * Failed to configure wireless for wlan0


after looking into /sbin/runscript.sh i found that there are only 538 lines in the file!!

what's going on here? and is running '/etc/init.d/net.wlan0 start' the proper way to startup all these fancy wireless settings?

thanks,
+matt
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Fri Jul 30, 2004 9:17 am    Post subject: Re: runscript.sh strange error Reply with quote

mattjackets wrote:
Hi all, I'm new to gentoo so if i missed something obvious just let me know...

I've installed wireless-config on top of my already working wireless setup which involves:
wlan-ng and a prism3 usb nic.


Sorry mattjackets, but this script does not work with linux-wlan-ng as of yet. I understand the developers are making it so that it works with the wireless-tools package which is what my script uses and which every other driver out there uses.

I also have no plans to make it linux-wlan-ng compatible.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page Previous  1, 2, 3 ... 45, 46, 47 ... 57, 58, 59  Next
Page 46 of 59

 
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