You are not logged in.

#1 2008-11-10 23:51:12

Zibi1981
Member
From: Poland
Registered: 2008-01-31
Posts: 642

How to force net-auto daemon to establish connection durring boot-up?

Hi!

I have a problem with properly configuring my network_profiles. I decided to use net-auto daemon, as mainly I have access to two different networks (one Ethernet and one wireless), I've changed my /etc/rc.conf file as follows

bash-3.2# cat /etc/rc.conf
#
# /etc/rc.conf - Main Configuration for Arch Linux
#

# -----------------------------------------------------------------------
# LOCALIZATION
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
# HARDWARECLOCK: set to "UTC" or "localtime"
# USEDIRECTISA: use direct I/O requests instead of /dev/rtc for hwclock
# TIMEZONE: timezones are found in /usr/share/zoneinfo
# KEYMAP: keymaps are found in /usr/share/kbd/keymaps
# CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US)
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
#
LOCALE="pl_PL.utf8"
HARDWARECLOCK="localtime"
USEDIRECTISA="no"
TIMEZONE="Europe/Warsaw"
KEYMAP="pl"
CONSOLEFONT="lat2-16"
CONSOLEMAP="8859-2"
USECOLOR="yes"

# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
# MOD_AUTOLOAD: Allow autoloading of modules at boot and when needed
# MOD_BLACKLIST: Prevent udev from loading these modules
# MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
#
# NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array.
#
MOD_AUTOLOAD="yes"
#MOD_BLACKLIST=() #deprecated
MODULES=(r8169 !pcspkr !ipv6 !ipw3945 iwl3945 ac battery button fan snd-mixer-oss snd-pcm-oss snd-hwdep snd-page-alloc snd-pcm snd-timer snd snd-hda-intel soundcore evdev acpi-cpufreq cpufreq_ondemand cpufreq_powersave)

# Scan for LVM volume groups at startup, required if you use LVM
USELVM="no"

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="felipe"

# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
#
# DHCP:     Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#
#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
#lo="127.0.0.1"
#eth0="dhcp"
#INTERFACES=(eth0 wlan0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
#gateway="default gw 192.168.0.1"
ROUTES=(!gateway)

# Enable these network profiles at boot-up.  These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This now requires the netcfg package
#
#NETWORKS=menu
AUTO_NETWORKS=(dom manufaktura)

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(@syslog-ng net-auto !network @netfs hal alsa @crond cpufreq laptop-mode)

The dom and manufaktura configuration files are located in /etc/network.d folder, but after a successful boot-up I have no Internet connection. Typing in console

netcfg dom

establishes the connection without any issues, but that was not the plan. Anyone could throw a suggestion what am I doing wrong?


"... being a Linux user is sort of like living in a house inhabited by a large family of carpenters and architects. Every morning when you wake up, the house is a little different. Maybe there is a new turret, or some walls have moved. Or perhaps someone has temporarily removed the floor under your bed."

MSI Raider GE78HX 13VI-032PL

Offline

#2 2008-11-11 01:22:11

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: How to force net-auto daemon to establish connection durring boot-up?

