Chinaunix

标题: VMWare NAT方式下guest机器无法设置固定IP [打印本页]

作者: ColdDew    时间: 2009-06-23 17:13
标题: VMWare NAT方式下guest机器无法设置固定IP
VMWare 安装RH5.1, 连网方式为NAT,装完后想使用固定IP来配置guest机器,修改/etc/sysconfig/network-scripts/ifcfg-eth0,内容如下


  1. # Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
  2. DEVICE=eth0
  3. BOOTPROTO=static
  4. HWADDR=00:0C:29:CA:B5:7D
  5. IPADDR=192.168.37.136
  6. NETMASK=255.255.255.0
  7. NETWORK=192.168.37.0
  8. BROADCAST=192.168.37.255
  9. GATEWAY=192.168.37.2
  10. IPV6ADDR=
  11. IPV6PREFIX=
  12. IPV6_AUTOCONF=yes
  13. ONBOOT=yes
复制代码



重启后,显示的ip仍然是dhcp获得的,哪位知道原因?
eth0      Link encap:Ethernet  HWaddr 00:0C:29:B4:E3:13  
          inet addr:192.168.37.129  Bcast:192.168.37.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb4:e313/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2007 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1835 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1735255 (1.6 MiB)  TX bytes:225549 (220.2 KiB)
作者: ColdDew    时间: 2009-06-23 17:18
试了下

# ifdown eth0

  1. Device eth0 has MAC address 00:0C:29:B4:E3:13, instead of configured address 00:0C:29:CA:B5:7D. Ignoring.
复制代码



和这个有关么?网络知识好菜啊,这些方面的配置从来都是晕晕乎乎。。。
作者: ssffzz1    时间: 2009-06-23 17:43
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:CA:B5:7D
IPADDR=192.168.37.136
NETMASK=255.255.255.0
NETWORK=192.168.37.0
BROADCAST=192.168.37.255
GATEWAY=192.168.37.2
IPV6ADDR=
IPV6PREFIX=
IPV6_AUTOCONF=yes
ONBOOT=yes

重启后,显示的ip仍然是dhcp获得的,哪位知道原因?
eth0      Link encap:Ethernet  HWaddr 00:0C:29:B4:E3:13  
          inet addr:192.168.37.129  Bcast:192.168.37.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb4:e313/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2007 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1835 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1735255 (1.6 MiB)  TX bytes:225549 (220.2 KiB)


HWADDR=  修改一下这个试试再说吧。
作者: ColdDew    时间: 2009-06-23 17:49
原帖由 ssffzz1 于 2009-6-23 17:43 发表
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:CA:B5:7D
IPADDR=192.168.37.136
NETMASK=255.255.255.0
NETWORK=192.168.37.0
BROADCAST=192.1 ...



还是版主厉害啊。。。一眼就看出了毛病。


我也是,明明自己都贴出来了,都发现不了。。。找地洞钻去。。。
作者: ColdDew    时间: 2009-06-23 17:59
重启试了吧,好像还是不太行,一定要ifdown/ifup后才能生效

为什么重启后没有立即生效呢?


  1. [root@rhel51_ ~]# ifconfig eth0
  2. eth0      Link encap:Ethernet  HWaddr 00:0C:29:B4:E3:13  
  3.           inet addr:192.168.37.[b]129[/b]  Bcast:192.168.37.255  Mask:255.255.255.0
  4.           inet6 addr: fe80::20c:29ff:feb4:e313/64 Scope:Link
  5.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  6.           RX packets:69 errors:0 dropped:0 overruns:0 frame:0
  7.           TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
  8.           collisions:0 txqueuelen:0
  9.           RX bytes:10435 (10.1 KiB)  TX bytes:12467 (12.1 KiB)

  10. [root@rhel51_ ~]# ifdown eth0
  11. [root@rhel51_ ~]# ifup eth0
  12. [root@rhel51_ ~]# ifconfig eth0
  13. eth0      Link encap:Ethernet  HWaddr 00:0C:29:B4:E3:13  
  14.           inet addr:192.168.37.[b]136[/b]  Bcast:192.168.37.255  Mask:255.255.255.0
  15.           inet6 addr: fe80::20c:29ff:feb4:e313/64 Scope:Link
  16.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  17.           RX packets:12 errors:0 dropped:0 overruns:0 frame:0
  18.           TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
  19.           collisions:0 txqueuelen:0
  20.           RX bytes:3459 (3.3 KiB)  TX bytes:8196 (8.0 KiB)

  21. [root@rhel51_ ~]#

复制代码

作者: ssffzz1    时间: 2009-06-24 07:58
哦。这样啊。

帖/etc/rc.local 还有你是用LEVEL 3还是5 启动的。
作者: ColdDew    时间: 2009-06-24 09:16
原帖由 ssffzz1 于 2009-6-24 07:58 发表
哦。这样啊。

帖/etc/rc.local 还有你是用LEVEL 3还是5 启动的。


  1. [root@rhel51_ ~]# cat /etc/rc.local
  2. #!/bin/sh
  3. #
  4. # This script will be executed *after* all the other init scripts.
  5. # You can put your own initialization stuff in here if you don't
  6. # want to do the full Sys V style init stuff.

  7. touch /var/lock/subsys/local
  8. [root@rhel51_ ~]# runlevel
  9. N 5
复制代码


版主很早啊~~~
作者: ColdDew    时间: 2009-06-24 11:00
在贴下rc5的内容

  1. [root@rhel51_ rc5.d]# ls /etc/rc.d/rc5.d/
  2. K01dnsmasq                   K35vncserver   K87multipathd       S05kudzu        S13mcstrans        S25netfs   S80sendmail         S98avahi-daemon
  3. K02avahi-dnsconfd            K35winbind     K88wpa_supplicant   S06cpuspeed     S13portmap         S25pcscd   S85gpm              S98haldaemon
  4. K02dhcdbd                    K50netconsole  K89dund             S08ip6tables    S13setroubleshoot  S26apmd    S90crond            S98xend
  5. K02NetworkManager            K69rpcsvcgssd  K89netplugd         S08iptables     S14nfslock         S26hidd    S90xfs              S99firstboot
  6. K02NetworkManagerDispatcher  K73ypbind      K89pand             S09isdn         S15mdmonitor       S28autofs  S95anacron          S99local
  7. K05conman                    K74nscd        K89rdisc            S10network      S18rpcidmapd       S44acpid   S95atd              S99smartd
  8. K05saslauthd                 K74ntpd        K91capi             S11auditd       S19rpcgssd         S50hplip   S96readahead_later  S99xendomains
  9. K10psacct                    K80kdump       S00microcode_ctl    S12restorecond  S19vmware-tools    S55sshd    S97libvirtd
  10. K20nfs                       K85mdmpd       S02lvm2-monitor     S12syslog       S22messagebus      S56cups    S97rhnsd
  11. K24irda                      K87ipmi        S04readahead_early  S13irqbalance   S25bluetooth       S56xinetd  S97yum-updatesd
复制代码



和K02dhcdbd 有关系么?
作者: ssffzz1    时间: 2009-06-24 21:10
应该没关系。

帖/etc/init.d/network restart 命令的所有输出。怀疑有IP地址冲突之类的现象。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2