##查询IP和子网掩码
[root@pfzhang3 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:33:2B:D8
inet addr:
192.168.0.102 Bcast:192.168.0.255 Mask:
255.255.255.0
inet6 addr: fe80::20c:29ff:fe33:2bd8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:335 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:45418 (44.3 KiB) TX bytes:15915 (15.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2448 (2.3 KiB) TX bytes:2448 (2.3 KiB)
pan0 Link encap:Ethernet HWaddr 1A:36:CD:39:B5:A1
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
##查询默认网关
[root@pfzhang3 ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0
192.168.0.1 0.0.0.0 UG 0 0 0 eth0
[root@pfzhang3 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0
192.168.0.1 0.0.0.0 UG 0 0 0 eth0
##查询DNS
[root@pfzhang3 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver
61.132.163.68
nameserver
202.102.213.68
##配置网卡参数
[root@pfzhang3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:33:2B:D8
TYPE=Ethernet
UUID=a4a40b33-4da4-4cfd-aaa0-2cd60bb2329c
ONBOOT=
yes
NM_CONTROLLED=yes
BOOTPROTO=
static
IPADDR=192.168.0.102 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 DNS1=61.132.163.68 DNS2=202.102.213.68 ##重启网卡服务 [root@pfzhang3 ~]# service network restart Shutting down interface eth0: Device state: 3 (disconnected) [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Active connection state: activated Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2 [ OK ]