[email protected] ~]# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
device=eth0# NIC device name
onboot=yes# Activate Yes at startup | no
bootproto=static# protocol type DHCP BOOTP none
ipaddr=192.168.1.90# Network IP address
netmask=255.255.255.0# Network Subnet address
gateway=192.168.1.1# Gateway address
broadcast=192.168.1.255# Broadcast Address
hwaddr=00:0c:29:fe:1a:09# network card MAC address
type=ethernet# network card type is Ethernet
Note: You will need to re-import the file after you modify the file Ifcfg-ethx to take effect, the following commands:
[[Email protected]
~]#/etc/init.d/network Reload #命令有start | Restart | Stop | Reload
Example:
1. Temporary:
Ifconfig eth0 172.16.12.244 netmask 255.255.255.0
IP route add default via 172.16.12.1
2.centos Manual:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device= "Eth1"
bootproto= "Static"
Nm_controlled= "Yes"
onboot= "Yes"
Type= "Ethernet"
Ipaddr= "172.16.12.218"
netmask= "255.255.255.0"
Gateway= "172.16.12.1"
dns1= "172.16.12.1"
Dns2= "114.114.114.114"
3 UBUNTU Handmade
Auto Eth0
Iface eth0 inet Static
Address 172.16.12.215
Netmask 255.255.255.0
Network 172.16.12.0
Broadcast 172.16.12.255
Gateway 172.16.12.1
Dns-nameservers 172.16.12.101 8.8.8.8
Up Route add-net 172.16.1.0 netmask 255.255.255.0 GW 172.16.*.*
Note 1-/etc/sysconfig/network-scripts/ifcfg-eth0 file