Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Internet questions
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
GivePeaceAChance
Guru
Guru


Joined: 26 May 2007
Posts: 480

PostPosted: Sat Dec 15, 2007 1:26 am    Post subject: [SOLVED] Internet questions Reply with quote

So, first of all, when I boot up, I get the following, when trying to get internet.

Device initiated servbices: ipw net.eth0
Starting lo
Bringing up lo
Starting eth0
Configuration not set for eht0 - assuming DHCP
Bringing up eht0 dhcp
Running dhcpcd ...
Error, eth0: timed out

Now what I would like to happen on bootup is:

1. check to see if an ethernet cable is plugged in. If there is, connect via that.
2. Otherwise, if MyHomeNetwork is available, connect to it. Else, connect to the strongest accessible wireless network available.

Also, at the present time, after booting up, I must su into root and get internet working by doing the following (ps. I'm a noob, so maybe I don't need to do this, but as of now, this is what I did today upon booting up to get internet):

iwconfig [put in my network settings, like essid, key [1] .... etc]
/etc/init.d/net.eth1 stop
iwconfig [put in my network settings, like essid, key [1] .... etc]
dhcpcd -d eth1
/etc/init.d/net.eth1 start

How can I simply have internet, or at least start it, without having to do all that, and without having to be root to do it?


Thanks!


Last edited by GivePeaceAChance on Mon Dec 17, 2007 12:25 am; edited 1 time in total
Back to top
View user's profile Send private message
mjf55
Guru
Guru


Joined: 25 Aug 2007
Posts: 372

PostPosted: Sat Dec 15, 2007 4:37 am    Post subject: Reply with quote

Code:
emerge sys-apps/ifplugd
This is a utility that "Brings up/down ethernet ports automatically with cable detection". This will take care of step one.
Step two, I use wpa_supplicant, and I have my home network a higher priority, so that is looked for first. If that is not found, I have an open network setup ( in /etc/wpa_supplicant/wpa_supplicant.conf) that will connect to any open signal. I am not sure about signal strength, but I thought the wireless driver would connect to the strongest frist.
_________________
Mark
No longer a n00b, but still a 'Kool Kid' wannabe
Back to top
View user's profile Send private message
GivePeaceAChance
Guru
Guru


Joined: 26 May 2007
Posts: 480

PostPosted: Sat Dec 15, 2007 4:55 am    Post subject: Reply with quote

OK, so I've emerged ifplugd, but do I need to do anything else, or will it just do it automatically?

Secondly, I am using wireless-tools because my family's wireless is WEP. i attempted, in the summer, to get WPA working, but I couldn't get Gentoo to work with WPA, nor could I get another Windows machine in my house to work with WPA. So if anyone who uses wireless-tools can help me out, that would be great.

Any more help with the bootup crud would be helpful. :)
Back to top
View user's profile Send private message
mjf55
Guru
Guru


Joined: 25 Aug 2007
Posts: 372

PostPosted: Sat Dec 15, 2007 3:56 pm    Post subject: Reply with quote

Emerging ifplugd is all you need to do for automatic cable detection. So starting/stopping eth0 will be automatic. I myself have not worked out how to start / stop wireless (my ath0) based on a cable connection. I am sure it can be done, I have not worked through it yet.

A link in this fourm for getting wpa_supplicant working is here, http://forums.gentoo.org/viewtopic-t-623183-highlight-.html, if you choose to try.

For wireless tools, ...looking
Edit: Ok, your answers reside in
    /etc/conf.d/net.example
    /etc/conf.d/wireless.example
    man ifplugd

That should cure what ails you.
_________________
Mark
No longer a n00b, but still a 'Kool Kid' wannabe
Back to top
View user's profile Send private message
GivePeaceAChance
Guru
Guru


Joined: 26 May 2007
Posts: 480

PostPosted: Sat Dec 15, 2007 10:43 pm    Post subject: Reply with quote

Well I tried making a wireless file, and I changed my net file a bit, but after doing that, I couldn't get wireless AT ALL. Yay for backups. As it stands, I still have to log in to my computer, su as root, then do an almost random permutation of the following commands: /etc/conf.d/eth1 start, /etc/conf.d/eth1 stop, a big long iwconfig string with my required AP info, and dhcpcd -d eth1. I DON'T want to have to do that. I'll post my files here, perhaps someone else can see why this stuff is happening...

Just to reiterate, what I want is:

Boot up my computer, log into my user, have internet ready to go without needing to su or do any crap like that
If a cable is plugged in, use it
If not, go wireless, but use Word as the preferred access point
If Word isn't available, use a different one