The way I understand net-auto to work (or at least used to work, I don't have the very latest version), is that the first argument in the AUTO_NETWORKS array should be "auto-wireless" or "auto-ethernet", and the second argument should be the name of the interface you want to be automatically connected (e.g., "wlan0"). You can inspect the /etc/rc.d/net-auto script to see what's going on. It should call something like "/usr/bin/netcfg-auto-wireless wlan0". You can try calling that manually to see if it works (probably you'll need to call it with sudo or as root). That command should cycle through all of your profiles that are defined on the specified interface, until it finds one that works.

If you want to do something else, for example, if you want to try to raise the dom profile and if it fails, try to raise the manufaktura profile, then you don't want to use net-auto, but just the regular NETWORKS=(...) array and net-profiles daemon. If that doesn't do what you want, you'll have to write your own script and/or daemon. The netcfg2 functions in /usr/lib/networks/* are meant to be reused for user-customized scripts.

Offline

#3 2008-11-11 08:31:52

Zibi1981
Member
From: Poland
Registered: 2008-01-31
Posts: 642

Re: How to force net-auto daemon to establish connection durring boot-up?

Thanks for the tips. The way I want it to work is as you described in the second paragraph. If my laptop is connected via RJ-45 cable to my home ("dom") network during boot-up, then I want netcfg to connect to that network and ignore wlan0 ("manufaktura"), otherwise I want it to connect wireless.
I've modified my /etc/rc.conf file as below

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="felipe"

# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
# 
# DHCP:     Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#
#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
#lo="127.0.0.1"
#eth0="dhcp"
#INTERFACES=(eth0 wlan0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
#gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
 
# Enable these network profiles at boot-up.  These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This now requires the netcfg package
#
NETWORKS=(dom manufaktura)
#AUTO_NETWORKS=(auto-ethernet ethernet wireless)

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(@syslog-ng net-profiles !network @netfs hal alsa @crond cpufreq laptop-mode)

Will let you know if it works after reboot wink

EDIT

Well, thanks to your advice I've noted a progress but that's not exactly what I was looking for. Now netcfg during boot-up is trying to establish all the network connections listed in NETWORKS=() line in the main configuration file. This takes unnecessary time and extends booting when I'm at home and don't want to use wireless connection. How to make it stop after successfully establishing any connection?

Last edited by Zibi1981 (2008-11-11 13:58:46)


"... being a Linux user is sort of like living in a house inhabited by a large family of carpenters and architects. Every morning when you wake up, the house is a little different. Maybe there is a new turret, or some walls have moved. Or perhaps someone has temporarily removed the floor under your bed."

MSI Raider GE78HX 13VI-032PL

Offline

#4 2008-11-12 22:28:33

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: How to force net-auto daemon to establish connection durring boot-up?

I thought what you're asking is what netcfg already did, but I haven't looked at the source for a few months. iphitus will have to weigh in on this. He's working on a major rewrite of netcfg anyway.

Even without remembering the details of the netcfg source, I remember enough to say that if this isn't what it already does, then there's no simple tweak to make it do it. Instead, you'll have to write your own script---which script can however call the netcfg library functions in /usr/lib/network. It's all just shell script code, so if you're comfortable with that and spend some time reading through the netcfg source, you should be able to work out what to do. If you're not comfortable with shell scripting, or don't have the time to do this yourself, I fear you'll have to wait until someone else posts scripts that do what you want.

wicd or network manager will probably do what you want, but if you prefer to figure out how to do the job with the lean, lightweight netcfg scripts, I applaud you. That's my attitude too.

Offline

#5 2008-11-14 22:32:07

Zibi1981
Member
From: Poland
Registered: 2008-01-31
Posts: 642

Re: How to force net-auto daemon to establish connection durring boot-up?

Well, I'm not a programmer at all, so it seems that I have two possible solutions: wait until someone else will write a script, or use another application. Ehhh, and I thought net-auto was ideal for this task sad


"... being a Linux user is sort of like living in a house inhabited by a large family of carpenters and architects. Every morning when you wake up, the house is a little different. Maybe there is a new turret, or some walls have moved. Or perhaps someone has temporarily removed the floor under your bed."

MSI Raider GE78HX 13VI-032PL

Offline

#6 2008-11-15 02:46:57

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: How to force net-auto daemon to establish connection durring boot-up?

net-auto just looks through what wifi ESSIDs show up on a single interface, and selects the first profile defined on that interface/one of these ESSIDs. You want to use two interfaces (and one of them not wifi); that's why net-auto doesn't as it's written fit your needs.

Offline

#7 2008-11-19 03:38:32

sinister99
Member
Registered: 2007-04-10
Posts: 136

Re: How to force net-auto daemon to establish connection durring boot-up?

Profjim wrote:

net-auto just looks through what wifi ESSIDs show up on a single interface, and selects the first profile defined on that interface/one of these ESSIDs. You want to use two interfaces (and one of them not wifi); that's why net-auto doesn't as it's written fit your needs.

netcfg hasn't done this for me since I started using a new router and therefore profile.  It used to automatially come up fine, but now nothing happens unless I manually tell netcfg to bring up the network.

AUTO_NETWORKS=(auto-wireless ath0)

Offline

#8 2009-03-01 20:28:30

robertoprs
Member
From: México
Registered: 2009-02-08
Posts: 21

Re: How to force net-auto daemon to establish connection durring boot-up?

Net-auto only works for wireless. If you put this:

AUTO_NETWORKS=(auto-wireless wlan0)

(change wlan0 for whatever your wireless interface is) and leave the wired profiles on the "NETWORKS" group, the wireless device will not try to establish a connection if none of the essid's are reachable. However, the net-profiles daemon will always try connect to a wired network no matter what.


"What gets us into trouble is not what we don't know...
It's what we know for sure that just ain't so."
Mark Twain

Offline

#9 2009-06-23 12:15:42

unregistered
Member
Registered: 2008-04-09
Posts: 134

Re: How to force net-auto daemon to establish connection durring boot-up?

if i do this:

robertoprs wrote:

Net-auto only works for wireless. If you put this:

AUTO_NETWORKS=(auto-wireless wlan0)

(change wlan0 for whatever your wireless interface is) and leave the wired profiles on the "NETWORKS" group, the wireless device will not try to establish a connection if none of the essid's are reachable. However, the net-profiles daemon will always try connect to a wired network no matter what.

Q1) then how will net-auto determine what is the first profile that's defined on the interface, in this case, wlan0?
Q2) how can i specifically make net-auto connect to a particular profile that is not the first profile selected?

as stated here:

net-auto just looks through what wifi ESSIDs show up on a single interface, and selects the first profile defined on that interface/one of these ESSIDs.

Offline

#10 2009-06-23 17:05:27

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: How to force net-auto daemon to establish connection durring boot-up?

If it's only the boot time that you're having trouble with, and you're not starting any services that absolutely depend on a network connection, why not background net-profiles so it doesn't slow down the boot process?

Offline

Board footer

Powered by FluxBB