Version 13 (modified by mitty, 15 years ago) (diff) |
---|
NIC alias
- 一つの物理NICに複数のIPを割り当てる
CentOS
設定
- /etc/sysconfig/network-scripts/
- ifcfg-eth?:? を作る
- 書式は通常の ifcfg-eth? と同じ
- 例
- dhcp (後述)
DEVICE=eth0:0 BOOTPROTO=dhcp ONBOOT=yes DHCP_HOSTNAME=centos5-test
- static
DEVICE=eth0:0 BOOTPROTO=static IPADDR=192.168.40.250 NETMASK=255.255.255.0 GATEWAY=192.168.40.2 ONBOOT=yes DHCP_HOSTNAME=centos5-test
- dhcp (後述)
- ifconfig (static)
eth0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX inet addr:192.168.40.141 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:102642 errors:0 dropped:0 overruns:0 frame:0 TX packets:1738 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11384683 (10.8 MiB) TX bytes:234313 (228.8 KiB) Interrupt:59 Base address:0x2000 eth0:0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX inet addr:192.168.40.250 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:59 Base address:0x2000
dhcpについて
- 以下の問題は、BOOTPROTO=static の際には発生しない模様
- ifup eth0:0 でエラーが出る
Determining IP information for eth0:0...SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address done.
- IP自体は正常にassignされる
- ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX inet addr:192.168.40.141 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:102862 errors:0 dropped:0 overruns:0 frame:0 TX packets:1939 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11403063 (10.8 MiB) TX bytes:260163 (254.0 KiB) Interrupt:59 Base address:0x2000 eth0:0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX inet addr:192.168.40.142 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:59 Base address:0x2000
- ifconfig
- boot時のエラー
- IPもassignされず
- fconfig eth0:0
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:59 Base address:0x2000
- fconfig eth0:0
- ifup eth0:0
Determining IP information for eth0:0...SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCGIFADDR: Cannot assign requested address SIOCSIFBROADCAST: Cannot assign requested address SIOCSIFBRDADDR: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address done.
- assignされず
- ifup eth0:0
Determining IP information for eth0:0...SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address done.
- assignされた
- ifconfig eth0:0
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX inet addr:192.168.40.141 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:59 Base address:0x2000
- ifconfig eth0:0
- assignされた
- assignされたりされなかったりするため、不安定
Ubuntu
設定
- 全て /etc/network/interfaces に記述
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp
- 例
- dhcp (後述)
auto eth0:0 iface eth0:0 inet dhcp
- static
auto eth0:0 iface eth0:0 inet static address 192.168.40.250 netmask 255.255.255.0 gateway 192.168.40.2
- dhcp (後述)
- ifconfig (static)
eth0 Link encap:Ethernet HWaddr 00:0c:29:YY:YY:YY inet addr:192.168.40.144 Bcast:192.168.40.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:feb1:838a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1051 errors:0 dropped:0 overruns:0 frame:0 TX packets:877 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:94083 (91.8 KB) TX bytes:113925 (111.2 KB) Interrupt:17 Base address:0x2000 eth0:0 Link encap:Ethernet HWaddr 00:0c:29:YY:YY:YY inet addr:192.168.40.250 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:17 Base address:0x2000
static時の問題
- /etc/network/interfaces
auto eth0:0 iface eth0:0 inet static address 192.168.40.250 netmask 255.255.255.0 gateway 192.168.40.2
- sudo ifup eth0:0
SIOCSIFFLAGS: Cannot assign requested address
- 実際には正常にassign
- ifconfig eth0:0
eth0:0 Link encap:Ethernet HWaddr 00:0c:29:YY:YY:YY inet addr:192.168.40.250 Bcast:192.168.40.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:17 Base address:0x2000
- rebootしても正常にassignされている
- ifconfig eth0:0
- wireless-tools のバグ?
対応
- sudo chmod -x /etc/network/if-pre-up.d/wireless-tools
- sudo aptitude -R remove wireless-tools (依存関係に問題があり非推奨?)
The following packages are BROKEN: ubuntu-minimal The following packages will be REMOVED: wireless-tools 0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Need to get 0B of archives. After unpacking 352kB will be freed. The following packages have unmet dependencies: ubuntu-minimal: Depends: wireless-tools but it is not installable Resolving dependencies... The following actions will resolve these dependencies: Remove the following packages: ubuntu-minimal Score is 115 Accept this solution? [Y/n/q/?]
dhcp時の問題
- CentOSと同様、dhcp時に問題が起きる
- sudo /etc/init.d/networking restart
* Reconfiguring network interfaces... There is already a pid file /var/run/dhclient.eth0.pid with pid 4361 killed old client process, removed PID file Internet Systems Consortium DHCP Client V3.0.6 Copyright 2004-2007 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ Listening on LPF/eth0/00:0c:29:YY:YY:YY Sending on LPF/eth0/00:0c:29:YY:YY:YY Sending on Socket/fallback There is already a pid file /var/run/dhclient.eth0.pid with pid 134519072 Internet Systems Consortium DHCP Client V3.0.6 Copyright 2004-2007 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ Listening on LPF/eth0/00:0c:29:YY:YY:YY Sending on LPF/eth0/00:0c:29:YY:YY:YY Sending on Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4 DHCPOFFER of 192.168.40.144 from 192.168.40.254 DHCPREQUEST of 192.168.40.144 on eth0 to 255.255.255.255 port 67 DHCPACK of 192.168.40.144 from 192.168.40.254 bound to 192.168.40.144 -- renewal in 855 seconds. SIOCSIFFLAGS: Cannot assign requested address Internet Systems Consortium DHCP Client V3.0.6 Copyright 2004-2007 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address Bind socket to interface: No such device Failed to bring up eth0:0. [ OK ]
- sudo ifup eth0:0
SIOCSIFFLAGS: Cannot assign requested address There is already a pid file /var/run/dhclient.eth0:0.pid with pid 134519072 Internet Systems Consortium DHCP Client V3.0.6 Copyright 2004-2007 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ SIOCSIFFLAGS: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address Bind socket to interface: No such device Failed to bring up eth0:0.
- boot時は特にエラー表示はないが、assignされない
対応
- dhcp3-clientの代わりにdhcpcdを入れる対策はHardyでは効果なし
- https://bugs.launchpad.net/ubuntu/+source/dhcp3/+bug/351378/comments/12
- install dhcp3-client dummy package => attachment:dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb
- sudo dpkg -i dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb
(Reading database ... 15336 files and directories currently installed.) Preparing to replace dhcp3-client 3.0.6.dfsg-1ubuntu9 (using dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb) ... Unpacking replacement dhcp3-client ... dpkg: warning - unable to delete old directory `/var/lib/dhcp3': Directory not empty dpkg: warning - unable to delete old directory `/etc/dhcp3/dhclient-enter-hooks.d': Directory not empty Setting up dhcp3-client (3.0.6.dfsg-1ubuntu9) ...
- sudo dpkg -i dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb
- hold dhcp3-client dummy package
- sudo aptitude hold dhcp3-client
The following packages have been kept back: dhcp3-client 0 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
- sudo aptitude hold dhcp3-client
- install udhcpc package
- sudo aptitude install -R udhcpc
- add alias to /etc/network/interfaces
- hostname, client-id は必須なのか不明。無くても手元では動作した
auto eth0 iface eth0 inet dhcp auto eth0:0 iface eth0:0 inet dhcp
- hostname, client-id は必須なのか不明。無くても手元では動作した
- restart NICs
- sudo /etc/init.d/networking restart
* Reconfiguring network interfaces... udhcpc (v0.9.9-pre) started Sending discover... Sending select for 192.168.40.146... Lease of 192.168.40.146 obtained, lease time 1800 Resetting default routes adding dns 192.168.40.2 SIOCSIFFLAGS: Cannot assign requested address udhcpc (v0.9.9-pre) started SIOCSIFFLAGS: Cannot assign requested address Sending discover... Sending select for 192.168.40.144... Lease of 192.168.40.144 obtained, lease time 1800 Resetting default routes adding dns 192.168.40.2 [ OK ]
- sudo /etc/init.d/networking restart
- boot時はaliasはassignされない
- attachment:hardy-udhcpc.png
- assignされているのはeth0のみ
- login後に sudo /etc/init.d/networking restart するとassignされる
- rcS.dあたりで対応する必要がある? (未検証)
- attachment:hardy-udhcpc.png
- install dhcp3-client dummy package => attachment:dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb
Attachments (3)
- centos-alias.png (3.2 KB) - added by mitty 15 years ago.
-
dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb
(2.2 KB) -
added by mitty 15 years ago.
copy from http://launchpadlibrarian.net/25005944/dhcp3-client-dummy_3.0.6.dfsg-1ubuntu9_i386.deb
- hardy-udhcpc.png (11.7 KB) - added by mitty 15 years ago.
Download all attachments as: .zip