Address: http://hi.baidu.com/xolee/blog/item/a6455234007c3d2b5ab5f503.html
Ifconfig eth0 102.160.1 netmask 255.255.255.0
----------------------------------------------------------------------
Change gateway to 102.160.254
Route add default GW 102.160.254
----------------------------------------------------------------------
Modify DNS
Echo "nameserver 202.202.202.20">/etc/resolv. conf
-----------------------------------------------------------------------
Restart NETWORK SERVICE
/Etc/rc. d/init. d/network restrart
------------------------------------------------------------------------
Attach Optical Drive
1. Create a cdrom directory under the MNT directory
CD/mnt
Mkdir CDROM
2. Mount the optical drive
Mount-T iso9660/dev/CDROM/mnt/CDROM
3. Uninstall the optical drive
Umount/mnt/CDROM
**************************************** **************************************** ***********************
Onfig eth0 new IP address (the original IP address will be changed after the command is restarted)
Then edit/etc/sysconfig/network-scripts/ifcfg-eth0 and modify the IP
[Aeolus @ db1 network-Scripts] $ VI ifcfg-eth0
Device = eth0 device name
Onboot = yes whether the NIC is activated when the computer is started
Bootproto = static method for obtaining IP addresses,
Ipaddr = 192.168.2.111 IP Address
Netmask = 255.255.255.0 Subnet Mask
Gateway = 219.136.241.254 Gateway (not in my VM)
[Aeolus @ db1 etc] $ VI resolv. conf
Nameserver 202.96.128.68
Nameserver 219.136.241.206
-----------------------
Modify the nic ip address and gateway in Linux
We recommend that you use the terminal character to modify it.
1. Modify the IP address
VI/etc/sysconfig/network-scripts/ifcfg-eth0
Device = eth0
Bootproto = none
Broadcast = 192.168.1.255
Ipaddr = 192.168.1.33
Netmask = 255.255.255.0
Network = 192.168.1.0
Onboot = Yes
Userctl = No
Peerdns = No
Type = Ethernet
~
VI/etc/sysconfig/network-scripts/ifcfg-eth1
Device = eth1
Onboot = Yes
Bootproto = none
Ipaddr = 192.168.2.34
Netmask = 255.255.255.0
Userctl = No
Peerdns = No
Type = Ethernet
Network = 192.168.2.0
Broadcast = 192.168.2.255
2. Modify the Gateway
VI/etc/sysconfig/Network
Networking = Yes
Hostname = Aaron
Gateway = 192.168.1.1
3. Restart the network configuration
/Etc/init. d/network restart
Bytes -----------------------------------------------------------------------------------
Modify configuration file
/Etc/sysconfig/network-scripts/has a configuration file
For example, the file: ifcfg-eth0 represents the configuration file of the actual Ethernet NIC 0
For example, the file: ifcfg-eth0: 1 represents the actual Ethernet NIC 0 configuration file
Domain Name Server Configuration File:/etc/resolv. conf
Modify IP Address
Effective immediately:
# Ifconfig eth0 192.168.0.20 netmask 255.255.255.0
Start effective:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Modify the Default Gateway
Effective immediately:
# Route add default GW 192.168.0.254
Start effective:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Modify DNS
Modify/etc/resolv. conf
The modification takes effect immediately and starts as well.
Modify host name
Effective immediately:
# Hostname FC2
Start effective:
Modify/etc/sysconfig/Network
End