/etc/rc.d配下とかのリーディング勉強会

982 views
852 views

Published on

at http://atnd.org/events/22445
2011/12/09

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
982
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • /etc/rc.d配下とかのリーディング勉強会

    1. 1. /etc/rc.d #1 2011/12/09 Naoya NAKAZAWA @n0ts
    2. 2. Agenda• Scientific Linux release 6.1 (Carbon) • /etc/rc.d/init.d/network • /etc/sysconfig/network • /etc/sysconfig/network-scripts/ifcfg-* • /etc/sysconfig/network-scripts/if[up|down] • /etc/sysconfig/network-scripts/network- functions
    3. 3. Usage: network# /etc/rc.d/init.d/networkUsage: /etc/rc.d/init.d/network {start|stop|status|restart|reload|force-reload}# /etc/rc.d/init.d/network statusConfigured devices:lo eth0Currently active devices:lo eth0
    4. 4. network% wc -l /etc/rc.d/init.d/network243
    5. 5. line 1-8• • network: /• chkconfig: 2345 10 90 • : 2345 • S • K
    6. 6. line 9-149 ### BEGIN INIT INFO10 # Provides: $network11 # Should-Start: iptables ip6tables12 # Short-Description: Bring up/down networking13 # Description: Bring up/down networking14 ### END INIT INFOShould-Start iptables ip6tablesShould-Start network iptables ip6tables
    7. 7. line 16-18• /etc/init.d/functions • @do_aki
    8. 8. line 23. /etc/sysconfig/networkNETWORKING=yesHOSTNAME=<hostname>
    9. 9. line 30-34• NETWORKING no 6• /sbin/ip 1
    10. 10. line 35-391. /etc/sysconfig/network-scripts2. /etc/sysconfig/network-scripts/network- functions
    11. 11. line 41-491. /etc/sysconfig/network-scripts/ifcfg-*2. rc 0
    12. 12. line 50-241• start|stop|status|restart|reload|force-reload• 2 rc
    13. 13. start1. IPv6 /etc/sysconfig/network-scripts/init.ipv6-global start pre2. sysctl -e -p /etc/sysctl.conf3.4.5. /etc/sysconfig/static-routes /sbin/route add -< >6. IPv6 /etc/sysconfig/network-scripts/init.ipv6-global start post7. sysctl -e -p /etc/sysctl.conf8. /var/lock/subsys/network
    14. 14. bring up all other interfacesconfigured to come up at boot time1. TYPE xDSL,Bridge SLAVE yes2. /etc/sysconfig/network-scripts/ ifcfg-< > ONBOOT [Nn][Oo]3. /etc/sysconfig/network-scripts/ifup < > boot
    15. 15. /etc/sysconfig/network-scripts/ifup1. /etc/init.d/functions2. /etc/sysconfig/network-scripts3. network-fucntions4. Ethernet 802.1Q VLAN5. /sbin/ifup-pre-local6. /etc/sysconfig/network-scripts/ifup-eth /etc/sysconfig/network-scripts/ifup-eth
    16. 16. Sample /sbin/ifup-local• LVS DSR /sbin/ifup-local #!/bin/sh DEVICE="$1" case "$DEVICE" in lo) /sbin/ip rule add prio 100 fwmark 1 table 100 /sbin/ip route add local 0/0 dev lo table 100 ;; esac
    17. 17. stop1. nfs/smbfs/ncpfs netfs2. /etc/sysconfig/network-scripts/ifdown < > boot3.4. sysctl -w net.ipv4.ip_forward=05. /var/lock/subsys/network
    18. 18. /etc/sysconfig/network-scripts/ifdown1. /etc/init.d/functions2. /etc/sysconfig/network-scripts3. network-fucntions4. Ethernet 802.1Q VLAN5. /sbin/ifdown-pre-local6. /etc/sysconfig/network-scripts/ifdown-eth /etc/sysconfig/network-scripts/ifdown- eth
    19. 19. Sample /sbin/ifdown-local• LVS DSR /sbin/ifown-local #!/bin/sh DEVICE="$1" case "$DEVICE" in lo) /sbin/ip rule del prio 100 fwmark 1 table 100 /sbin/ip route del local 0/0 dev lo table 100 ;; esac
    20. 20. status1. /sbin/ip -o link show up
    21. 21. restart|reload|force-reload1. /etc/rc.d/init.d/network stop2. /etc/rc.d/init.d/network start
    22. 22. /etc/sysconfig/network-scripts/network- functions• • get_hwaddr: MAC • get_config_by_[device|hwaddr|subchannel|name]: ifcfg-* • get_device_by_hwaddr: MAC • get_uuid_by_config: UUID • [need|source|expand]_config: • toggle_value: yes or YES on no or NO off • do_netreport: /var/run/netreport • is_nm_[running|active|device_unmanaged]: • is_available: • need_hostname: • set_hostname: • check_[device_down|ethtool|link_down|default_route]: • find_gateway_dev: • add_default_route: GATEWAY /etc/default-routes •
    23. 23. Thanks!

    ×