openrc/conf.d.BSD/net.example

451 lines
17 KiB
Plaintext
Raw Normal View History

# BSD NOTE: Network functionality support is still being written and
# many parts here are missing compared to Gentoo/Linux
# Feel free to write the needed modules and submit them to us :)
#
##############################################################################
# QUICK-START
#
# The quickest start is if you want to use DHCP.
# In that case, everything should work out of the box, no configuration
# necessary, though the startup script will warn you that you haven't
# specified anything.
# WARNING :- some examples have a mixture of IPv4 (ie 192.168.0.1) and IPv6
# (ie 4321:0:1:2:3:4:567:89ab) internet addresses. They only work if you have
# the relevant kernel option enabled. So if you don't have an IPv6 enabled
# kernel then remove the IPv6 address from your config.
# If you want to use a static address or use DHCP explicitly, jump
# down to the section labelled INTERFACE HANDLERS.
#
# If you want to do anything more fancy, you should take the time to
# read through the rest of this file.
##############################################################################
# MODULES
#
# We now support modular networking scripts which means we can easily
# add support for new interface types and modules while keeping
# compatability with existing ones.
#
# Modules load by default if the package they need is installed. If
# you specify a module here that doesn't have it's package installed
# then you get an error stating which package you need to install.
# Ideally, you only use the modules setting when you have two or more
# packages installed that supply the same service.
#
# In other words, you probably should DO NOTHING HERE...
##############################################################################
# INTERFACE HANDLERS
# For a static configuration, use something like this
# (They all do exactly the same thing btw)
#config_eth0="192.168.0.2/24"
#config_eth0="192.168.0.2 netmask 255.255.255.0"
# We can also specify a broadcast
#config_eth0="192.168.0.2/24 brd 192.168.0.255"
#config_eth0="192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
# If you need more than one address, you can use something like this
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
# (eth0:1, eth0:2, etc)
# iproute2 does not do this as there is no need to
#config_eth0="192.168.0.2/24
#192.168.0.3/24
#192.168.0.4/24'"
# Or you can use sequence expressions
#config_eth0="192.168.0.{2..4}/24" FIXME - may not work with baselayout2
# which does the same as above. Be careful though as if you use this and
# fallbacks, you have to ensure that both end up with the same number of
# values otherwise your fallback won't work correctly.
# You can also use IPv6 addresses
# (you should always specify a prefix length with IPv6 here)
#config_eth0="192.168.0.2/24
#4321:0:1:2:3:4:567:89ab/64
#4321:0:1:2:3:4:567:89ac/64"
# If you wish to keep existing addresses + routing and the interface is up,
# you can specify a noop (no operation). If the interface is down or there
# are no addresses assigned, then we move onto the next step (default dhcp)
# This is useful when configuring your interface with a kernel command line
# or similar
#config_eth0="noop
#192.168.0.2/24"
# If you don't want ANY address (only useful when calling for advanced stuff)
#config_eth0="null"
# Here's how to do routing if you need it
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
#routes_eth0="default via 192.168.0.1
#10.0.0.0/8 via 192.168.0.1
#::/0"
# If a specified module fails (like dhcp - see below), you can specify a
# fallback like so
#fallback_eth0="192.168.0.2 netmask 255.255.255.0"
#fallback_route_eth0="default via 192.168.0.1"
# NOTE: fallback entry must match the entry location in config_eth0
# As such you can only have one fallback route.
# Some users may need to alter the MTU - here's how
#mtu_eth0="1500"
# Most drivers that report carrier status function correctly, but some do not
# One of these faulty drivers is for the Intel e1000 network card, but only
# at boot time. To get around this you may alter the carrier_timeout value for
# the interface. -1 is disable, 0 is infinite and any other number of seconds
# is how long we wait for carrier. The current default is 3 seconds
#carrier_timeout_eth0=-1
##############################################################################
# OPTIONAL MODULES
#-----------------------------------------------------------------------------
# WIRELESS (802.11 support)
# Wireless can be provided by BSDs ifconfig (iwconfig) or wpa_supplicant
# wpa_supplicant is preferred, use the modules directive to prefer iwconfig.
#modules="iwconfig"
# ifconfig (iwconig) support is a one shot script - wpa_supplicant is daemon
# that scans, assoicates and re-configures if assocation is lost.
# We call it iwconfig to seperate the wireless setup from ifconfig.
####################################
# HINTS
#
# Most users will just need to set the following options
# key_ESSID1="s:yourkeyhere enc open" # s: means a text key
# key_ESSID2="aaaa-bbbb-cccc-dd" # no s: means a hex key
2007-11-02 20:54:45 +05:30
# preferred_aps="ESSID 1
#ESSID 2"
#
# Clear? Good. Now configure your wireless network below
####################################
# SETTINGS
# Hard code an ESSID to an interface - leave this unset if you wish the driver
# to scan for available Access Points
# I would only set this as a last resort really - use the preferred_aps
# setting at the bottom of this file
#essid_eth0='foo'
# Some drivers/hardware don't scan all that well. We have no control over this
# but we can say how many scans we want to do to try and get a better sweep of
# the area. The default is 1.
#scans_eth0="1"
#Channel can be set (1-14), but defaults to 3 if not set.
#
# The below is taken verbatim from the BSD wavelan documentation found at
# http://www.netbsd.org/Documentation/network/wavelan.html
# There are 14 channels possible; We are told that channels 1-11 are legal for
# North America, channels 1-13 for most of Europe, channels 10-13 for France,
# and only channel 14 for Japan. If in doubt, please refer to the documentation
# that came with your card or access point. Make sure that the channel you
# select is the same channel your access point (or the other card in an ad-hoc
# network) is on. The default for cards sold in North America and most of Europe
# is 3; the default for cards sold in France is 11, and the default for cards
# sold in Japan is 14.
#channel_eth0="3"
# Setup any other config commands. This is basically the ifconfig argument
# without the ifconfig $iface.
#ifconfig_eth0=""
# You can do the same per ESSID too.
#ifconfig_ESSID=""
# Seconds to wait until associated. The default is to wait 10 seconds.
# 0 means wait indefinitely. WARNING: this can cause an infinite delay when
# booting.
#associate_timeout_eth0="5"
# 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.
# To set a hex key, prefix with 0x
#key_ESSID="0x12341234123412341234123456"
# or you can use strings. Passphrase IS NOT supported
#key_ESSID="foobar"
#key_ESSID="foobar"
# WEP key for the AP with MAC address 001122334455
#mac_key_001122334455="foobar"
# 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_ESSID="dhcp"
#routes_ESSID=
#fallback_ESSID=
# Setting name/domain server causes /etc/resolv.conf to be overwritten
# Note that if DHCP is used, and you want this to take precedence then
# please put -R in your dhcpcd options
#dns_servers_ESSID="192.168.0.1 192.168.0.2"
#dns_domain_ESSID="some.domain"
#dns_search_path_ESSID="search.this.domain search.that.domain"
# Please check the man page for resolv.conf for more information
# as domain and search (searchdomains) are mutually exclusive and
# searchdomains takes precedence
# You can also set any of the /etc/conf.d/net variables per MAC address
# incase you use Access Points with the same ESSID but need different
# networking configs. Below is an example - of course you use the same
# method with other variables
#config_001122334455="dhcp"
#dns_servers_001122334455="192.168.0.1 192.168.0.2"
# 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"
# 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="ESSID 1
#ESSID 2"
# You can also define a preferred_aps list per interface
#preferred_aps_eth0="ESSID 3
#ESSID 4"
# 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" means 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"
# You can define blacklisted Access Points in the same way
#blacklist_aps="ESSID 1
#ESSID 2"
#blacklist_aps_eth0="ESSID 3
#ESSID 4"
# If you have more than one wireless card, you can say if you want
# to allow each card to associate with the same Access Point or not
# Values are "yes" and "no"
# Default is "yes"
#unique_ap="yes"
#unique_ap_eth0="yes"
# IMPORTANT: preferred_only, blacklisted_aps and unique_ap only work when
# essid_eth0 is not set and your card is capable of scanning
# NOTE: preferred_aps list ignores blacklisted_aps - so if you have
# the same ESSID in both, well, you're a bit silly :p
##################################################
# wpa_supplicant
# emerge net-wireless/wpa-supplicant
# Wireless options are held in /etc/wpa_supplicant/wpa_supplicant.conf
# Console the wpa_supplicant.conf.example that is installed in
# /usr/share/doc/wpa_supplicant
# By default we don't wait for wpa_suppliant to associate and authenticate.
# If you would like to, so can specify how long in seconds
#associate_timeout_eth0=60
# A value of 0 means wait forever.
# You can also override any settings found here per SSID - which is very
# handy if you use different networks a lot. See below for using the SSID
# in our variables
#config_SSID="dhcp"
# See the System module below for setting dns/nis/ntp per SSID
# You can also override any settings found here per MAC address of the AP
# in case you use Access Points with the same SSID but need different
# networking configs. Below is an example - of course you use the same
# method with other variables
#mac_config_001122334455="dhcp"
#mac_dns_servers_001122334455="192.168.0.1 192.168.0.2"
# When an interface has been associated with an Access Point, a global
# variable called SSID is set to the Access Point's SSID for use in the
# pre/post user functions below (although it's not available in preup as you
# won't have associated then)
# If you're using anything else to configure wireless on your interface AND
# you have installed wpa_supplicant, you need to disable wpa_supplicant
#modules="!iwconfig !wpa_supplicant"
#or
#modules="!wireless"
##############################################################################
# WIRELESS SSID IN VARIABLES
##############################################################################
# Remember to change SSID to your SSID.
# Say that your SSID is My NET - the line
# #key_SSID="s:passkey"
# becomes
# #key_My_NET="s:passkey"
# Notice that the space has changed to an underscore - do the same with all
# characters not in a-z A-Z (English alphabet) 0-9. This only applies to
# variables and not values.
#
# Any SSID's in values like essid_eth0="My NET" may need to be escaped
# This means placing the character \ before the character
# \" need to be escaped for example
# So if your SSID is
# My "\ NET
# it becomes
# My \"\\ NET
# for example
# #essid_eth0="My\"\\NET"
#
# So using the above we can use
# #dns_domain_My____NET="My\"\\NET"
# which is an invalid dns domain, but shows the how to use the variable
# structure
#########################################################
#-----------------------------------------------------------------------------
# DHCP
# DHCP can be provided by dhclient.
#
# dhcpcd: emerge net-misc/dhcpcd
# dhclient: emerge net-misc/dhcp
# Regardless of which DHCP client you prefer, you configure them the
# same way using one of following depending on which interface modules
# you're using.
#config_eth0="dhcp"
# For passing custom options to dhcpcd use something like the following. This
# example reduces the timeout for retrieving an address from 60 seconds (the
# default) to 10 seconds.
#dhcpcd_eth0="-t 10"
# GENERIC DHCP OPTIONS
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
# 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.
#-----------------------------------------------------------------------------
# System
# For configuring system specifics such as domain, dns, ntp and nis servers
# It's rare that you would need todo this, but you can anyway.
# This is most benefit to wireless users who don't use DHCP so they can change
# their configs based on SSID.
# If you omit the _eth0 suffix, then it applies to all interfaces unless
# overridden by the interface suffix.
#dns_domain_eth0="your.domain"
#dns_servers_eth0="192.168.0.2 192.168.0.3"
#dns_search_eth0="this.domain that.domain"
#dns_options_eth0="timeout:1 rotate"
#dns_sortlist_eth0="130.155.160.0/255.255.240.0 130.155.0.0"
# See the man page for resolv.conf for details about the options and sortlist
# directives
#ntp_servers_eth0="192.168.0.2 192.168.0.3"
#nis_domain_eth0="domain"
#nis_servers_eth0="192.168.0.2 192.168.0.3"
# NOTE: Setting any of these will stamp on the files in question. So if you
# don't specify dns_servers but you do specify dns_domain then no nameservers
# will be listed in /etc/resolv.conf even if there were any there to start
# with.
# If this is an issue for you then maybe you should look into a resolv.conf
# manager like resolvconf-gentoo to manage this file for you. All packages
# that baselayout supports use resolvconf-gentoo if installed.
#-----------------------------------------------------------------------------
# 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.
# BSD has the Device State Change Daemon - or devd for short
# To enable this, simple add devd to the boot runlevel
#rc-update add devd boot
#rc
##############################################################################
# ADVANCED CONFIGURATION
#
# Four functions can be defined which will be called surrounding the
# start/stop operations. The functions are called with the interface
# name first so that one function can control multiple adapters. An extra two
# functions can be defined when an interface fails to start or stop.
#
# The return values for the preup and predown functions should be 0
# (success) to indicate that configuration or deconfiguration of the
# interface can continue. If preup returns a non-zero value, then
# interface configuration will be aborted. If predown returns a
# non-zero value, then the interface will not be allowed to continue
# deconfiguration.
#
# The return values for the postup, postdown, failup and faildown functions are
# ignored since there's nothing to do if they indicate failure.
#
# ${IFACE} is set to the interface being brought up/down
# ${IFVAR} is ${IFACE} converted to variable name bash allows
#preup() {
# # Remember to return 0 on success
# return 0
#}
#predown() {
# # The default in the script is to test for NFS root and disallow
# # downing interfaces in that case. Note that if you specify a
# # predown() function you will override that logic. Here it is, in
# # case you still want it...
# if is_net_fs /; then
# eerror "root filesystem is network mounted -- can't stop ${IFACE}"
# return 1
# fi
#
# # Remember to return 0 on success
# return 0
#}
#postup() {
# # This function could be used, for example, to register with a
# # dynamic DNS service. Another possibility would be to
# # send/receive mail once the interface is brought up.
#}
#postdown() {
# # Return 0 always
# return 0
#}
#failup() {
# # This function is mostly here for completeness... I haven't
# # thought of anything nifty to do with it yet ;-)
#}
#faildown() {
# # This function is mostly here for completeness... I haven't
# # thought of anything nifty to do with it yet ;-)
#}