Gentoo Archives: gentoo-user-ru

From: Taz <taz.inside@×××××.com>
To: gentoo-user-ru@l.g.o
Subject: Re: [gentoo-user-ru] net.example
Date: Wed, 01 Feb 2012 17:08:26
Message-Id: CA+0W4NkVaKCK9bxf_+T9ZmWrOubXn6fqPrDM8ESwQ5nODGD6dQ@mail.gmail.com
In Reply to: Re: [gentoo-user-ru] net.example by marlboro
1 кардинальное решение - простыню сюда сувать.
2 хоть на пастебину бы кинул :)
3
4 On Wed, Feb 1, 2012 at 9:05 PM, marlboro <retaw@××××××.ru> wrote:
5
6 > 01.02.2012 23:00, Anton Ananich пишет:
7 > > Здравствуйте!
8 > >
9 > > У меня пропал файл /etc/conf.d/net.example (возможно давно, я просто не
10 > заметил)
11 > > Откуда его можно скачать?
12 > >
13 > > Спасибо,
14 > > Антон
15 >
16 > # For link bonding/trunking emerge net-misc/ifenslave
17 >
18 > # To bond interfaces together
19 > #slaves_bond0="eth0 eth1 eth2"
20 > #config_bond0=( "null" ) # You may not want to assign an IP the the bond
21 >
22 > # If any of the slaves require extra configuration - for example wireless
23 > or
24 > # ppp devices - we need to depend function on the bonded interfaces
25 > #RC_NEED_bond0="net.eth0 net.eth1"
26 >
27 >
28 >
29 > #-----------------------------------------------------------------------------
30 > # Classical IP over ATM
31 > # For CLIP support emerge net-dialup/linux-atm
32 >
33 > # Ensure that you have /etc/atmsigd.conf setup correctly
34 > # Now setup each clip interface like so
35 > #clip_atm0=( "peer_ip [if.]vpi.vci [opts]" ... )
36 > # where "peer_ip" is the IP address of a PVC peer (in case of an ATM
37 > connection
38 > # with your ISP, your only peer is usually the ISP gateway closest to
39 > you),
40 > # "if" is the number of the ATM interface which will carry the PVC,
41 > "vpi.vci"
42 > # is the ATM VC address, and "opts" may optionally specify VC
43 > parameters like
44 > # qos, pcr, and the like (see "atmarp -s" for further reference).
45 > Please also
46 > # note quoting: it is meant to distinguish the VCs you want to create.
47 > You may,
48 > # in example, create an atm0 interface to more peers, like this:
49 > #clip_atm0=( "1.1.1.254 0.8.35" "1.1.1.253 1.8.35" )
50 >
51 > # By default, the PVC will use the LLC/SNAP encapsulation. If you
52 > rather need a
53 > # null encapsulation (aka "VC mode"), please add the keyword "null" to
54 > opts.
55 >
56 >
57 >
58 > #-----------------------------------------------------------------------------
59 > # PPP
60 > # For PPP support, emerge net-dialup/ppp
61 > # PPP is used for most dialup connections, including ADSL.
62 > # The older ADSL module is documented below, but you are encouraged to try
63 > # this module first.
64 > #
65 > # You need to create the PPP net script yourself. Make it like so
66 > #ln -s net.lo /etc/init.d/net.ppp0
67 > #
68 > # We have to instruct ppp0 to actually use ppp
69 > #config_ppp0=( "ppp" )
70 > #
71 > # Each PPP interface requires an interface to use as a "Link"
72 > #link_ppp0="/dev/ttyS0" # Most PPP links will use a serial
73 > port
74 > #link_ppp0="eth0" # PPPoE requires an ethernet
75 > interface
76 > #link_ppp0="[itf.]vpi.vci" # PPPoA requires the ATM VC's
77 > address
78 > #link_ppp0="/dev/null" # ISDN links should have this
79 > #link_ppp0="pty 'your_link_command'" # PPP links over ssh, rsh, etc
80 > #
81 > # Here you should specify what pppd plugins you want to use
82 > # Available plugins are: pppoe, pppoa, capi, dhcpc, minconn, radius,
83 > # radattr, radrealms and winbind
84 > #plugins_ppp0=(
85 > # "pppoe" # Required plugin for PPPoE
86 > # "pppoa vc-encaps" # Required plugin for PPPoA with
87 > an option
88 > # "capi" # Required plugin for ISDN
89 > #)
90 > #
91 > # PPP requires at least a username. You can optionally set a password
92 > here too
93 > # If you don't, then it will use the password specified in
94 > /etc/ppp/*-secrets
95 > # against the specified username
96 > #username_ppp0='user'
97 > #password_ppp0='password'
98 > # NOTE: You can set a blank password like so
99 > #password_ppp0=
100 > #
101 > # The PPP daemon has many options you can specify - although there are many
102 > # and may seem daunting, it is recommended that you read the pppd man page
103 > # before enabling any of them
104 > #pppd_ppp0=(
105 > # "maxfail 0" # WARNING: It's not recommended you use this
106 > # # if you don't specify maxfail then we assume 0
107 > # "updetach" # If not set, "/etc/init.d/net.ppp0 start" will
108 > return
109 > # # immediately, without waiting the link to come up
110 > # # for the first time.
111 > # # Do not use it for dial-on-demand links!
112 > # "debug" # Enables syslog debugging
113 > # "noauth" # Do not require the peer to authenticate itself
114 > # "defaultroute" # Make this PPP interface the default route
115 > # "usepeerdns" # Use the DNS settings provided by PPP
116 > #
117 > # On demand options
118 > # "demand" # Enable dial on demand
119 > # "idle 30" # Link goes down after 30 seconds of
120 > inactivity
121 > # "10.112.112.112:10.112.112.113" # Phony IP addresses
122 > # "ipcp-accept-remote" # Accept the peers idea of remote address
123 > # "ipcp-accept-local" # Accept the peers idea of local address
124 > # "holdoff 3" # Wait 3 seconds after link dies before re-starting
125 > #
126 > # Dead peer detection
127 > # "lcp-echo-interval 15" # Send a LCP echo every 15 seconds
128 > # "lcp-echo-failure 3" # Make peer dead after 3 consective
129 > # # echo-requests
130 > #
131 > # Compression options - use these to completely disable compression
132 > # noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp
133 > #
134 > # Dial-up settings
135 > # "lock" # Lock serial port
136 > # "115200" # Set the serial port baud rate
137 > # "modem crtscts" # Enable hardware flow control
138 > # "192.168.0.1:192.168.0.2" # Local and remote IP addresses
139 > #)
140 > #
141 > # Dial-up PPP users need to specify at least one telephone number
142 > #phone_number_ppp0=( "12345689" ) # Maximum 2 phone numbers are supported
143 > # They will also need a chat script - here's a good one
144 > #chat_ppp0=(
145 > # 'ABORT' 'BUSY'
146 > # 'ABORT' 'ERROR'
147 > # 'ABORT' 'NO ANSWER'
148 > # 'ABORT' 'NO CARRIER'
149 > # 'ABORT' 'NO DIALTONE'
150 > # 'ABORT' 'Invalid Login'
151 > # 'ABORT' 'Login incorrect'
152 > # 'TIMEOUT' '5'
153 > # '' 'ATZ'
154 > # 'OK' 'AT' # Put your modem initialization string here
155 > # 'OK' 'ATDT\T'
156 > # 'TIMEOUT' '60'
157 > # 'CONNECT' ''
158 > # 'TIMEOUT' '5'
159 > # '~--' ''
160 > #)
161 >
162 > # If the link require extra configuration - for example wireless or
163 > # RFC 268 bridge - we need to depend on the bridge so they get
164 > # configured correctly.
165 > #RC_NEED_ppp0="net.nas0"
166 >
167 > #WARNING: if MTU of the PPP interface is less than 1500 and you use this
168 > #machine as a router, you should add the following rule to your firewall
169 > #
170 > #iptables -I FORWARD 1 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS
171 > --clamp-mss-to-pmtu
172 >
173 >
174 > #-----------------------------------------------------------------------------
175 > # ADSL
176 > # For ADSL support, emerge net-dialup/rp-pppoe
177 > # WARNING: This ADSL module is being deprecated in favour of the PPP module
178 > # above.
179 > # You should make the following settings and also put your
180 > # username/password information in /etc/ppp/pap-secrets
181 >
182 > # Configure the interface to use ADSL
183 > #config_eth0=( "adsl" )
184 >
185 > # You probably won't need to edit /etc/ppp/pppoe.conf if you set this
186 > #adsl_user_eth0="my-adsl-username"
187 >
188 >
189 > #-----------------------------------------------------------------------------
190 > # ISDN
191 > # For ISDN support, emerge net-dialup/isdn4k-utils
192 > # You should make the following settings and also put your
193 > # username/password information in /etc/ppp/pap-secrets
194 >
195 > # Configure the interface to use ISDN
196 > #config_ippp0=( "dhcp" )
197 > # It's important to specify dhcp if you need it!
198 > #config_ippp0=( "192.168.0.1/24" )
199 > # Otherwise, you can use a static IP
200 >
201 > # NOTE: The interface name must be either ippp or isdn followed by a number
202 >
203 > # You may need this option to set the default route
204 > #ipppd_eth0="defaultroute"
205 >
206 >
207 > #-----------------------------------------------------------------------------
208 > # MAC changer
209 > # To set a specific MAC address
210 > #mac_eth0="00:11:22:33:44:55"
211 >
212 > # For changing MAC addresses using the below, emerge
213 > net-analyzer/macchanger
214 > # - to randomize the last 3 bytes only
215 > #mac_eth0="random-ending"
216 > # - to randomize between the same physical type of connection (e.g. fibre,
217 > # copper, wireless) , all vendors
218 > #mac_eth0="random-samekind"
219 > # - to randomize between any physical type of connection (e.g. fibre,
220 > copper,
221 > # wireless) , all vendors
222 > #mac_eth0="random-anykind"
223 > # - full randomization - WARNING: some MAC addresses generated by this
224 > may NOT
225 > # act as expected
226 > #mac_eth0="random-full"
227 > # custom - passes all parameters directly to net-analyzer/macchanger
228 > #mac_eth0="some custom set of parameters"
229 >
230 > # You can also set other options based on the MAC address of your
231 > network card
232 > # Handy if you use different docking stations with laptops
233 > #config_001122334455=( "dhcp" )
234 >
235 >
236 > #-----------------------------------------------------------------------------
237 > # TUN/TAP
238 > # For TUN/TAP support emerge net-misc/openvpn or
239 > sys-apps/usermode-utilities
240 > #
241 > # You must specify if we're a tun or tap device. Then you can give it any
242 > # name you like - such as vpn
243 > #tuntap_vpn="tun"
244 > #config_vpn=( "192.168.0.1/24")
245 >
246 > # Or stick wit the generic names - like tap0
247 > #tuntap_tap0="tap"
248 > #config_tap0=( "192.168.0.1/24")
249 >
250 > # For passing custom options to tunctl use something like the following.
251 > This
252 > # example sets the owner to adm
253 > #tunctl_tun1="-u adm"
254 > # When using openvpn, there are no options
255 >
256 >
257 > #-----------------------------------------------------------------------------
258 > # Bridging (802.1d)
259 > # For bridging support emerge net-misc/bridge-utils
260 >
261 > # To add ports to bridge br0
262 > #bridge_br0="eth0 eth1"
263 > # or dynamically add them when the interface comes up
264 > #bridge_add_eth0="br0"
265 > #bridge_add_eth1="br0"
266 >
267 > # You need to configure the ports to null values so dhcp does not get
268 > started
269 > #config_eth0=( "null" )
270 > #config_eth1=( "null" )
271 >
272 > # Finally give the bridge an address - dhcp or a static IP
273 > #config_br0=( "dhcp" ) # may not work when adding ports dynamically
274 > #config_br0=( "192.168.0.1/24" )
275 >
276 > # If any of the ports require extra configuration - for example wireless or
277 > # ppp devices - we need to depend on them like so.
278 > #RC_NEED_br0="net.eth0 net.eth1"
279 >
280 > # Below is an example of configuring the bridge
281 > # Consult "man brctl" for more details
282 > #brctl_br0=( "setfd 0" "sethello 0" "stp off" )
283 >
284 >
285 > #-----------------------------------------------------------------------------
286 > # RFC 2684 Bridge Support
287 > # For RFC 2684 bridge support emerge net-misc/br2684ctl
288 >
289 > # Interface names have to be of the form nas0, nas1, nas2, etc.
290 > # You have to specify a VPI and VCI for the interface like so
291 > #br2684ctl_nas0="-a 0.38" # UK VPI and VCI
292 >
293 > # You may want to configure the encapsulation method as well by adding
294 > the -e
295 > # option to the command above (may need to be before the -a command)
296 > # -e 0 # LLC (default)
297 > # -e 1 # VC mux
298 >
299 > # Then you can configure the interface as normal
300 > #config_nas0=( "192.168.0.1/24" )
301 >
302 >
303 > #-----------------------------------------------------------------------------
304 > # Tunnelling
305 > # WARNING: For tunnelling it is highly recommended that you
306 > # emerge sys-apps/iproute2
307 > #
308 > # For GRE tunnels
309 > #iptunnel_vpn0="mode gre remote 207.170.82.1 key 0xffffffff ttl 255"
310 >
311 > # For IPIP tunnels
312 > #iptunnel_vpn0="mode ipip remote 207.170.82.2 ttl 255"
313 >
314 > # To configure the interface
315 > #config_vpn0=( "192.168.0.2 pointopoint 192.168.1.2" ) # ifconfig style
316 > #config_vpn0=( "192.168.0.2 peer 192.168.1.1" ) # iproute2 style
317 >
318 > # 6to4 Tunnels allow IPv6 to work over IPv4 addresses, provided you
319 > # have a non-private address configured on an interface.
320 > # link_6to4="eth0" # Interface to base it's addresses on
321 > # config_6to4=( "ip6to4" )
322 > # You may want to depend on eth0 like so
323 > #RC_NEED_6to4="net.eth0"
324 > # To ensure that eth0 is configured before 6to4. Of course, the tunnel
325 > could be
326 > # any name and this also works for any configured interface.
327 > # NOTE: If you're not using iproute2 then your 6to4 tunnel has to be called
328 > # sit0 - otherwise use a different name like 6to4 in the example above.
329 >
330 >
331 >
332 > #-----------------------------------------------------------------------------
333 > # System
334 > # For configuring system specifics such as domain, dns, ntp and nis servers
335 > # It's rare that you would need todo this, but you can anyway.
336 > # This is most benefit to wireless users who don't use DHCP so they can
337 > change
338 > # their configs based on ESSID. See wireless.example for more details
339 >
340 > # To use dns settings such as these, dns_servers_eth0 must be set!
341 > # If you omit the _eth0 suffix, then it applies to all interfaces unless
342 > # overridden by the interface suffix.
343 > #dns_domain_eth0="your.domain"
344 > #dns_servers_eth0="192.168.0.2 192.168.0.3"
345 > #dns_search_eth0="this.domain that.domain"
346 > #dns_options_eth0=( "timeout 1" "rotate" )
347 > #dns_sortlist_eth0="130.155.160.0/255.255.240.0 130.155.0.0"
348 > # See the man page for resolv.conf for details about the options and
349 > sortlist
350 > # directives
351 >
352 > #ntp_servers_eth0="192.168.0.2 192.168.0.3"
353 >
354 > #nis_domain_eth0="domain"
355 > #nis_servers_eth0="192.168.0.2 192.168.0.3"
356 >
357 > # NOTE: Setting any of these will stamp on the files in question. So if you
358 > # don't specify dns_servers but you do specify dns_domain then no
359 > nameservers
360 > # will be listed in /etc/resolv.conf even if there were any there to start
361 > # with.
362 > # If this is an issue for you then maybe you should look into a resolv.conf
363 > # manager like resolvconf-gentoo to manage this file for you. All packages
364 > # that baselayout supports use resolvconf-gentoo if installed.
365 >
366 >
367 > #-----------------------------------------------------------------------------
368 > # Cable in/out detection
369 > # Sometimes the cable is in, others it's out. Obviously you don't want to
370 > # restart net.eth0 every time when you plug it in either.
371 > #
372 > # netplug is a package that detects this and requires no extra
373 > configuration
374 > # on your part.
375 > # emerge sys-apps/netplug
376 > # or
377 > # emerge sys-apps/ifplugd
378 > # and you're done :)
379 >
380 > # By default we don't wait for netplug/ifplugd to configure the interface.
381 > # If you would like it to wait so that other services now that network is
382 > up
383 > # then you can specify a timeout here.
384 > #plug_timeout="10"
385 > # A value of 0 means wait forever.
386 >
387 > # If you don't want to use netplug on a specific interface but you have it
388 > # installed, you can disable it for that interface via the modules
389 > statement
390 > #modules_eth0=( "!netplug" )
391 > # You can do the same for ifplugd
392 > #
393 > # You can disable them both with the generic plug
394 > #modules_eth0=( "!plug" )
395 >
396 > # To use specific ifplugd options, fex specifying wireless mode
397 > #ifplugd_eth0="--api-mode=wlan"
398 > # man ifplugd for more options
399 >
400 >
401 > ##############################################################################
402 > # ADVANCED CONFIGURATION
403 > #
404 > # Four functions can be defined which will be called surrounding the
405 > # start/stop operations. The functions are called with the interface
406 > # name first so that one function can control multiple adapters. An
407 > extra two
408 > # functions can be defined when an interface fails to start or stop.
409 > #
410 > # The return values for the preup and predown functions should be 0
411 > # (success) to indicate that configuration or deconfiguration of the
412 > # interface can continue. If preup returns a non-zero value, then
413 > # interface configuration will be aborted. If predown returns a
414 > # non-zero value, then the interface will not be allowed to continue
415 > # deconfiguration.
416 > #
417 > # The return values for the postup, postdown, failup and faildown
418 > functions are
419 > # ignored since there's nothing to do if they indicate failure.
420 > #
421 > # ${IFACE} is set to the interface being brought up/down
422 > # ${IFVAR} is ${IFACE} converted to variable name bash allows
423 >
424 > #preup() {
425 > # # Test for link on the interface prior to bringing it up. This
426 > # # only works on some network adapters and requires the mii-diag
427 > # # package to be installed.
428 > # if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then
429 > # ewarn "No link on ${IFACE}, aborting configuration"
430 > # return 1
431 > # fi
432 > #
433 > # # Test for link on the interface prior to bringing it up. This
434 > # # only works on some network adapters and requires the ethtool
435 > # # package to be installed.
436 > # if ethtool "${IFACE}" | grep -q 'Link detected: no'; then
437 > # ewarn "No link on ${IFACE}, aborting configuration"
438 > # return 1
439 > # fi
440 > #
441 > #
442 > # # Remember to return 0 on success
443 > # return 0
444 > #}
445 >
446 > #predown() {
447 > # # The default in the script is to test for NFS root and disallow
448 > # # downing interfaces in that case. Note that if you specify a
449 > # # predown() function you will override that logic. Here it is, in
450 > # # case you still want it...
451 > # if is_net_fs /; then
452 > # eerror "root filesystem is network mounted -- can't stop
453 > ${IFACE}"
454 > # return 1
455 > # fi
456 > #
457 > # # Remember to return 0 on success
458 > # return 0
459 > #}
460 >
461 > #postup() {
462 > # # This function could be used, for example, to register with a
463 > # # dynamic DNS service. Another possibility would be to
464 > # # send/receive mail once the interface is brought up.
465 >
466 > # # Here is an example that allows the use of iproute rules
467 > # # which have been configured using the rules_eth0 variable.
468 > # #rules_eth0=(
469 > # # "from 24.80.102.112/32 to 192.168.1.0/24 table localnet
470 > priority 100"
471 > # # "from 216.113.223.51/32 to 192.168.1.0/24 table localnet
472 > priority 100"
473 > # #)
474 > # local x="rules_${IFVAR}[@]"
475 > # local -a rules=( "${!x}" )
476 > # if [[ -n ${rules} ]] ; then
477 > # einfo "Adding IP policy routing rules"
478 > # eindent
479 > # # Ensure that the kernel supports policy routing
480 > # if ! ip rule list | grep -q "^" ; then
481 > # eerror "You need to enable IP Policy Routing
482 > (CONFIG_IP_MULTIPLE_TABLES)"
483 > # eerror "in your kernel to use ip rules"
484 > # else
485 > # for x in "${rules[@]}" ; do
486 > # ebegin "${x}"
487 > # ip rule add ${x}
488 > # eend $?
489 > # done
490 > # fi
491 > # eoutdent
492 > # # Flush the cache
493 > # ip route flush cache dev "${IFACE}"
494 > # fi
495 >
496 > #}
497 >
498 > #postdown() {
499 > # # Enable Wake-On-LAN for every interface except for lo
500 > # # Probably a good idea to set RC_DOWN_INTERFACE="no" in
501 > /etc/conf.d/rc
502 > # # as well ;)
503 > # [[ ${IFACE} != "lo" ]] && ethtool -s "${IFACE}" wol g
504 >
505 > # Automatically erase any ip rules created in the example postup
506 > above
507 > # if interface_exists "${IFACE}" ; then
508 > # # Remove any rules for this interface
509 > # local rule
510 > # ip rule list | grep " iif ${IFACE}[ ]*" | {
511 > # while read rule ; do
512 > # rule="${rule#*:}"
513 > # ip rule del ${rule}
514 > # done
515 > # }
516 > # # Flush the route cache
517 > # ip route flush cache dev "${IFACE}"
518 > # fi
519 >
520 > # # Return 0 always
521 > # return 0
522 > #}
523 >
524 > #failup() {
525 > # # This function is mostly here for completeness... I haven't
526 > # # thought of anything nifty to do with it yet ;-)
527 > #}
528 >
529 > #faildown() {
530 > # # This function is mostly here for completeness... I haven't
531 > # # thought of anything nifty to do with it yet ;-)
532 > #}
533 >
534 >
535 > ##############################################################################
536 > # FORCING MODULES
537 > # The Big Fat Warning :- If you use module forcing do not complain to us or
538 > # file bugs about it not working!
539 > #
540 > # Loading modules is a slow affair - we have to check each one for the
541 > following
542 > # 1) Code sanity
543 > # 2) Has the required package been emerged?
544 > # 3) Has it modified anything?
545 > # 4) Have all the dependant modules been loaded?
546 >
547 > # Then we have to strip out the conflicting modules based on user
548 > preference
549 > # and default configuration and sort them into the correct order.
550 > # Finally we check the end result for dependencies.
551 >
552 > # This, of course, takes valuable CPU time so we provide module forcing as
553 > a
554 > # means to speed things up. We still do *some* checking but not much.
555 >
556 > # It is essential that you force modules in the correct order and supply
557 > all
558 > # the modules you need. You must always supply an interface module - we
559 > # supply ifconfig or iproute2.
560 >
561 > # The Big Fat Warning :- If you use module forcing do not complain to us or
562 > # file bugs about it not working!
563 >
564 > # Now that we've warned you twice, here's how to do it
565 > #modules_force=( "ifconfig" )
566 > #modules_force=( "iproute2" "dhcpcd" )
567 >
568 > # We can also apply this to a specific interface
569 > #modules_force_eth1=( "iproute2" )
570 >
571 > # The below will not work
572 > #modules_force=( "dhcpcd" )
573 > # No interface (ifconfig/iproute2)
574 > #modules_force=( "ifconfig" "essidnet" "iwconfig" )
575 > # Although it will not crash, essidnet will not work as it has to come
576 > after
577 > # iwconfig
578 > #modules_force=( "iproute2" "ifconfig" )
579 > # The interface will be setup twice which will cause problems
580 >
581 >

Replies

Subject Author
Re: [gentoo-user-ru] net.example marlboro <retaw@××××××.ru>