我设置的网卡启动IP是192.168.1.241,可是启动时却通过DHCP服务器获取了192.168.1.104这个地址。研究了半天ifcfg-eth0这个文件,不得要领。
看一下系统启动信息:
[root@mm iptables-1.4.0]# tail -n 58 /var/log/messages
Oct 29 08:13:33 mm kernel: eth0: link up
Oct 29 08:13:37 mm dhcdbd: Started up.
Oct 29 08:13:37 mm NetworkManager: starting...
Oct 29 08:13:37 mm netplugd[2541]: Netlink packet came from pid 2922, not from kernel
Oct 29 08:13:37 mm NetworkManager: nm_system_device_get_system_config (): Network configuration for device 'eth0' was invalid (non-DHCP configuration, but no gateway specified.Will use DHCP instead.
Oct 29 08:13:37 mm NetworkManager: eth0: Device is fully-supported using driver 'pcnet32'.
Oct 29 08:13:37 mm NetworkManager: nm_device_init(): waiting for device's worker thread to start
Oct 29 08:13:37 mm NetworkManager: nm_device_init(): device's worker thread started, continuing.
Oct 29 08:13:37 mm NetworkManager: Now managing wired Ethernet (802.3) device 'eth0'.
Oct 29 08:13:37 mm NetworkManager: Deactivating device eth0.
Oct 29 08:13:38 mm dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.reason
Oct 29 08:13:38 mm NetworkManager: Will activate wired connection 'eth0' because it now has a link.
Oct 29 08:13:38 mm NetworkManager: SWITCH: no current connection, found better connection 'eth0'.
Oct 29 08:13:38 mm dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.reason
Oct 29 08:13:38 mm NetworkManager: Will activate connection 'eth0'.
Oct 29 08:13:38 mm NetworkManager: Device eth0 activation scheduled...
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) started...
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Oct 29 08:13:38 mm NetworkManager: Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Oct 29 08:13:39 mm NetworkManager: Activation (eth0) Beginning DHCP transaction.
Oct 29 08:13:39 mm NetworkManager: Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
Oct 29 08:13:39 mm NetworkManager: DHCP daemon state is now 12 (successfully started) for interface eth0
Oct 29 08:13:39 mm NetworkManager: DHCP daemon state is now 1 (starting) for interface eth0
Oct 29 08:13:39 mm dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
Oct 29 08:13:47 mm dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 20
Oct 29 08:13:47 mm dhclient: DHCPOFFER from 192.168.1.1
Oct 29 08:13:47 mm dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Oct 29 08:13:47 mm dhclient: DHCPACK from 192.168.1.1
Oct 29 08:13:47 mm NetworkManager: DHCP daemon state is now 2 (bound) for interface eth0
Oct 29 08:13:47 mm NetworkManager: Activation (eth0) Stage 4 of 5 (IP Configure Get) scheduled...
Oct 29 08:13:47 mm NetworkManager: Activation (eth0) Stage 4 of 5 (IP Configure Get) started...
Oct 29 08:13:47 mm dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.host_name
Oct 29 08:13:47 mm dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.nis_domain
Oct 29 08:13:47 mm dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.nis_servers
Oct 29 08:13:47 mm NetworkManager: Retrieved the following IP4 configuration from the DHCP daemon:
Oct 29 08:13:47 mm NetworkManager: address 192.168.1.104
Oct 29 08:13:47 mm NetworkManager: netmask 255.255.255.0
Oct 29 08:13:47 mm NetworkManager: broadcast 192.168.1.255
Oct 29 08:13:47 mm NetworkManager: gateway 192.168.1.1
Oct 29 08:13:47 mm NetworkManager: nameserver 202.101.172.35
Oct 29 08:13:47 mm NetworkManager: nameserver 202.101.172.47
Oct 29 08:13:47 mm NetworkManager: domain name 'domain'
Oct 29 08:13:47 mm NetworkManager: Activation (eth0) Stage 5 of 5 (IP Configure Commit) scheduled...
Oct 29 08:13:47 mm NetworkManager: Activation (eth0) Stage 4 of 5 (IP Configure Get) complete.
Oct 29 08:13:47 mm NetworkManager: Activation (eth0) Stage 5 of 5 (IP Configure Commit) started...
Oct 29 08:13:47 mm dhclient: bound to 192.168.1.104 -- renewal in 3260 seconds.
Oct 29 08:13:48 mm NetworkManager: Activation (eth0) successful, device activated.
Oct 29 08:13:48 mm NetworkManager: Activation (eth0) Finish handler scheduled.
Oct 29 08:13:48 mm NetworkManager: Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete.
Oct 29 08:21:41 mm kernel: warning: process `system-config-n' used the deprecated sysctl system call with 1.23.
Oct 29 08:23:08 mm kernel: warning: process `system-config-n' used the deprecated sysctl system call with 1.23.
[root@mm iptables-1.4.0]#
原来错误出在“Network configuration for device 'eth0' was invalid (non-DHCP configuration, but no gateway specified.Will use DHCP instead.”因为ifcfg-eth0文件中没有网关信息。
编辑ifcfg-eth0文件,加入一行“GATEWAY=192.168.1.1”,保存后退出,再看一眼现在的配置: