Ifconfig eth0 new IP
Then edit/etc/sysconfig/network-scripts/ifcfg-eth0 and modify the IP
[Aeolus @ db1 network-Scripts] $ VI ifcfg-eth0
Device = eth0
Onboot = Yes
Bootproto = static
Ipaddr = 219.136.241.211
Netmask = 255.255.255.255.128
Gateway = 219.136.241.254
[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