View previous topic :: View next topic |
Author |
Message |
Tyger n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/208713522941045e2fc0d74.jpg)
Joined: 25 Jul 2004 Posts: 30 Location: Germany
|
Posted: Tue Jul 27, 2004 8:54 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
ZZamboni Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/116248732745d456ff5fddd.gif)
Joined: 16 Jan 2004 Posts: 96 Location: Zurich, Switzerland
|
Posted: Tue Jul 27, 2004 9:03 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ZZamboni Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/116248732745d456ff5fddd.gif)
Joined: 16 Jan 2004 Posts: 96 Location: Zurich, Switzerland
|
Posted: Tue Jul 27, 2004 11:40 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ZZamboni Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/116248732745d456ff5fddd.gif)
Joined: 16 Jan 2004 Posts: 96 Location: Zurich, Switzerland
|
Posted: Tue Jul 27, 2004 11:59 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Tue Jul 27, 2004 12:31 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
crafteh n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2004 Posts: 29
|
Posted: Tue Jul 27, 2004 2:36 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
teedog Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 09 Mar 2004 Posts: 211
|
Posted: Tue Jul 27, 2004 3:11 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
teedog Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 09 Mar 2004 Posts: 211
|
Posted: Tue Jul 27, 2004 4:21 pm Post subject: |
|
|
UberLord, PM with outputs sent. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stingray n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 13 Jul 2003 Posts: 20 Location: germany
|
Posted: Tue Jul 27, 2004 6:33 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
teedog Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 09 Mar 2004 Posts: 211
|
Posted: Wed Jul 28, 2004 12:14 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Wed Jul 28, 2004 8:10 am Post subject: |
|
|
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 ![Smile :)](images/smiles/icon_smile.gif) _________________ Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Wed Jul 28, 2004 8:48 am Post subject: |
|
|
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 ![Smile :)](images/smiles/icon_smile.gif) _________________ Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stingray n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 13 Jul 2003 Posts: 20 Location: germany
|
Posted: Wed Jul 28, 2004 1:09 pm Post subject: |
|
|
UberLord wrote: |
Well, you could move one of the gateways to gateway_ESSID so that whichever iface comes up last takes precedence ![Smile :)](images/smiles/icon_smile.gif) |
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stingray n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 13 Jul 2003 Posts: 20 Location: germany
|
Posted: Wed Jul 28, 2004 3:59 pm Post subject: |
|
|
thanks a lot UberLord, this really solved my problem. ![Very Happy :D](images/smiles/icon_biggrin.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mattjackets n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Simpsons/simpsons_santas_little_help.gif)
Joined: 29 Jul 2004 Posts: 2
|
Posted: Thu Jul 29, 2004 10:11 pm Post subject: runscript.sh strange error |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Jul 30, 2004 9:17 am Post subject: Re: runscript.sh strange error |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|