The following files are exactly as they are on my machine, except instead of my one-word ESSID I have here "Word" and my key is the same digits as on this page, just a different string of numbers. The hyphens are exactly as in the file as well.

Current net file:

Code:

#-----------------------------------------------------------------------------
# WIRELESS (802.11 support)
# Wireless can be provided by iwconfig or wpa_supplicant

# iwconfig
# emerge net-wireless/wireless-tools
# Wireless options are held in /etc/conf.d/wireless - but could be here too
# Consult the sample file /etc/conf.d/wireless.example for instructions
# iwconfig is the default

# GENERIC WIRELESS OPTIONS
# PLEASE READ THE INSTRUCTIONS IN /etc/conf.d/wireless.example FOR
# HOW TO USE THIS ESSID VARIABLE
# You can also override any settings found here per ESSID - which is very
# handy if you use different networks a lot
config_Word=( "dhcp" )
dhcpcd_Word="-t 10"

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth1=( "dhcp" )

# Prefer iwconfig over wpa_supplicant
modules=( "iwconfig" )

# If you have more than one DHCP client installed, you need to specify which
# one to use - otherwise we default to dhcpcd if available.
modules=( "dhcpcd" ) # to select dhclient over dhcpcd

# Configure WEP keys for Access Points called ESSID1 and ESSID2
# You may configure up to 4 WEP keys, but only 1 can be active at
# any time so we supply a default index of [1] to set key [1] and then
# again afterwards to change the active key to [1]
# We do this incase you define other ESSID's to use WEP keys other than 1
#
# Prefixing the key with s: means it's an ASCII key, otherwise a HEX key
#
# enc open specified open security (most secure)
# enc restricted specified restricted security (least secure)
key_Word="[1] 1234-5678-90 key [1] enc open"
#key_ESSID2="[1] aaaa-bbbb-cccc-dd key [1] enc restricted"

# The below only work when we scan for available Access Points

# Sometimes more than one Access Point is visible so we need to
# define a preferred order to connect in
preferred_aps=( "Word" )

ifplugd_eth1="..."

ifplugd_eth1="--api-mode=wlan"

dhcp_eth1="nodns nontp nonis"


The following is the net file I tried to play with, but I lost my connect after using it AND a created "wireless" file.

Code:

#-----------------------------------------------------------------------------
# WIRELESS (802.11 support)
# Wireless can be provided by iwconfig or wpa_supplicant

# iwconfig
# emerge net-wireless/wireless-tools
# Wireless options are held in /etc/conf.d/wireless - but could be here too
# Consult the sample file /etc/conf.d/wireless.example for instructions
# iwconfig is the default

# GENERIC WIRELESS OPTIONS
# PLEASE READ THE INSTRUCTIONS IN /etc/conf.d/wireless.example FOR
# HOW TO USE THIS ESSID VARIABLE
# You can also override any settings found here per ESSID - which is very
# handy if you use different networks a lot
config_Word=( "dhcp" )
dhcpcd_Word="-t 10"

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth1=( "dhcp" )

# Prefer iwconfig over wpa_supplicant
modules=( "iwconfig" )

# If you have more than one DHCP client installed, you need to specify which
# one to use - otherwise we default to dhcpcd if available.
modules=( "dhcpcd" ) # to select dhclient over dhcpcd

# Configure WEP keys for Access Points called ESSID1 and ESSID2
# You may configure up to 4 WEP keys, but only 1 can be active at
# any time so we supply a default index of [1] to set key [1] and then
# again afterwards to change the active key to [1]
# We do this incase you define other ESSID's to use WEP keys other than 1
#
# Prefixing the key with s: means it's an ASCII key, otherwise a HEX key
#
# enc open specified open security (most secure)
# enc restricted specified restricted security (least secure)
key_Word="[1] 1234-5678-90 key [1] enc open"
#key_ESSID2="[1] aaaa-bbbb-cccc-dd key [1] enc restricted"

# The below only work when we scan for available Access Points

# Sometimes more than one Access Point is visible so we need to
# define a preferred order to connect in
preferred_aps=( "Word" )

ifplugd_eth1="..."

ifplugd_eth1="--api-mode=wlan"

#dhcp_eth1="nodns nontp nonis"

# This tells the dhcp client to release it's lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
# use any of them.

dhcp_eth1="release nodns nontp nonis nogateway nosendhost"

#-----------------------------------------------------------------------------
# Cable in/out detection
# Sometimes the cable is in, others it's out. Obviously you don't want to
# restart net.eth0 every time when you plug it in either.
#
# emerge sys-apps/ifplugd
# and you're done :)


