Network Interface configuration file
[email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
type=ethernet #网卡类型
Device=eth0 #网卡接口名称
Onboot=yes #系统启动时是否自动加载
bootproto=static #启用地址协议--static: Static protocol--BOOTP Protocol--DHCP Protocol
ipaddr=192.168.1.11 #网卡IP地址
netmask=255.255.255.0 #网卡网络地址
gateway=192.168.1.1 #网卡网关地址
dns1=10.203.104.41 #网卡DNS地址
hwaddr=00:0c:29:13:5d:74 #网卡设备MAC地址
broadcast=192.168.1.255 #网卡广播地址
re-import the Ifcfg-eth0 network configuration file
[email protected] ~]#/etc/init.d/network Reload
shutting down interface eth0: [OK]
shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing Up interface eth0: [OK]
Nic interface shutdown and activation
[Email protected] ~]# ifdown eth0 #关闭网络
[Email protected]localhost ~]# ifup eth0 #启动网络
Network Service startup and shutdown
method One:
[[Email protected] ~]# service network stop #关闭网络服务
[email protected] ~]# service network start #启动网络服务
[email protected] ~]# service network restart #重启网络服务
Method Two:
[[email protected] ~]#/etc/init.d/network stop
[[email protected] ~]#/etc/init.d/network start
[email protected] ~]#/etc/init.d/network restart
Network card status query
[email protected] ~]# service network status
configured Devices:
Lo eth0
currently active devices:
Lo eth0
Temporary configuration of network card information without rebooting.
[email protected] ~]# ifconfig eth0 10.1.1.10 netmask 255.0.0.0
View NIC interface information, list all interfaces by default
[email protected] ~]# ifconfig
eth0 Link encap:ethernet HWaddr 00:0c:29:13:5d:74
inet addr:192.168.1.11 bcast:192.168.1.255 mask:255.255.255.0
Inet6 addr:fe80::20c:29ff:fe13:5d74/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:413 errors:0 dropped:0 overruns:0 frame:0
TX packets:572 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:47701 (46.5 KiB) TX bytes:64842 (63.3 KiB)
Base address:0x2000 memory:d8920000-d8940000
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:407 errors:0 dropped:0 overruns:0 frame:0
TX packets:407 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:70759 (69.1 KiB) TX bytes:70759 (69.1 KiB)
view current Routing and gateway information
[email protected] ~]# netstat-r
Kernel IP Routing table
Destination Gateway genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Dns:
Host Name: CentOS
Main dns:202.106.46.151
Second dns:202.106.0.20
Third dns:8.8.8.8
network configuration:
subnet mask 255.255.255.0
default gateway IP 192.168.1.1
Device=eth0
ipaddr=192.168.1.106
netmask=255.255.255.0
broadcast=192.168.1.255
Onboot=yes
Bootproto=none
gateway=192.168.1.1
Type=ethernet
"/etc/sysconfig/network-scripts/ifcfg-eth0" 11L, 187C
Linux under Ifcfg-eth0 Configuration