Linux configuration IP address method;
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Ipaddr= "192.168.x.x"
Netmask= "255.255.255.0″
Gateway= "192.168.x.x"
Vi/etc/resolv.conf
NameServer 8.8.8.8
Service Network restart
It feels a little bit messy, I'll rearrange it now.
The process of organizing the configuration is as follows:
Configuration steps:
1, run ifconfig add a ip:192.168.10.22
Command format:: Ifconfig+eth0:x + ip+netmask (subnet mask)
Ifconfig eth0:0 192.168.10.22 netmask 255.255.255.0
Note: If you want to add more, X plus 1 is OK, can support up to 255!
2, in the #cet/sysconfig/network-scripts directory to establish a corresponding eth0:0 directory and the corresponding, and modify the relevant data can!
Here we can use the CP command to do this operation
CP Ifcfg-eth0 ifcfg-eth0:0
Modify the device name, and IP corresponding! Here is a change I have a profile, you can refer to the red for the modified part!
device=eth0:0
Bootproto=static
broadcast=192.168.1.255
Hwaddr=00:00:12:62:45:16
ipaddr=192.168.1.22
netmask=255.255.255.0
network=192.168.1.0
Onboot=yes
Type=ethernet
3. Re-entry into force
Add the way the gateway operates
Modify the default gateway
Immediate effect:
Route add default GW 192.168.1.1
Start in effect:
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Join
gateway=192.168.1.1
gateway=192.168.1.1
The final results are as follows:
Device=eth0
Bootproto=static
ipaddr=192.168.1.102
netmask=255.255.255.0
geteway=192.168.1.1
Onboot=yes
Type=ethernet