The following is gleaned from wireless.example. I looked at that file, made changes, and called it wireless. Before making a "wireless" file, there was only a wireless.example file, no wireless file.

Code:

# NOTE: THIS FILE WAS NOT ACTUALLY CREATED. IT STARTED OUT AS .EXAMPLE AND I CHANGED IT TO SIMPLY WIRELESS.

##############################################################################
# HINTS
##############################################################################
# Say that your wireless interface is eth1 - the line
#      #essid_eth1="any"
# becomes
#      #essid_eth1="any"
#
# Remember to change ESSID to your ESSID.
#      #key_ESSID="s:passkey"
# becomes
#      #key_Word="s:passkey"
#      #essid_eth0="Word"
##############################################################################

##############################################################################
# SETTINGS
##############################################################################
# WEP key for the AP with MAC address 001122334455
#mac_key_001122334455="2508471522"
#
# Map a MAC address to an ESSID
# This is used when the Access Point is not broadcasting it's ESSID
# WARNING: This will override the ESSID being broadcast due to some
# Access Points sending an ESSID even when they have been configured
# not to!
# Change 001122334455 to the MAC address and ESSID to the ESSID
# it should map to
#mac_essid_001122334455="ESSID"
#
# You can define blacklisted Access Points in the same way
#blacklist_aps=( "ESSID 1" "ESSID 2" )
#blacklist_aps_eth0=( "ESSID 3" ESSID 4" )
##############################################################################


# ~~~~~FINAL SETTINGS~~~~~

# Seconds to wait before scanning
# Some drivers need to wait until they have finished "loading"
# before they can scan - otherwise they error and claim that they cannot scan
# or resource is unavailable. The default is to wait zero seconds
sleep_scan_eth0="1"

# You can also override the interface settings found in /etc/conf.d/net
# per ESSID - which is very handy if you use different networks a lot
config_Word=( "dhcp" )
#dhcpcd_ESSID="-t 5"
#routes_ESSID=()
#fallback_ESSID=()

# This lists the preferred ESSIDs to connect to in order
# ESSID's can contain any characters here as they must match the broadcast
# ESSID exactly.
# Surround each ESSID with the " character and seperate them with a space
# If the first ESSID isn't found then it moves onto the next
# If this isn't defined then it connects to the first one found
preferred_aps=( "Word" )

# You can also define a preferred_aps list per interface
preferred_aps_eth1=( "Word" )

# You can also say whether we only connect to preferred APs or not
# Values are "any", "preferredonly", "forcepreferred", "forcepreferredonly" and "forceany"
# "any" means it will connect to visible APs in the preferred list and then any
# other available AP
# "preferredonly" meankey_Berry="2508-4715-22 enc open"s it will only connect to visible APs in the preferred list
# "forcepreferred" means it will forceably connect to APs in order if it does not find
# them in a scan
# "forcepreferredonly" means it forceably connects to the APs in order and does not bother
# to scan
# "forceany" does the same as forcepreferred + connects to any other available AP
# Default is "any"
associate_order="any"
associate_order_eth0="any"

# Define a WEP key per ESSID or MAC address (of the AP, not your card)
# The encryption type (open or restricted) must match the
# encryption type on the Access Point
# You can't use "any" for an ESSID here
# Note - this example also sets the encryption method to open
# which is regarded as more secure than restricted
key_Word="1234567890 enc open"

# Here are some more examples of keys as some users find others work
# and some don't where they should all do the same thing
key_Word="open 1234-5678-90"
key_Word="1234-5678-90 enc open"
Back to top
View user's profile Send private message
GivePeaceAChance
Guru
Guru


Joined: 26 May 2007
Posts: 480

PostPosted: Sun Dec 16, 2007 6:02 am    Post subject: Reply with quote

NEW QUESTION, SAME TOPIC, SAME PERSON ASKING:


Hi,

So after a bunch of fiddling and observing patterns and such, I'm knocking my head against the wall, because here is how I can successfully get internet on my box:

1. log in
2. su as root
3. iwconfig [my settings]
4. press the refresh button on the browser a bunch of times (or once) til the page pops up

So is the reason internet takes a bit to come up for me (after entering my settings) because Gentoo has to take a second to notice my wireless AP? (Even though I'm sitting right beside my router)

Next question is: I want internet to be ready to go when I log in to my account. How can avoid having to su and running my iwconfig options? I've edited my net file, but that isn't doing it, so is there another way around this? Can I add the command as a command to run at boot? (Remember, though, that I must be root to execute the command in the first place)
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