èµ·åæã«resolv.confãä½è ãã«ä¸æ¸ããããæã«æ´ã«ä¸æ¸ããããæ¦ã
ã¿ããªããããã®ã¯ã©ããã対å¿ãã¦ãããã ãã
@kenjiskywalker PEERDNS=noã/etc/sysconfig/network-scripts/ifcfg-ethXã«æ¸ãã¨ã
— TSUNEMATSU Shinya (@tnmt) February 7, 2015
常æ¾å
çãä¸ç¬ã§è§£æ±ºæ¹æ³ãæãã¦ããã¾ããã
ãããã¨ããããã¾ãï¼
resolv.confãå§åçæ´åã«ãã£ã¦ä¸æ¸ããããå ´å
対å¿ã¨ãã¦resolv-update
ã¿ãããªéãªãµã¼ãã¹å®ç¾©ããã¦ããµã¼ãèµ·åæã«å®è¡ãããããã«ããã
ãã¤ã³ãã¯cloud-initã¨ãããç³»ã®ã¤ããå®è¡ãããåã«ä¸æ¸ãã¦ããã®å¾ã«ä¸æ¸ããããã®ã§ã¿ã¤ãã³ã°ã大åã
ããã®
# chkconfig: 2345 49 49
49 49
ã®æåã®æ°åãèµ·åæã«å®è¡ãããé çªã§ãå¾ãã®æ°åãçµäºæã«å®è¡ãããé çªã
$ chkconfig --add resolv-update
ã¨ãããã¨ã§èªåã«å®è¡ãããããã«ãªãã
runlevel 3ã®ãã®ã確èªããããã°/etc/rc3.d/
ã¨ãè¦ãã°ãããã
#!/bin/sh # # resolv-update # create by kenjiskywalker # # chkconfig: 2345 49 49 # lock_file="/var/lock/subsys/resolv-update" redis_port="6379" start() { # lock_fileãçæããªãã¨shutdownã®æã«å®è¡ãããªã touch ${lock_file} # å§åçæ´åã«ãã£ã¦resolv.confãä¸æ¸ãããã¦ãããæ´ã«ä¸æ¸ããã if [[ -z "`grep 'nameserver 127.0.0.1' /etc/resolv.conf`" ]] then sed -i '1s/^/nameserver 127.0.0.1\n/' /etc/resolv.conf fi } stop() { # lock_fileã®åé¤ rm -r ${lock_file} } case "$1" in start) start ;; stop) stop ;; *) echo "Usage: $0 {start|stop}" ;; esac exit 0
Systemdï¼ã¯ã¦ï¼